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

Re: [presentation-api] PresentationReceiver: rename getConnection() and getConnections()

From: Jonas Sicking via GitHub <sysbot+gh@w3.org>
Date: Tue, 13 Oct 2015 20:35:43 +0000
To: public-secondscreen@w3.org
Message-ID: <issue_comment.created-147844530-1444768542-sysbot+gh@w3.org>
> I meant a case when the user launches a presentation (e.g. a video) 
on the screen and then the controlling device loses Wi-Fi or runs out 
of power - the presentation should continue playing or maybe pause and
 wait for the user to connect from the rebooted or even another 
device. In this case the first PresentationConnection would definitely
 go to the terminated state and the page would have to wait for 
another one. So using only one PresentationConnection at a time 
doesn't mean using the one same connection during the lifetime of the 
presentation.

This is a good point.

Though for the case when the connection quickly transitions to 
`terminated` state, I think we could easily make a 
`waitForNextConnection()` function stop returning that connection and 
instead wait for another one.

But I agree with your conclusion that even in the "single controller" 
use case, we'll need to worry about having the API juggle multiple 
connections.

So I think what we're looking for is an API which is focused on 
letting the page enumerate the set of controllers and be notified when
 this changes. Here's what I propose:

```webidl
interface PresentationReceiver {
  readonly attribute Promise<PresentationConnectionList> connections;
};

interface PresentationConnectionList : EventTarget {
  readonly attribute sequence<PresentationConnection> connections;
  attribute EventHandler onconnectionavailable;
};
```

This is essentially what @mounirlamouri is suggesting. It only adds 
one async step which would allow the implementation to easily wait 
with returning the list for the first time until it has populated it 
with the initial connection.

Or we could make it even simpler and merge `PresentationReceiver` and 
`Presentation` since the former only contains a single property:

```webidl
partial interface Presentation {
  readonly attribute Promise<PresentationConnectionList> connections;
};

interface PresentationConnectionList : EventTarget {
  readonly attribute sequence<PresentationConnection> connections;
  attribute EventHandler onconnectionavailable;
};
```

-- 
GitHub Notif of comment by sicking
See 
https://github.com/w3c/presentation-api/issues/201#issuecomment-147844530
Received on Tuesday, 13 October 2015 20:35:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 13 October 2015 20:35:46 UTC