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

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 UTC