Namespace bc.device.externalscreen
Defined in: device.js.
| 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 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.
|
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.
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
errorCallbackfunction is passed an object that contains a property namederrorCode, which maps to one of the codes defined inbc.device.codes, and a property namederrorMessage, which provides additional information about this error.
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
errorCallbackfunction is passed an object that contains a property namederrorCode, which maps to one of the codes defined inbc.device.codes, and a property namederrorMessage, which provides additional information about this error.
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
errorCallbackfunction is passed an object that contains a property namederrorCode, which maps to one of the codes defined inbc.device.codes, and a property namederrorMessage, which provides additional information about this error.
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
errorCallbackfunction is passed an object that contains a property namederrorCode, which maps to one of the codes defined inbc.device.codes, and a property namederrorMessage, 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
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
errorCallbackfunction is passed an object that contains a property namederrorCode, which maps to one of the codes defined inbc.device.codes, and a property namederrorMessage, which provides additional information about this error. - errorCallback
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
errorCallbackfunction is passed an object that contains a property namederrorCode, which maps to one of the codes defined inbc.device.codes, and a property namederrorMessage, which provides additional information about this error.
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
errorCallbackfunction is passed an object that contains a property namederrorCode, which maps to one of the codes defined inbc.device.codes, and a property namederrorMessage, which provides additional information about this error.