Re: replaceTrack proposal

On 9/11/2014 4:56 PM, Jan-Ivar Bruaroey wrote:
> On 9/11/14 3:53 PM, Cullen Jennings (fluffy) wrote:
>> On Sep 9, 2014, at 11:13 AM, Stefan HÃ¥kansson LK 
>> <stefan.lk.hakansson@ericsson.com> wrote:
>>> I missed that part; and I was not aware that mobile devices can only
>>> open one camera at the time.
>> I'm not sure that is exactly right - it seems more that many mobile 
>> devices can only have hardware support for encoding a single stream 
>> of video at a time and is less an issue of capture than encoding.
>
> Well, I modified our replaceTrack test (attached) to do a direct gUM 
> swap on devices that support both cameras open at the same time, only 
> to discover that my samsung galaxy S4 doesn't actually allow that on 
> android (even though the built-in camera app has a mode for it).
>
> If people get it to work on other android devices, I'd love to know. 
> When it works you should see no black between videos when hitting the 
> [swap video] button.

Our Android/FxOS people who handle the camera code for FxOS (i.e. MikeH) 
tell me Android doesn't support it, though the API in theory might.

The trick we're using in Firefox for testing swaps isn't spec-compliant: 
we're using "fake: true" to generate fake audio and video streams, so we 
can build a fake stream and then set enabled = false (i.e. black), and 
use that to transition.

We could also use the not-current-spec (Martin needs to write it) 
video_element.mozCaptureStream/mozCaptureStreamUntilEnded with a data: 
source and then disable that.

The *right* way to do a black transition source would be 
canvas.captureStream (again - Martin needs to write the proposal). We 
plan to implement a prototype of this "soon".  This also allows things 
like "I muted" screens, etc:
(very pseudo-codey)

With an image something like: http://i.imgur.com/xcvrI5K.png

   on_user_mute:
      sender.track.enabled = false;
      sender.replaceTrack(canvas_mute_message_stream, success, failure);
      in success:
          canvas.generateFrame() or whatever to push out a frame, 
perhaps repeat at 10fps-ish for a second, then once a second, or 
continue to animate if the canvas is used to have something non-static.

  on_user_unmute:
      camera_track.enabled = true;
      sender.replaceTrack(camera_track, success, failure);

-- 
Randell Jesup -- rjesup a t mozilla d o t com

Received on Friday, 12 September 2014 15:44:22 UTC