Class Index | File Index

Classes


Namespace bc.device.externalscreen


Defined in: device.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Note: The functions on the bc.device.externalscreen object are only available on iOS devices at this time.
Function Summary
Function Attributes Function Name and Description
 
bc.device.externalscreen.closeExternalScreen(successCallback, errorCallback)
This function will remove the view on an external screen.
 
bc.device.externalscreen.openExternalWebView(uri, successCallback, errorCallback)
This function will display a webview on an external screen using specified the URI.
 
bc.device.externalscreen.pauseVideo(successCallback, errorCallback)
This function will pause any currently playing video on a connected Apple TV where playback was initiated by calling the the bc.device.externalscreen.playVideo function.
 
bc.device.externalscreen.playVideo(videoURL, successCallback, errorCallback, options)
Given a URL to a video (encoded to H.264 as progressive download or HLS) will play the video on an externally connected screen.
 
bc.device.externalscreen.postMessage(successCallback, errorCallback, errorCallback)
This function is used for communication between an external webview and the device's active web view.
 
bc.device.externalscreen.seekVideo(timecode, successCallback, errorCallback)
This function will seek to the specified timecode for a video that is on the AppleTV.
 
bc.device.externalscreen.stopVideo(successCallback, errorCallback)
This function will stop any currently playing video on a connected Apple TV where playback was initiated by calling the the bc.device.externalscreen.playVideo function.
Namespace Detail
bc.device.externalscreen
Note: The functions on the bc.device.externalscreen object are only available on iOS devices at this time.

bc.device.externalscreen provides functions to interact with a connected screen. Specifically, this means a connected Apple TV screen. These functions work if the source iOS device (iPhone, iPad) have mirroring turned on for a specific Apple TV. These functions only work on iOS devices. Note that all functions take an optional success and error handler.
Function Detail
bc.device.externalscreen.closeExternalScreen(successCallback, errorCallback)
This function will remove the view on an external screen.

Note:In order for the Apple TV to be connected the user of the iOS device must have turned on mirroring. You can listen for mirroring to be turned on/off by the user by listening for the "externalscreenconnected" event on the bc object.

Note:This API only works on iOS devices.

   $( "#close" ).bind( "tap", function() {
      bc.device.externalscreen.closeExternalScreen();
   });
Parameters:
successCallback
The function that is called if the webview is displayed
errorCallback
The function that is called if an error occurs. The errorCallback function is passed an object that contains a property named errorCode, which maps to one of the codes defined in bc.device.codes, and a property named errorMessage, which provides additional information about this error.

bc.device.externalscreen.openExternalWebView(uri, successCallback, errorCallback)
This function will display a webview on an external screen using specified the URI.

Note:In order for the Apple TV to be connected the user of the iOS device must have turned on mirroring. You can listen for mirroring to be turned on/off by the user by listening for the "externalscreenconnected" event on the bc object.

Note:This API only works on iOS devices.

Note: If seekVideo is called from the browser, we will call the errorCallback with the errorCode: bc.device.codes.COMMAND_ONLY_AVAILABLE_IN_A_NATIVE_APPLICATION.

   $( "#display" ).bind( "tap", function() {
      bc.device.externalscreen.openExternalWebview( "test.html" );
   });
Parameters:
uri
The URI string specified in the manifest
successCallback
The function that is called if the webview is displayed
errorCallback
The function that is called if an error occurs. The errorCallback function is passed an object that contains a property named errorCode, which maps to one of the codes defined in bc.device.codes, and a property named errorMessage, which provides additional information about this error.

bc.device.externalscreen.pauseVideo(successCallback, errorCallback)
This function will pause any currently playing video on a connected Apple TV where playback was initiated by calling the the bc.device.externalscreen.playVideo function. If no video is currently playing, calling this function has no effect. You can resume playback of a paused video by calling bc.device.externalscreen.playVideo and pass in the URL to the video for the currently paused video. Calling playVideo with the same URL will resume playback from the timecode that the video was paused at.

Note:In order for the Apple TV to be connected the user of the iOS device must have turned on mirroring. You can listen for mirroring to be turned on/off by the user by listening for the "externalscreenconnected" event on the bc object.

Note:This API only works on iOS devices.

Note: If pauseVideo is called from the browser, we will call the errorCallback with the errorCode: bc.device.codes.COMMAND_ONLY_AVAILABLE_IN_A_NATIVE_APPLICATION.

    $(bc).bind( "externalscreenconnected", function() {
      // start playing back a video
      bc.device.externalscreen.playVideo( "http://someurl.com/a.m4v" );
    });

    // register a tap handler for the user hitting the pause button.  Typically, this pause button would be displayed on the iOS device
    $("#pauseButton").bind( "tap", function() {
      bc.device.externalscreen.pauseVideo( pauseSuccessHandler );        
    });

    function pauseSuccessHandler() {
      // now that pause was called successfully we update the pause button control on the iPad to show the play action
    }
Parameters:
successCallback
The function that is called if the video is successfully paused.
errorCallback
The function that is called if an error occurs. The errorCallback function is passed an object that contains a property named errorCode, which maps to one of the codes defined in bc.device.codes, and a property named errorMessage, which provides additional information about this error.

bc.device.externalscreen.playVideo(videoURL, successCallback, errorCallback, options)
Given a URL to a video (encoded to H.264 as progressive download or HLS) will play the video on an externally connected screen. Typically this means playing the video on an Apple TV. In this case, the phone/tablet will continue to show whatever view is currently in focus and the video will be sent to the Apple TV (externally connected screen). If this function is called with the same URL as the one that is currently loaded into the external video player, the effect is that playback continues from the current timecode. This is most useful in the circumstance where the video is currently paused. Calling the playVideo video function with the same URL would resume playback.

Note:In order for the Apple TV to be connected the user of the iOS device must have turned on mirroring. You can listen for mirroring to be turned on/off by the user by listening for the "externalscreenconnected" event on the bc object.

Note: This API only works on iOS devices.

Note: If playVideo is called from the browser, we will call the errorCallback with the errorCode: bc.device.codes.COMMAND_ONLY_AVAILABLE_IN_A_NATIVE_APPLICATION.

    $(bc).bind( "externalscreenconnected", function() {
      bc.device.externalscreen.playVideo( "http://someurl.com/a.m4v", successHandler, errorHandler);
    });

    $(bc).bind( "externalscreenvideoplaying", function() {
      // update UI on iPad to give them controls to pause/stop video playing on Apple TV
    });
Parameters:
videoURL
The URL to a video to playback. The URL must be in a format that can playback on an iOS device. It is strongly recommended that this be an HLS encoded video. This parameter is passed as a String.
successCallback
The function that is called if the URL is successfully passed to the video player. Note: this does not mean that playback has begun. It only means that the URL has been registered with the video player. You can listen for the "externalscreenvideoplaying" event to be fired on the bc object.
errorCallback
The function that is called if an error occurs. The errorCallback function is passed an object that contains a property named errorCode, which maps to one of the codes defined in bc.device.codes, and a property named errorMessage, which provides additional information about this error.
options
An options object. We look for the timecode which if not 0, will play the video at the given time. Support for this depends on encoding of the video, as explained here

bc.device.externalscreen.postMessage(successCallback, errorCallback, errorCallback)
This function is used for communication between an external webview and the device's active web view. If called from the device, this will post the message to the external screen if the external screen has an active webview. If called from the external web view, this will post the message to the active device webview.

Note:In order for the Apple TV to be connected the user of the iOS device must have turned on mirroring. You can listen for mirroring to be turned on/off by the user by listening for the "externalscreenconnected" event on the bc object.

Note:This API only works on iOS devices.

Note: If seekVideo is called from the browser, we will call the errorCallback with the errorCode: bc.device.codes.COMMAND_ONLY_AVAILABLE_IN_A_NATIVE_APPLICATION.

   $( "#postmessage" ).bind( "tap", function() {
      bc.device.externalscreen.postMessage("Bonzai!", successCallback, errorCallback);
   });
Parameters:
successCallback
The function that is called if the webview is displayed
errorCallback
The function that is called if an error occurs. The errorCallback function is passed an object that contains a property named errorCode, which maps to one of the codes defined in bc.device.codes, and a property named errorMessage, which provides additional information about this error.
errorCallback

bc.device.externalscreen.seekVideo(timecode, successCallback, errorCallback)
This function will seek to the specified timecode for a video that is on the AppleTV. The video must have been initiated on the AppleTV by calling bc.device.externalscreen.playVideo function. This function will work if the video is either currently playing or is paused.

Note:In order for the Apple TV to be connected the user of the iOS device must have turned on mirroring. You can listen for mirroring to be turned on/off by the user by listening for the "externalscreenconnected" event on the bc object.

Note:This API only works on iOS devices.

Note: If seekVideo is called from the browser, we will call the errorCallback with the errorCode: bc.device.codes.COMMAND_ONLY_AVAILABLE_IN_A_NATIVE_APPLICATION.

   $( "#skip" ).bind( "tap", function() {
     //Jump to minute 5
      bc.device.externalscreen.seekVideo( 600 );
   });
Parameters:
timecode
The timecode that you would like to seek to. Could be forward or backward from the current timecode. This parameter is passed as a Number. This timecode represents the 'seconds' that you want to seek to. For example, if you wanted to seek to the three minute mark then you would call bc.device.externalscreen.seekVideo( 180, successHandler, errorHandler)
successCallback
The function that is called if the video is successfully seeked into.
errorCallback
The function that is called if an error occurs. The errorCallback function is passed an object that contains a property named errorCode, which maps to one of the codes defined in bc.device.codes, and a property named errorMessage, which provides additional information about this error.

bc.device.externalscreen.stopVideo(successCallback, errorCallback)
This function will stop any currently playing video on a connected Apple TV where playback was initiated by calling the the bc.device.externalscreen.playVideo function. When this function is called the timecode of the video is set back to 0. Calling playVideo would start the video over from the beginning. If you only want to pause the video then call bc.device.externalscreen.pauseVideo. This function is most frequently used when you want to stop playback of a video and let a user choose a new video to playback.

Note:In order for the Apple TV to be connected the user of the iOS device must have turned on mirroring. You can listen for mirroring to be turned on/off by the user by listening for the "externalscreenconnected" event on the bc object.

Note:This API only works on iOS devices.

Note: If stopVideo is called from the browser, we will call the errorCallback with the errorCode: bc.device.codes.COMMAND_ONLY_AVAILABLE_IN_A_NATIVE_APPLICATION.

    $(bc).bind( "externalscreenconnected", function() {
      // start playing back a video
      bc.device.externalscreen.playVideo( "http://someurl.com/a.m4v", successHandler, errorHandler);
    });

    // register a tap handler for the user hitting the stop button.  Typically, this stop button would be displayed on the iOS device
    $("#stopButton").bind( "tap", function() {
      bc.device.externalscreen.stopVideo( stopSuccessHandler, stopErrorHandler );        
    });

    function stopSuccessHandler() {
      // now that stop was called successfully we let the user pick from a new set of videos to playback
    }
Parameters:
successCallback
The function that is called if the video is successfully stopped.
errorCallback
The function that is called if an error occurs. The errorCallback function is passed an object that contains a property named errorCode, which maps to one of the codes defined in bc.device.codes, and a property named errorMessage, which provides additional information about this error.

Documentation generated by JsDoc Toolkit 2.3.2 on Wed Nov 14 2012 15:33:32 GMT-0500 (EST)