diff --git a/index.html b/index.html index ec56f9f..0986b8a 100644 --- a/index.html +++ b/index.html @@ -667,8 +667,22 @@

- Monitor availability of presentation displays example + Monitoring availability of presentation displays

+ +

+ This code renders a button that is visible when there is at least one + compatible presentation display that can + present https://example.com/presentation.html or + https://example.net/alternate.html. +

+

+ Monitoring of display availability is done by first creating + a PresentationRequest with the URLs you want to present, then + calling getAvailability to + obtain a PresentationAvailability object whose change + event will fire when presentation availability changes state. +

 <!-- controller.html -->
 <button id="presentBtn" style="display: none;">Present</button>
@@ -703,8 +717,23 @@ 

- Starting a new presentation example + Starting a new presentation

+

+ When the user clicks presentBtn, this code requests + presentation of one of the URLs in the PresentationRequest. + When start is called, the + browser typically shows a dialog that allows the user to select one of + the compatible displays that are available. The first URL in + the PresentationRequest that is compatible with the chosen + display will be presented on that display. +

+

+ The start method resolves + with a PresentationConnection object that is used to track the + state of the presentation, and exchange messages with the presentation + page once it's loaded on the display. +

 <!-- controller.html -->
 <script>
@@ -722,8 +751,17 @@ 

- Reconnect to a presentation example + Reconnecting to an existing presentation

+

+ The presentation continues to run even after the original page that + started the presentation closes its PresentationConnection, + navigates, or is closed. Another page can use + the id on + the PresentationConnection to reconnect to an existing + presentation and resume control of it. This is only guaranteed to + work from the same browser that started the presentation. +

 <!-- controller.html -->
 <button id="reconnectBtn" style="display: none;">Reconnect</button>
@@ -750,8 +788,19 @@ 

- Presentation initiation by the controlling UA example + Starting a presentation by the controlling user agent

+

+ Some browsers have a way for users to start a presentation without + interacting directly with the controlling page. Controlling pages can + opt into this behavior by setting + the defaultRequest property + on navigator.presentation, and listening for + a connectionavailable event that is fired when a presentation + is started this way. The PresentationConnection passed with + the event behaves the same as if the page had + called start. +

 <!-- controller.html -->
 <!-- Setting presentation.defaultRequest allows the page to specify the
@@ -768,8 +817,22 @@ 

- Monitor connection's state and exchange data example + Monitoring the connection state and exchanging data

+

+ Once a presentation has started, the + returned PresentationConnection is used to monitor its state + and exchange messages with it. Typically the user will be given the + choice to disconnect from or terminate the presentation from the + controlling page. +

+

+ Since the the controlling page may connect to and disconnect from multiple + presentations during its lifetime, it's helpful to keep track of the + current PresentationConnection and its state. Messages can + only be sent and received on connections in + a connected state. +

 <!-- controller.html -->
 <button id="disconnectBtn" style="display: none;">Disconnect</button>
@@ -843,8 +906,15 @@ 

- Monitor available connection(s) and say hello + Listening for incoming presentation connections

+

+ This code runs on the presented page + (https://example.org/presentation.html). Presentations + may be connected to from multiple controlling pages, so it's important + that the presented page listen for incoming connections on + the connectionList object. +

 <!-- presentation.html -->
 <script>
@@ -895,6 +965,12 @@ 

Creating a second presentation from the same controlling page

+

+ It's possible for a controlling page to start and control two + independent presentations on two different presentation displays. + This code shows how a second presentation can be added to the first + one in the examples above. +

 <!-- controller.html -->
 <!-- The same controlling page can create and manage multiple presentations,
@@ -2163,7 +2239,8 @@ 

context using S.

- When the terminate method is called on a + When the terminate + method is called on a PresentationConnection S in a receiving browsing context, the user agent MUST run the algorithm to terminate a presentation in a receiving browsing context @@ -2410,7 +2487,7 @@

  • Let event be a newly created trusted event that uses the MessageEvent interface, with the event type - message, which does not bubble, is not cancelable, and has + message, which does not bubble, is not cancelable, and has no default action.
  • Initialize the event's data attribute as follows: @@ -2488,7 +2565,7 @@

    closed means that either the controlling browsing context or the receiving browsing context that were connected by the PresentationConnection called - close. + close().

  • wentaway means that the browser closed the connection, @@ -2632,7 +2709,7 @@

  • Fire a trusted event with the name - close, + close, that uses the PresentationConnectionCloseEvent interface, with the reason attribute @@ -2681,8 +2758,7 @@

    "PresentationConnectionState">terminated.

  • - Fire a simple event named terminate at known + Fire a simple event named terminate at known connection.
  • @@ -2795,8 +2871,7 @@

    "PresentationConnectionState">terminated.
  • - Fire a simple event named terminate at + Fire a simple event named terminate at connection.
  • @@ -2830,7 +2905,7 @@

    onmessage - message + message @@ -2846,8 +2921,7 @@

    onclose - close + close @@ -2855,8 +2929,7 @@

    onterminate - terminate + terminate