W3C home > Mailing lists > Public > public-webrtc@w3.org > March 2012

Re: Blobs and MediaStreams (Re: getUserMedia API: How to use the LocalMediaStream object ?)

From: Robert O'Callahan <robert@ocallahan.org>
Date: Thu, 8 Mar 2012 00:04:47 +0000
Message-ID: <CAOp6jLYp74prKij_dFD7PbxxnEnGoBO+FkXdrOkAPvWh+Hvg_g@mail.gmail.com>
To: Rich Tibbett <richt@opera.com>
Cc: Adam Bergkvist <adam.bergkvist@ericsson.com>, Randell Jesup <randell-ietf@jesup.org>, "public-webrtc@w3.org" <public-webrtc@w3.org>, "Robert O'Callahan" <roc@ocallahan.org>, Chris Pearce <cpearce@mozilla.com>
On Wed, Mar 7, 2012 at 4:58 PM, Rich Tibbett <richt@opera.com> wrote:

> The following consequences were brought up in other recent discussions
> elsewhere:
>
> http://lists.w3.org/Archives/**Public/public-webapps/**
> 2011OctDec/1522.html<http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/1522.html>
>
> http://lists.w3.org/Archives/**Public/public-webapps/**
> 2011OctDec/1516.html<http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/1516.html>
>
> These problems are solvable and some good follow up emails follow the
> links highlighted above. I think this group or the MediaStream Processing
> API account for the concerns raised in these threads (particularly in the
> case of the latter since it already extends media elements to accept a type
> of 'any').


Those threads are about the difficulties of making *all* source URIs accept
direct Blob references, possibly while leaving the type of 'src' as
DOMString. What I proposed and implemented is rather different: only 'src'
for media elements is affected, I changed its type to 'any', and made it
accept MediaStreams as well as strings. There are no difficult lifetime
issues; in my case, a media element can keep its src MediaStream alive.

I think the only subtlety is that when you set 'src' to a MediaStream, the
element's 'src' content attribute can no longer reflect the DOM attribute,
so I just set it to the empty string while the 'src' DOM attribute is not a
string.

A number of folks from Opera have been arguing to keep this optimization
> since it seems relatively clean and straight-forward.
>

It's more than an optimization. Going through createObjectURL requires
manual resource management but direct assignment to 'src' does not.
Avoiding manual resource management is a big win.

Rob
-- 
“You have heard that it was said, ‘Love your neighbor and hate your enemy.’
But I tell you, love your enemies and pray for those who persecute you,
that you may be children of your Father in heaven. ... If you love those
who love you, what reward will you get? Are not even the tax collectors
doing that? And if you greet only your own people, what are you doing more
than others?" [Matthew 5:43-47]
Received on Thursday, 8 March 2012 00:06:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 8 March 2012 00:06:50 GMT