Re: Thoughts on the TVTuner class in the source-centric API

Hi Steve,

just for my understanding, please correct me if I am wrong:

in the revised proposal
- the device has a set of sources,
- every source stands for one of DVB-S, DVB-C, DAB, ISDB-T, etc.,
- a source can support concurrent tuning to multiple channels depending 
on available resources
- additionalSessions are dynamic, e.g. if there are two sources and one 
is used to tune a channel, the available additionalSessions for the 
second source may also change.


* there was a comment that the API is used also for Recordings/PVR, it 
might make sense to differentiate between available concurrent streams 
and concurrent media renderers.

* DVB-? and DVB-?2 are currently different source types and a source can 
have only one type. I wonder if it would make sense to allow that a 
source has multiple types like DVB-S and DVB-S2, which are both used in 
a single broadcast network.

Kind regards,
Michael


Am 05.12.2016 um 16:04 schrieb Steven Morris:
> All,
>
>
>
> This is an attempt to summarise a couple of discussions that I've had
> offline with various people, prompted by the edits I've been making to
> the API.  The thoughts of the group are very welcome.
>
>
>
> The question that prompted this is “ in our modified API, what does the
> call to TVSource.tuneToChannel() return?”  While a TVTuner appears to
> make sense at first, there are several problems with that:
>
> 1)            You still then have to get the TVMediaStream before you
> can connect it to a <video> element and start playing the channel
>
> 2)            There may not be a one-to-one mapping between a TVTuner
> instance and a channel being played: a single hardware tuner may be able
> to receive more than one channel at the same time.
>
>
>
> I thought that returning a TVMediaStream would solve this, but that then
> raised other questions:
>
> 1)            How do you find the set of channels currently being played
> by the source?  We've already agreed that one source may be used to play
> more than one channel at a time, but that's not reflected in the API.
>
> 2)  How can an application stop presenting a channel and free the
> resources being used for it?  While MediaStreamTrack.stop() could be
> used to do this, that's pretty counter-intuitive.  We could say that
> when the TVMediaStream is garbage collected then all the resources are
> freed, but that's not very predictable.
>
> 3)            When an app starts, if a channel is already being
> presented, how can the app discover that channel?  The use case here is
> an STB where a broadcast-related app is started and wants to resize the
> video that is currently being displayed (i.e. to fit it in with the
> app's UI).
>
> 4)            What object receives notifications for channel change
> events or errors, parental control events and so on?
>
>
>
>
>
> My thinking at the moment is that the name of the TVTuner is misleading:
> while it implies that the class represents a physical tuner, that isn't
> really the case given its current API.  One option would be for this
> object to represent a "media session", where tuning to a channel creates
> a new media session which an application can register listeners on and
> can get a TVMediaStream from.  This would give interfaces like this:
>
>
>
>
>
> interface TVSource : EventTarget {
>
>     Promise<sequence<TVChannel>> getChannels();
>
>     Promise<sequence<TVTuner>>   getSessions();
>
>     Promise<TVTuner>             tuneToChannel(TVChannel channel,
> optional TVTuner tuner);
>
>     Promise<TVTuner>             tuneTo(DOMString tuningParams, optional
> TVTuner tuner);
>
>     Promise<void>                startScanning(optional
> TVStartScanningOptions options);
>
>     Promise<void>                stopScanning();
>
>     Promise<unsigned short>      getAdditionalSessions(DOMString
> qualityLevel);
>
>     readonly attribute TVSourceType type;
>
>     readonly attribute boolean      isScanning;
>
>              attribute EventHandler onscanningstatechanged;
>
> };
>
>
>
>
>
> interface TVTuner : EventTarget {
>
>     Promise<TVSource> getSource();
>
>     Promise<void>     stop();
>
>     readonly attribute DOMString      id;
>
>     readonly attribute TVChannel?     currentChannel;
>
>     readonly attribute TVMediaStream? stream;
>
>     readonly attribute double         signalStrength;
>
>     readonly attribute boolean        isRecordable;
>
>              attribute EventHandler oncurrentchannelchanged;
>
>              attribute EventHandler oneitbroadcasted;
>
>              attribute EventHandler onemergencyalerted;
>
> };
>
>
>
> Note that some event handlers have moved from TVSource to TVTuner in
> this case.
>
>
>
> The TVTuner object can then be re-used by an app that wants to change
> channel but use the same resources.  The stop() method stops presenting
> the current channel and frees any resources used.  The
> getAdditionalSessions() method lets an app determine how many more
> channels (of the specified quality level) can be played simultaneously
> from that source.
>
>
>
> This keeps the semantics of a TVMediaStream very simple, and it's mostly
> used for connecting to a media element to present a channel.
>
>
>
>
>
>
>
> Another alternative is to fully take the approach described by
> getUserMedia(), which does support most of what we want to do, but
> requires using the MediaStreamTrack interface for most of the
> operations.  We would either have to extend MediaDeviceInfo to introduce
> a getChannels() method and other TV-specific APIs and events, or define
> our exisitng APIs in a way that is compatible with this approach.
>
>
>
> var source = null;
>
>
>
> navigator.mediaDevices.enumerateDevices()
>
>    .then(function (devicesInfo) {
>
>      source = devicesInfo.find(function (deviceInfo) {
>
>        // Or use "getCapabilities" to detect support for the "tvchannel"
>
>        // constraint if kind cannot be extended?
>
>        return deviceInfo.kind === 'tvsource';
>
>      });
>
>      return source.getChannels();
>
>    })
>
>    .then(function (channels) {})
>
>      var channel = channels[0];
>
>      secondChannel = channels[1];
>
>      navigator.mediaDevices.getUserMedia({
>
>        video: {
>
>          deviceId: source.deviceId,
>
>          tvchannel: channel
>
>        }
>
>      })
>
>    })
>
>    .then(function (stream) {
>
>      tvStream = stream;
>
>
>
>      // Render the stream
>
>      document.getElementById('video').srcObject = tvStream;
>
>
>
>      // Switch to another channel
>
>      return tvStream.getVideoTracks()[0].applyConstraints({ tvchannel:
>
> secondChannel });
>
>    })
>
>    .then(function () {
>
>      // Stop stream
>
>      tvStream.getVideoTracks()[0].stop();
>
>    });
>
>
>
>
>
>
>
> Thoughts and suggestions are welcome.
>
>
>
> Steve.
>

-- 
Michael Probst
Platforms for Broadcast Services
Tel.: +49(0)89/323 99-338
mail: mprobst@irt.de

Institut fuer Rundfunktechnik GmbH
Research and Development Institute of ARD, ZDF, DRadio, ORF and SRG/SSR
Floriansmuehlstraße 60, 80939 Muenchen, Germany
registration court Munich Commercial, Register No. B 5191
Managing Director: Dr. Klaus Illgner-Fehns

Received on Tuesday, 6 December 2016 08:34:11 UTC