W3C home > Mailing lists > Public > public-webrtc@w3.org > January 2014

Re: Has MediaStream the stop() method?

From: Stefan Håkansson LK <stefan.lk.hakansson@ericsson.com>
Date: Wed, 1 Jan 2014 06:46:45 +0000
To: Iñaki Baz Castillo <ibc@aliax.net>
CC: "public-webrtc@w3.org" <public-webrtc@w3.org>
Message-ID: <1447FA0C20ED5147A1AA0EF02890A64B1C43211B@ESESSMB209.ericsson.se>
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

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:37 UTC