Re: getUserMedia API: How to use the LocalMediaStream object ?

Paste from the discuss-webrtc mailing list:

On 3/4/2012 12:58 PM, Ludo wrote:
> I am trying to use the getUserMedia API, but i get a problem at the 
> moment to insert the stream object into the balise video.
>
> Here us the main part:
> <video autoplay id="test"></video>
>
>   navigator.getUserMedia('video', function(localMediaStream)
>   {
>     $('#test').attr('src', window.URL.createObjectURL(localMediaStream));
>    });
>
> I use opera Labs Camera whose support the API, but i get this error:
> "Uncaught exception: TypeError: Cannot convert 'window.URL' to object".
>
> I also tried without this method:
> <video autoplay id="test"></video>
>
>   navigator.getUserMedia('video', function(localMediaStream)
>   {
>     $('#test').attr('src', localMediaStream);
>    });
>
> The stream object is into the balise video but nothing happens...


I'm not sure why it doesn't work in Opera, but I will note that   
media_element.src = MediaStream is the API we at Mozilla would prefer to 
see adopted as a standard.  I'll let others here make the real argument 
(roc in particular is on vacation, but I know this is his preference), 
but I'll say that it's a much more obvious usage to the application 
programmer (and the above is evidence to that for me), and there may be 
some other advantages as well - perhaps easier tracking of possible 
consumers of the output of a MediaStream object, while createObjectURL() 
produces a string and thus you can't really know when it might be used.

-- 
Randell Jesup
randell-ietf@jesup.org

Received on Monday, 5 March 2012 05:36:11 UTC