External Screen API: Automatic Reconnection Demo

Explanation:

This demo uses the JavaScript callback 'kp_ExternalScreen_connectionStateDidChange(connectionState)' to trigger a change in the UI when a monitor is connected. This callback is automatically triggered by Kiosk Pro whenever a change in the connection state is detected by the app.

When no monitor is connected ('connectionState = 0' ), the div below will request that the device be connected to a monitor.

When connected, the device will automatically enter native mirroring ('connectionState = 1' ). This demo uses that notification of a mirroring connection state to trigger a call to the 'connectToScreen()' function, which moves the external monitor from mirroring to a full connection.

When the change to a full connection state occurs ('connectionState = 2' ), this demo triggers a call to open a test page on the external display and changes the status message shown below.

Status:

No external monitor detected.