W3C home > Mailing lists > Public > public-secondscreen@w3.org > September 2015

[presentation-api] Event the presentation receiver when the last session has disconnected

From: Mark Foltz via GitHub <sysbot+gh@w3.org>
Date: Tue, 15 Sep 2015 22:41:37 +0000
To: public-secondscreen@w3.org
Message-ID: <issues.opened-106662722-1442356896-sysbot+gh@w3.org>
mfoltzgoogle has just created a new issue for 
https://github.com/w3c/presentation-api:

== Event the presentation receiver when the last session has 
disconnected ==
This is forked from #35, to specifically request a feature whereby a 
`lastsessionclosed` event would be fired on `navigator.presentation` 
when the last session connected to the presentation was closed.  The 
default behavior for this event would be to close the presentation 
document (similar to `window.close()`).  The presentation could 
prevent this behavior by calling `.preventDefault()` on the event.

This proposal was outlined in 
https://github.com/w3c/presentation-api/issues/35#issuecomment-133223748.

The arguments for this feature:
- The default behavior of calling .close() when there is only one 
controller attached to the TV is unchanged. Calling .close() in that 
scenario will close the application.
- The default behavior when multiple parties are connected is that the
 application is closed when the last controller calls .close()
- The application on the TV gets to make the ultimate decision about 
when the application is closed. (Unless the user overrides by closing 
the application through other means of course.)
- The PresentationSession API continues to match WebSocket and 
RTCDataChannel, i.e. we still have just .send()/onmessage/.close() and
 with those functions behaving the same across all three interfaces.
- So I think that what we should optimize for here is developer 
ergonomics and reducing the risk of bugs.

The arguments against:
- Another common case is that the presentation should continue running
 when  the controller is disconnected, i.e. I begin playing a movie 
using my laptop and then close the laptop.
- We don't want accidental disconnections of controllers (i.e., 
network disruption) to stop a running presentation.
- In a multiplayer game, the presentation may want to continue running
 to allow new players to join.
- This is just syntactic sugar for listening to `onsessionconnect` and
 keeping track of the number of connected sessions, then calling 
`window.close()` when the count drops to zero.


See https://github.com/w3c/presentation-api/issues/194
Received on Tuesday, 15 September 2015 22:41:39 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 15 September 2015 22:41:39 UTC