- From: Mark Foltz via GitHub <sysbot+gh@w3.org>
- Date: Tue, 08 Sep 2015 23:04:35 +0000
- To: public-secondscreen@w3.org
@sicking Yes, in point 2, I intended `session.terminate()` - good
catch.
Integrating the above, here is the API I would propose for session
lifecycle.
```
enum PresentationSessionState {
"connected",
"disconnected",
"closed",
"terminated"
};
partial interface PresentationSession {
readonly attribute PresentationSessionState state;
// Both sides transition to "closed." Presenting context remains
running.
void close();
// All connected sessions transition to "terminated." Presenting
context is closed.
void terminate();
// Fired on change to .state
attribute EventHandler onstatechange;
};
partial interface PresentationReceiver : EventTarget {
// Fired when all sessions have transitioned to a terminal state.
Default behavior
// is to close the presenting context.
attribute EventHandler onsessionsclosed;
};
```
The following diagram summarizes the state transitions for
`PresentationSession.state`. Both `closed` and `terminated` are
terminal states.

I've retained `disconnected` to signal a break in the connection that
was not initiated by either side (i.e. network disconnection); whether
or not that is terminal may depend on #149. If we decide that it's a
terminal state as well, we can just use `closed` for it.
Finally, the proposal above includes an event, `onsessionsclosed` to
notify the presenting context that all sessions have transitioned to a
terminal state, defaulting to close the presentation. It's likely
the common scenario is to have one site running in one user agent
controlling the presentation, and the presentation exits when the user
browses away from the site. In this proposal, the author of the
presentation does nothing to cause it to exit when the user browses
away.
However, there are at least two cases we need to make sure are handled
properly to *not* close the presentation:
1. The controller browses to another page in the same site that
automatically reconnects to the presentation
2. The user has a network glitch that breaks the connection between
UAs temporarily.
If nothing above sounds objectionable, I can author a PR based on this
proposal.
--
GitHub Notif of comment by mfoltzgoogle
See
https://github.com/w3c/presentation-api/issues/35#issuecomment-138727080
Received on Tuesday, 8 September 2015 23:04:37 UTC