From b675671c575d3be60b3d3e4a3e49e87557b7501b Mon Sep 17 00:00:00 2001
From: "mark a. foltz"
// The Present button is visible if at least one presentation display is available
var presentBtn = document.getElementById("presentBtn");
// It is also possible to use relative presentation URL e.g. "presentation.html"
- var presUrl = "http://example.com/presentation.html";
+ var presUrls = ["http://example.com/presentation.html",
+ "http://another.com/alternate.html"];
// show or hide present button depending on display availability
var handleAvailabilityChange = function(available) {
presentBtn.style.display = available ? "inline" : "none";
};
// Promise is resolved as soon as the presentation display availability is
// known.
- var request = new PresentationRequest(presUrl);
+ var request = new PresentationRequest(presUrls);
request.getAvailability().then(function(availability) {
// availability.value may be kept up-to-date by the controlling UA as long
// as the availability object is alive. It is advised for the web developers
@@ -591,7 +592,7 @@
PresentationRequest to use when the controlling UA initiates a
presentation. -->
<script>
- navigator.presentation.defaultRequest = new PresentationRequest(defaultUrl);
+ navigator.presentation.defaultRequest = new PresentationRequest(presUrls);
navigator.presentation.defaultRequest.onconnectionavailable = function(evt) {
setConnection(evt.connection);
};
@@ -662,7 +663,7 @@
Monitor available connection(s) and say hello
-<!-- receiver.html -->
+<!-- presentation.html -->
<script>
var addConnection = function(connection) {
connection.onconnect = function () {
@@ -697,7 +698,7 @@
connection.send("{string: 'Hello, world!', lang: 'en-US'}");
</script>
-<!-- receiver.html -->
+<!-- presentation.html -->
<script>
connection.onmessage = function (message) {
var messageObj = JSON.parse(message);
@@ -917,7 +918,7 @@
Interface
PresentationRequest
- [Constructor(DOMString url)]
+ [Constructor(DOMString[] urls)]
interface PresentationRequest : EventTarget {
Promise<PresentationConnection> start();
Promise<PresentationConnection> reconnect(DOMString presentationId);
@@ -938,8 +939,10 @@
When a PresentationRequest
is constructed, the
- given url
MUST be used as the presentation request
- URL which is the presentation URL for the
+ given urls
MUST be used as the list
+ of presentation request URLs which are each a
+ possible presentation URL for the
PresentationRequest
instance.
PresentationRequest
object with
- presentationUrl as the constructor argument and return
+ presentationUrls as the constructor argument and return
it.
PresentationRequest
object
getAvailability()
method. The
set of availability objects is represented as a set of
- tuples (A, availabilityUrl),
+ tuples (A, availabilityUrl[]),
initially empty, where:
getAvailability()
is called to
- create A.
+ create A;
true
otherwise.
true
if
newDisplays is not empty and at least one display in
newDisplays is a compatible presentation
- display for availabilityUrl. Otherwise, set
+ display for at least one member
+ of availabilityUrls. Otherwise, set
newAvailability to false
.
When a PresentationRequest
is constructed, the
- given urls
MUST be used as the list
- of presentation request URLs which are each a
- possible presentation URL for the
- PresentationRequest
instance.
+ given urls
MUST be used as the list of presentation
+ request URLs which are each a possible presentation URL
+ for the PresentationRequest
instance.
availabilityUrl[] is the list of presentation
+ request URLs when getAvailability()
is called to
create A;
true
if
newDisplays is not empty and at least one display in
newDisplays is a compatible presentation
- display for at least one member
- of availabilityUrls. Otherwise, set
+ display for at least one member of
+ availabilityUrls. Otherwise, set
newAvailability to false
.
- Given the operating context of the presentation display, some - APIs will not work by design (for example, by requiring user input) - or will be obsolete (for example, by attempting window management); - the receiving user agent should be aware of this. - Furthermore, any modal user interface will need to be handled + Given the operating context of the presentation display, + some APIs will not work by design (for example, by requiring user + input) or will be obsolete (for example, by attempting window + management); the receiving user agent should be aware of + this. Furthermore, any modal user interface will need to be handled carefully.
@@ -2560,12 +2560,12 @@- Thanks to Addison Phillips, Anne Van Kesteren, Anssi Kostiainen, - Anton Vayvod, Chris Needham, Christine Runnegar, Daniel Davis, - Domenic Denicola, Erik Wilde, François Daoust, 闵洪波 (Hongbo Min), - Hongki CHA, Hubert Sablonnière, Hyojin Song, Hyun June Kim, - Jean-Claude Dufourd, Joanmarie Diggs, Jonas Sicking, Louay Bassbouss, - Mark Watson, Martin Dürst, Matt Hammond, Mike West, Mounir Lamouri, - Nick Doty, Oleg Beletski, Philip Jägenstedt, Richard Ishida, - Shih-Chiang Chien, Takeshi Kanai, Tobie Langel, Tomoyuki Shimizu, - Travis Leithead, and Wayne Carr for help with editing, reviews and - feedback to this draft. + Thanks to Addison Phillips, Anne Van Kesteren, Anssi Kostiainen, Anton + Vayvod, Chris Needham, Christine Runnegar, Daniel Davis, Domenic + Denicola, Erik Wilde, François Daoust, 闵洪波 (Hongbo Min), Hongki CHA, + Hubert Sablonnière, Hyojin Song, Hyun June Kim, Jean-Claude Dufourd, + Joanmarie Diggs, Jonas Sicking, Louay Bassbouss, Mark Watson, Martin + Dürst, Matt Hammond, Mike West, Mounir Lamouri, Nick Doty, Oleg + Beletski, Philip Jägenstedt, Richard Ishida, Shih-Chiang Chien, Takeshi + Kanai, Tobie Langel, Tomoyuki Shimizu, Travis Leithead, and Wayne Carr + for help with editing, reviews and feedback to this draft.
When a PresentationRequest
is constructed, the
given urls
MUST be used as the list of presentation
+ "presentation request URL">presentation
request URLs which are each a possible presentation URL
for the PresentationRequest
instance.
The user agent MUST keep a list of available
- presentation displays. This current list of presentation
+ presentation displays. The list of available presentation
+ displays is represented by a list of
+ tuples (availabilityUrl, display). An entry in this list
+ means that display is curently available to start a
+ presentation and is a compatible presentation display
+ for availabilityUrl. This list of presentation
displays may be used for starting new presentations, and is
populated based on an implementation specific discovery mechanism.
It is set to the most recent result of the algorithm to monitor
@@ -1510,10 +1520,18 @@
PresentationAvailability
- object with its value
property set to
- false
if the list of available presentation
- displays is empty or none of them is a compatible
- presentation display, true
otherwise.
+ object with its value
property set as follows:
+
+
false
if the list of available presentation
+ displays is empty.
+ true
if there is at least one compatible
+ presentation display for some member of
+ of presentationUrls. That is, there is an
+ entry (availabilityUrl, display) in the
+ list of available presentation displays where availabiltyUrl is a member of presentationUrls.
+ false
otherwise.
running the following steps.
true
if
- newDisplays is not empty and at least one display in
- newDisplays is a compatible presentation
- display for at least one member of
- availabilityUrls. Otherwise, set
- newAvailability to false
.
+ false
.true
.When a PresentationAvailability object is no longer alive @@ -1586,11 +1614,12 @@
id
attribute specifies the
presentation connection's presentation identifier.
+
+ The url
attribute specifies the
+ presentation connection's presentation URL.
+
The state
attribute represents the
presentation connection's current state. It can take one of
@@ -2470,7 +2504,7 @@
@@ -2546,6 +2580,11 @@
When a PresentationRequest
is constructed, the
given urls
MUST be used as the list of presentation
- request URLs which are each a possible presentation URL
- for the PresentationRequest
instance.
+ "presentation request URL">presentation request URLs which are
+ each a possible presentation URL for the
+ PresentationRequest
instance.
The user agent MUST keep a list of available
presentation displays. The list of available presentation
- displays is represented by a list of
- tuples (availabilityUrl, display). An entry in this list
- means that display is curently available to start a
- presentation and is a compatible presentation display
- for availabilityUrl. This list of presentation
+ displays is represented by a list of tuples
+ (availabilityUrl, display). An entry in this list means
+ that display is curently available to start a
+ presentation and is a compatible presentation display for
+ availabilityUrl. This list of presentation
displays may be used for starting new presentations, and is
populated based on an implementation specific discovery mechanism.
It is set to the most recent result of the algorithm to monitor
@@ -1520,18 +1521,25 @@
PresentationAvailability
- object with its value
property set as follows:
+ object with its value
property set as follows:
false
if the list of available presentation
- displays is empty.
- true
if there is at least one compatible
- presentation display for some member of
- of presentationUrls. That is, there is an
- entry (availabilityUrl, display) in the
- list of available presentation displays where availabiltyUrl is a member of presentationUrls.
+ false
if the list of available presentation
+ displays is empty.
+ true
if there is at least one compatible
+ presentation display for some member of of
+ presentationUrls. That is, there is an entry
+ (availabilityUrl, display) in the list of
+ available presentation displays where
+ availabiltyUrl is a member of
+ presentationUrls.
+ false
otherwise.
false
otherwise.false
.
false
.true
.true
.
+ @@ -2595,8 +2609,8 @@
getAvailability()
is called to
- create A;
+ create A.
true
if there is at least one compatible
presentation display for some member of of
presentationUrls. That is, there is an entry
- (availabilityUrl, display) in the list of
- available presentation displays where
- availabiltyUrl is a member of
- presentationUrls.
+ (presentationUrl, display) in the list of
+ available presentation displays for some
+ presentationUrl in presentationUrls.
false
otherwise.
@@ -1582,7 +1581,7 @@ false
.
true
.
From beba2e92f385ed333afcc12128a11785f3c21ab3 Mon Sep 17 00:00:00 2001
From: "mark a. foltz" defaultRequest.start()
).
+ request for that controlling browsing context. If the
+ the document object's active sandboxing flag set has the
+ sandboxed presentation browsing context flag set, the
+ controlling user agent SHOULD act as if the default request
+ is not set for that browsing context. When the controlling user
+ agent wishes to initiate a PresentationConnection on the
+ behalf of that browsing context, it MUST start a
+ presentation using the default presentation request for
+ the controller (as if the controller had called
+ defaultRequest.start()
).
The controlling user agent SHOULD initiate presentation @@ -929,6 +929,7 @@
PresentationRequest
+ [Constructor(DOMString url)] [Constructor(DOMString[] urls)] interface PresentationRequest : EventTarget { Promise<PresentationConnection> start(); @@ -968,7 +969,8 @@Input
- - urls, the list of presentation request URLs + url or urls, the presentation request + URLs
- Output @@ -978,13 +980,17 @@
+
- If the constructor that take a single url was + invoked, let urls be a one item list with url + as its only member. +
- Let presentationUrls be an empty list of URLs.
-- For each URL url in urls: +
- For each URL U in urls:
-
- Resolve url relative to the API base URL - specified by the entry settings object, and add the - resulting absolute URL (if any) to presentationUrls. +
- Resolve U relative to the API base URL specified + by the entry settings object, and add the resulting + absolute URL (if any) to presentationUrls.
- If the resolve a URL algorithm failed, then throw a SyntaxError exception and abort all remaining steps. @@ -1101,15 +1107,10 @@
- Set the presentation identifier of S to I.
-- For each presentationUrl in - presentationUrls in order, run the following step: -
-
+- If there is an entry (presentationUrl, D) in the - list of available presentation displays, then set the - presentation URL for S to - presentationUrl and stop iterating. -
-- Set the presentation URL for S to the first + presentationUrl in presentationUrls for which + there exists an entry (presentationUrl, D) in the + list of available presentation displays.
- Set the presentation connection state of S to connecting. @@ -1540,7 +1541,7 @@
true
if there is at least one compatible - presentation display for some member of of + presentation display
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 using S.
+ to terminate a presentation in a receiving browsing context
+ using S.
When a PresentationConnection object is created, its
From 5b6ff798d7aa94ebab16b2c55a597fad6fc56ae1 Mon Sep 17 00:00:00 2001
From: "mark a. foltz"
Interface
PresentationRequest
- [Constructor(DOMString url)]
- [Constructor(DOMString[] urls)]
+ [Constructor(DOMString url),
+ Constructor(DOMString[] urls)]
interface PresentationRequest : EventTarget {
Promise<PresentationConnection> start();
Promise<PresentationConnection> reconnect(DOMString presentationId);
@@ -980,9 +980,8 @@
-
PresentationRequest
object with
- presentationUrls as the constructor argument and return
- it.
+ presentationUrls as its presentation request URLs
+ and return it.