- From: Chris Needham via GitHub <sysbot+gh@w3.org>
- Date: Fri, 07 Oct 2016 12:57:49 +0000
- To: public-tvcontrol@w3.org
At the TPAC F2F meeting we agreed to make the API more source-centric. See the discussion [here](https://www.w3.org/2016/09/20-tvapi-minutes.html#item05). A problem with the existing API we discussed is that the relationship between tuners, sources and stream decoding resources is unclear, and that we should aim to simplify the API for application developers. We sketched a possible source-centric API, copied here from the minutes: ```javascript interface TVManager : EventTarget { Promise<sequence<TVSource>> getSources(); }; interface TVSource : EventTarget { Promise<TVTuner> tuneToChannel(TVChannel? channel); Promise<sequence<TVChannel>> getChannels(); int getNumberOfTuners(); }; interface TVTuner : EventTarget { attribute TVMediaSTream stream; Promise<> stop(); Promise<> setChannel(TVChannel channel); }; // Usage example TVManager.getSources().then(sources => { let source = sources[0]; source.getChannels().then(channels => { let channel = channels[0]; // This would tune to the "current" channel source.tuneToChannel().then(tuner1 => { video.srcObject = tuner.stream; }); // This would tune in to a specific channel source.tuneToChannel(channel).then(tuner2 => { video.srcObject = tuner.stream; }) .catch(err => { console.log('Oh no! No way to get a tuner'); tuner1.stop(); }); }); }); ``` There may be a need for applications to be able to select a particular tuner based on capabilities: > This doesn't work properly, because tuners are not interchangeable. A tuner may support HD, while another one may only support SD for instance. > But then, there may be a capability issue, if one stream is used for picture in picture, using SD, and the main stream is used for HD. If the HD tuner is locked for PiP, there is a problem. > Another solution could be to expose a getTuners method on TVSource: ```javascript interface TVSource : EventTarget { Promise<sequence<TVTuner>> getTuners(); Promise<sequence<TVChannel>> getChannels(); int getNumberOfTuners(); }; ``` > The takeaway from the discussion is that the group agrees to move to a source-centric approach for the API. The issue as to whether we expose the list of tuners or dynamically map channels to tuners remains an open issue at this stage. Further comments on this API suggestion are welcome (and encouraged!) -- GitHub Notification of comment by chrisn Please view or discuss this issue at https://github.com/w3c/tvcontrol-api/issues/4#issuecomment-252245254 using your GitHub account
Received on Friday, 7 October 2016 12:57:56 UTC