API: Connect & Configure External Screen
Connect to and configure display options for an external screen or projector.
Requirements
- Integration of our JavaScript API into your webpage
- Sample code to run within the app and download for integration into your own project is available here.
- Best practices for working with the JavaScript API are available here.
- App Settings
- Content > JavaScript API > Access JavaScript API = By Import
- Screensaver > External Monitor Mode = Interactive or Standard Mirroring
- Physical Hardware
- External screen or projector connected via HDMI to the iPad through a Digital AV Adapter or hub or to a connected Apple TV for wireless Airplay.
Triggers via API Functions
Connect To Screen
This function is used to exit native screen mirroring and begin sending full-screen content to the external display through the External Screen API. If the external display is not linked to the device (either by AirPlay or AV Adapter) or if the external screen is already connected through the External Screen API, then this function does nothing. If the external display is linked to the device and is using native mirroring, then this function initiates a connection with the external display, displaying a plain, black background on the external display until the first request to display content is sent.
Format | kp_ExternalScreen_connectToScreen(); |
Triggers | Kiosk Pro will immediately trigger kp_ExternalScreen_connectionStateDidChange and pass the current connection state of the external display. |
Disconnect From Screen
This function is used to end sending full-screen content to the external display through the External Screen API and revert to native screen mirroring. If the external display is not linked to the device (either by AirPlay or AV Adapter) or if the external screen is already mirroring the iPad, then this function does nothing. If the external display is linked to the device and is connected through the External Screen API, then this function returns the external display to native screen mirroring.
Format | kp_ExternalScreen_disconnectFromScreen(); |
Triggers | Kiosk Pro will immediately trigger kp_ExternalScreen_connectionStateDidChange and pass the current connection state of the external display. |
Check Connection State
This function triggers a check of the current connection state of the external display.
Format | kp_ExternalScreen_requestStateOfConnection(); |
Triggers | Kiosk Pro will immediately trigger kp_ExternalScreen_connectionStateDidChange and pass the current connection state of the external display. |
Check Screen Properties
This function triggers a callback returning the following properties associated with the external display:
- Array of available screen modes with each mode shown as a set of screen pixel dimensions and pixel aspect ratio
- Current screen mode index (in array of available screen modes).
- Preferred screen mode index (in array of available screen modes).
- Overscan compensation mode value.
Format | kp_ExternalScreen_requestProperties(callback); |
Parameters | |
Callback Format | callback(screenProperties); |
Callback Return Values |
|
Example | {'modes':new Array({'width':640.00, 'height':480.00, 'pixelAspectRatio':1.00}, {'width':800.00, 'height':600.00, 'pixelAspectRatio':1.00}, {'width':1024.00, 'height':768.00, 'pixelAspectRatio':1.00}), 'curMode':0, 'prefMode':2, 'overscanCompensation':3} |
Set Screen Mode
This function sets a new screen mode for the external display. The new screen mode is specified as a pair, declaring the desired width and height. If the external display is not linked or does not support the declared resolution, this method will fail. As such, it is generally recommended to check the available resolution modes through kp_ExternalScreen_requestProperties(); prior to setting a new screen mode.
Format | kp_ExternalScreen_setScreenMode(width, height, сallback); |
Parameters |
|
Callback Format | callback(newModeWasSet); |
Callback Return Values |
|
Set Overscan Compensation Mode
This function sets a new overscan compensation mode for the external display. If no external display is connected or the display does not support the declared resolution, then this method will fail.
Format | kp_ExternalScreen_setOverscanCompensationMode(mode, сallback); |
Parameters |
|
Callback Format | callback(newModeWasSet); |
Callback Return Values |
|
Notifications via API Callbacks
When Connection State Changes
This callback is triggered each time the external display is connected or disconnected and also as result of calling kp_ExternalScreen_requestStateOfConnection.
Format | kp_ExternalScreen_connectionStateDidChange(stateOfConnection); |
Return Values |
|
Sample Code
- This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
- To run sample code, set the app's homepage to kioskgroup.com/external-screen-api
- To download a .zip of sample code, click here.
Change Log
- Added in initial version of Enterprise. Major revision of underlying code base in version 7.3