-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow page to designate a default presentation URL #26
Comments
Hey everyone, as I'd like to implement this bit of the API in Chrome, I'd like to try to get a consensus on the thread [1] and add the result to the spec if possible. As I see it, the viable extra specification would consist of two parts:
[ Thoughts? Thanks, [1] This was discussed in November last year, see http://lists.w3.org/Archives/Public/public-webscreens/2014Nov/0007.html |
From mfoltz:
I think this is mostly a UI issue we should leave for the UAs to solve. The spec may mention it but leave it to the implementors to decide what to do (e.g. one could show a list of DPUs available and ask user to pick one).
Well, there might me more than one frame / page that declared the same DPU. It seems right to notify all of them; the page may ignore the event if its document is not in focus. |
I now think that having a separate tag for the default presentation id is a bad idea. First, it's not a link, second it doesn't really make sense to have it without the default presentation URL. So I think it'd be better to parse an extra 'id' attribute out of the rel='default-presentation' tag. If there're no objection, I'd like to start working on a pull request to add the default presentation info to the spec. |
The navigator object is global and not attached to a specific window. It feels unintuitive from an API perspective for it to behave differently according to the values of Dominik, Anssi, et. al., why was the |
From @mfoltzgoogle:
The use of From @avayvod:
Please feel free to craft a PR with your proposal. |
As I understand, having per-frame state in navigator is okay. Adding anything new to window is bad since it's abused by web developers (libraries use it and if the developer forgets to type var before the variable, it's added to window => someone defines |presentation| variable and disabling our API essentially). |
Since the
The concern is (as @avayvod noted) that if there are web sites out there that are using a global variable named If we'd move to global, we should rename |
I can confirm we should stick with |navigator|. |
[@mfoltzgoogle's comment moved into its own issue: https://github.com//issues/79] |
Pull request #77 addressed the interface changes and definitions for this behavior. I would like to see an algorithm in section 6.4, "Interface NavigatorPresentation" to define the steps the UA should take to initiate a presentation in this way. I'll open a new issue for that, should be a minor change. |
ACTION: @schien to write a proposed idl change for that [recorded in http://www.w3.org/2015/05/20-webscreens-minutes.html#action06] |
PROPOSED RESOLUTION: review the two proposals and evaluate them against the use cases and requirements considering developers and implementors view points See relevant discussion during Berlin F2F: http://www.w3.org/2015/05/20-webscreens-minutes.html#item07 |
Hey there, we've come up with the following after discussing with Mozilla and getting @schien's approval: partial interface NavigatorPresentation {
attribute PresentationRequest defaultRequest = null;
};
[Constructor(DOMString presentationUrl)]
interface PresentationRequest {
readonly attribute DOMString url;
attribute EventHandler onpresentationstart;
Promise<PresentationSession> joinPresentation(DOMString presentationId);
Promise<PresentationSession> startPresentation();
Promise<Availability> getAvailability();
}; So the sender methods have moved to a separate interface, The shortest way to start a presentation would be: presBtn.onclick = function(e) {
new PresentationRequest(“example.com/presentation.html”)
.startPresentation().then(handleSession);
} The full example would look like: var presUrl = “www.example.com/presentation.html”;
var mySession;
// One PresentationRequest(presentationUrl) is constructed per each
// PresentationSession the page wants to receive.
var request = PresentationRequest(presUrl);
// event will be fired if the presentation defined by this request is
// started somehow, by the browser or as a result of startPresentation().
// that way if the web author doesn’t care which way the session was
// started, it can be handled in one place.
request.onpresentationstart = function(evt) {
handleSession(evt.session);
};
// the browser will use this request to start browser initiated presentation
// (unless user disables it)
navigator.presentation.defaultrequest = request;
// try to join an existing presentation known to the user agent
// and the page via local storage
request.joinPresentation(localStorage["presId"])
.catch(closeSession);
request.getAvailability().then(function(availability) {
...
}).catch (function() {
...
});
document.getElementById("presBtn").onclick = function(e) {
request.startPresentation()
.catch(closeSession);
};
var handleSession = function(session) {
// in case we handle start/joinPresentation promise resolution:
// if (session === mySession) return;
// close existing session, if any
closeSession();
if (!session)
return;
// save presId in localStorage
localStorage && (localStorage["presId"] = session.presentationId);
// monitor channel's state
session.onstatechange = function () {
if (channel.state == "disconnected")
closeChannel();
};
// register message handler
session.onmessage = function(evt) {
console.log("receive message", evt.data);
};
// send message to presentation page
session.send("say hello");
mySession = session;
};
var closeSession = function() {
// close old session if exists
mySession && mySession.close() && mySession = null;
// remove old presId from localStorage if exists
localStorage && delete localStorage["presId"];
}; |
I also wanted to summarize the use cases and requirements and thoughts that led to the proposal above. Use cases
Requirements
Implications
|
I'd like to create a PR to change the spec based on the proposal and feedback from the group if there's any. |
Hi @avayvod, That proposal looks good to me. I have a couple of questions:
|
Hi @tidoust Thanks for the feedback.
Tab mirroring by my definition is showing the tab exactly as it is on the second screen modulo screen characteristics (e.g. color and physical resolution) and therefore the tab shouldn't know it's being mirrored. There's no information for the tab to provide to the user agent and nothing to control except for stopping the mirroring. So this could already be implemented by the user agent without any API. Do you think there's a use case for the tab to initiate mirroring rather than a presentation? |
Hi @avayvod
The communication channel would not mean anything in that case, indeed.
Hmm. I think my reaction was more triggered by the lack of symmetry in your proposal than by a specific use case: when the user presses the "present" button in the UA chrome, it will mirror the tab by default, or present a URL, whereas when the user presses a "present" button in the page, it can only present a URL. While preparing the charter of the group, I remember a few exchanges with people who were surprised that content mirroring was not in scope. It seems that many people think about content mirroring first when they think about projecting content onto a second screen (and are also sure that it is way easier to achieve than presenting different content but that's another story). That is all very subjective and does not really create a use case that would require that feature to be exposed at the API level (well, and it's out of scope for the group as just alluded to). |
This was solved with defaultRequest. Closing. |
Some user agents may wish to allow the user to initiate presentation from the browser instead of by triggering it via an action on the page. This is analogous to choosing "Print" from the browser menu instead of calling window.print().
In this scenario, the page should be able to designate a default presentation URL that will be shown when the user initiates presentation via the browser. This issue tracks the work to define the specification and the user-agent behavior around this URL.
The text was updated successfully, but these errors were encountered: