Re: How to direct audio/vido streams from HTML5 media element to PeerConnection?

On Sat, Feb 2, 2013 at 11:54 PM, Harald Alvestrand <harald@alvestrand.no>wrote:

> I dislike attributes for this. They carry the implicit promise that you
> will get the same thing every time you query it; the captureStream() API
> doesn't carry that implication - captureStream() called twice would seem to
> return two streams.


I agree, which is why I designed captureStream() as a method.

Gecko currently supports mozCaptureStream() and
mozCaptureStreamUntilEnded() methods on media elements. The only difference
is that in the latter case, if and when the media element reaches the
"ended" state, the MediaStream finishes and never plays anything again
(even if the element is seeked and replayed). In the former case, the
MediaStream never finishes, so you can even load a new resource and start
playing it and effectively concatenate multiple resources together that way.

Both of these methods have the side effect of silencing audio output from
the element (using internal state --- media element volume and muting APIs
are not observably affected).

These methods seem to work pretty well. I suggest we get them added to
HTML. They logically belong on the media element, and we shouldn't do
something illogical just to make specification easier.

One tricky thing is that these methods introduce MediaStreams that can
pause temporarily and then resume playback (e.g. when you start loading a
new resource). We have direct support for that in Gecko so that, for
example, when we implement recording APIs we'll be able to avoid recording
those paused intervals. That may affect the design of other MediaStream
APIs.

Rob
-- 
Wrfhf pnyyrq gurz gbtrgure naq fnvq, “Lbh xabj gung gur ehyref bs gur
Tragvyrf ybeq vg bire gurz, naq gurve uvtu bssvpvnyf rkrepvfr nhgubevgl
bire gurz. Abg fb jvgu lbh. Vafgrnq, jubrire jnagf gb orpbzr terng nzbat
lbh zhfg or lbhe freinag, naq jubrire jnagf gb or svefg zhfg or lbhe fynir
— whfg nf gur Fba bs Zna qvq abg pbzr gb or freirq, ohg gb freir, naq gb
tvir uvf yvsr nf n enafbz sbe znal.” [Znggurj 20:25-28]

Received on Wednesday, 20 February 2013 01:57:09 UTC