From f22c88bcd58048501c6ccdb6a4cb99fc462d5a98 Mon Sep 17 00:00:00 2001 From: "mark a. foltz" Date: Tue, 26 Mar 2019 10:53:56 -0700 Subject: [PATCH 1/4] Update examples --- index.html | 95 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index ec56f9f..f1455de 100644 --- a/index.html +++ b/index.html @@ -669,6 +669,20 @@

Monitor availability of presentation displays example

+ +

+ 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>
@@ -705,6 +719,20 @@ 

Starting a new presentation example

+

+ This code requests presentation of one of the URLs in + the PresentationRequest. + When start is called, the + browser will typically show a dialog allowing the user to choose a + compatible display. The first URL in the request 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. +

 <!-- controller.html -->
 <script>
@@ -724,6 +752,16 @@ 

Reconnect to a presentation example

+

+ If the original page that started the presentation closes + its PresentationConnection, navigates or is closed, then the + presentation continues to run. + The id on + the PresentationConnection can be used to reconnect to an + existing presentation from a different page and resume control. This + is only guaranteed to work from the same browser that started the + presentation. +

 <!-- controller.html -->
 <button id="reconnectBtn" style="display: none;">Reconnect</button>
@@ -752,6 +790,14 @@ 

Presentation initiation by the controlling UA example

+

+ Some browsers may have a way for users to start presentation without + the interacting directly with the page. Pages can opt into this + behavior by setting the defaultRequest + property and listening for a connectionavailable event when a + presentation is started this way. The PresentationConnection + behaves the same as if the page had called start. +

 <!-- controller.html -->
 <!-- Setting presentation.defaultRequest allows the page to specify the
@@ -770,6 +816,19 @@ 

Monitor connection's state and exchange data example

+

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

+

+ Since the same 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>
@@ -845,6 +904,13 @@ 

Monitor available connection(s) and say hello

+

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

 <!-- presentation.html -->
 <script>
@@ -895,6 +961,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 started in addition + to the first one as shown above. +

 <!-- controller.html -->
 <!-- The same controlling page can create and manage multiple presentations,
@@ -2163,7 +2235,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 +2483,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 +2561,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 +2705,7 @@

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

    "PresentationConnectionState">terminated.

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

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

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

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

    onterminate - terminate + terminate From 34ef5ea5e1b0e5617713fb7e4836b9a117625f5e Mon Sep 17 00:00:00 2001 From: "mark a. foltz" Date: Tue, 26 Mar 2019 11:02:35 -0700 Subject: [PATCH 2/4] Copy edits --- index.html | 62 +++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/index.html b/index.html index f1455de..5ee69ca 100644 --- a/index.html +++ b/index.html @@ -720,18 +720,19 @@

    Starting a new presentation example

    - This code requests presentation of one of the URLs in - the PresentationRequest. + When the user clicks presentBtn, this code requests + presentation of one of the URLs in the PresentationRequest. When start is called, the - browser will typically show a dialog allowing the user to choose a - compatible display. The first URL in the request that is compatible - with the chosen display will be presented on that display. + browser typically shows a dialog listing compatible displays and + allows the user to pick one. 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. + page once it's loaded on the display.

     <!-- controller.html -->
    @@ -753,14 +754,13 @@ 

    Reconnect to a presentation example

    - If the original page that started the presentation closes - its PresentationConnection, navigates or is closed, then the - presentation continues to run. - The id on - the PresentationConnection can be used to reconnect to an - existing presentation from a different page and resume control. This - is only guaranteed to work from the same browser that started the - 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 -->
    @@ -791,12 +791,15 @@ 

    Presentation initiation by the controlling UA example

    - Some browsers may have a way for users to start presentation without - the interacting directly with the page. Pages can opt into this - behavior by setting the defaultRequest - property and listening for a connectionavailable event when a - presentation is started this way. The PresentationConnection - behaves the same as if the page had called start. + Some browsers have a way for users to start a presentation without the + 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 -->
    @@ -817,17 +820,18 @@ 

    Monitor connection's state and exchange data example

    - Once a presentation has started, the PresentationConnection is - used to monitor its state and exchange messages. Typically the user - will be given the choice to disconnect from or terminate the - presentation. + 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 same page may connect to and disconnect from multiple + 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. + a connected state.

     <!-- controller.html -->
    @@ -907,7 +911,7 @@ 

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

    @@ -964,8 +968,8 @@

    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 started in addition - to the first one as shown above. + This code shows how a second presentation can be added to the first + one in the examples above.

     <!-- controller.html -->
    
    From c051dbb7daa22e7b8837a019673bb36e933637ea Mon Sep 17 00:00:00 2001
    From: "mark a. foltz" 
    Date: Mon, 1 Apr 2019 16:08:55 -0700
    Subject: [PATCH 3/4] Respond to suggestions by chrisn@
    
    ---
     index.html | 18 +++++++++---------
     1 file changed, 9 insertions(+), 9 deletions(-)
    
    diff --git a/index.html b/index.html
    index 5ee69ca..2b79dca 100644
    --- a/index.html
    +++ b/index.html
    @@ -667,7 +667,7 @@ 

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

    @@ -717,14 +717,14 @@

    - 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 listing compatible displays and - allows the user to pick one. The first URL in + 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.

    @@ -751,7 +751,7 @@

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

    The presentation continues to run even after the original page that @@ -788,10 +788,10 @@

    - 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 the + 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 @@ -817,7 +817,7 @@

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

    Once a presentation has started, the @@ -906,7 +906,7 @@

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

    This code runs on the presented page From e5cf86ef50e6e95a149037bee7dca1db6b7f7e8a Mon Sep 17 00:00:00 2001 From: "mark a. foltz" Date: Mon, 1 Apr 2019 16:11:14 -0700 Subject: [PATCH 4/4] Fix typo --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 2b79dca..0986b8a 100644 --- a/index.html +++ b/index.html @@ -817,7 +817,7 @@

    - Monitoring the connection state exchanging data + Monitoring the connection state and exchanging data

    Once a presentation has started, the