Presentation Features
The Presentation API aims at allowing Web applications to use the presentation display mode. The display used to present may be the same that the browser is using, but may also be the external display device. The browser might serve as the initiator of the presentation as well as receive the connections to the presentations initiated externally on the presentation display.
The API at the moment is supported only in Chrome and Opera, on desktop and on Android.
API glimpse
navigator.presentation.defaultRequest = new PresentationRequest(presentationUrl)
- Sets up an object representing the browser's request for initiating the specified presentation on a presentation display.
request.getAvailability()
- Returns a
Promise
resolved with the object providing availability of a presentation display. availability.value
- Returns a boolean indicating whether a presentation display is available.
availability.addEventListener('change', listener)
- An event fired when the availability status of a presentation display has changed.
request.start()
- Returns a
Promise
resolved with the connection to the newly initiated presentation on the presentation display. connection.state
- Returns a string indicating the state of the presentation on the presentation display, i.e.
connected
,closed
,terminated
. connection.addEventListener('statechange', listener)
- An event fired when the state of the presentation on the presentation display has changed.
connection.send(message)
- Sends a message to the presentation running on the presentation display.
connection.addEventListener('message', listener)
- An event fired when a message from the presentation running on the presentation display has been received.
connection.close()
- Closes the connection to the presentation running on the presentation display, letting it continue uninterrupted.
connection.terminate()
- Terminates the presentation running on the presentation display.
navigator.presentation.receiver.getConnections()
- Returns a
Promise
resolved with the array of connections to the presentations running on a presentation display. navigator.presentation.receiver.addEventListener('connectionavailable', listener)
- An event fired when the new connection to the presentations running on a presentation display has become available.