Re: Has MediaStream the stop() method?

On 31/12/13 11:27, Iñaki Baz Castillo wrote:
> 2013/12/31 Stefan Håkansson LK <stefan.lk.hakansson@ericsson.com>:
>> I think the implementation is not in line with the latest spec. There
>> used to be a LocalMediaStream (which is what you got from getUserMedia).
>> The LocalMediaStream had a stop() method to allow the app to revoke the
>> access to microphone and camera (which is got via the getUserMedia call).
>
> Thanks for the clarification.
>
>
>> But a lot of functionality has move from the MediaStream level down to
>> the MediaStreamTrack level. There is now only one type of MediaStream
>> (i.e. no LocalMediaStream) and it has no stop method. Instead the
>> MediaStreamTrack has a stop method, and in the latest version of the
>> draft it is specced in the way that the source (microphone, camera) is
>> stopped when all MediaStreamTracks that use the source have been stopped.
>
> Does I mean that I need to iterate over all the tracks within a
> MediaStream and call stop() on all of them just to revoke cam and mic
> permissions?

Yes, as far as I know that is what you need to do. And if you have 
cloned tracks (so there are several using the same source) you'd have to 
call stop on all of them.

> What is wrong with a MediaStream.stop() method that calls
> stop on every track?

I think it is mostly about clearness. If the same track is part of more 
than one MediaStream, and you call stop on one of them - should the 
track stop in the other one(s) or not? Another reason is that if stop is 
on MediaStream level only there is no way to return the right to use 
e.g. the camera only but retain the right to use the microphone. Dealing 
with stop on MediaStreamTrack level is more straightforward.

I think the design has been iterated many times (last time was during 
the f2f meeting at TPAC), and most people are happy as it is. It is not 
that hard to loop over the tracks in a MediaStream!

I think that if we should add anything, then it would be a stop/return 
on the source level - sort of allowing the app to return the right to 
use a source in a more direct way than having to stop all tracks the 
source serves. But so far there has not been a strong desire for this 
feature.

>
>
>> I can't spot the use of stop() in example 2 of
>> http://dev.w3.org/2011/webrtc/editor/getusermedia.html.
>
> True, it appears just in http://www.w3.org/TR/mediacapture-streams/.
>
>
> Thanks a lot.
>
>


Received on Wednesday, 1 January 2014 06:47:31 UTC