Bug 192849 - getUserMedia() kills the existing streamtrack and returns a black screen.
Summary: getUserMedia() kills the existing streamtrack and returns a black screen.
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 11
Hardware: iPhone / iPad iOS 11
: P2 Major
Assignee: Nobody
Depends on:
Reported: 2018-12-19 05:48 PST by Ramya D
Modified: 2018-12-20 21:26 PST (History)
1 user (show)

See Also:

Please look into it.. (3.41 KB, text/html)
2018-12-19 05:48 PST, Ramya D
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ramya D 2018-12-19 05:48:13 PST
Created attachment 357668 [details]
Please look into it..

Verified by the reference code below:

On iOS, a second call to getUserMedia() kills the display of a video stream obtained by an earlier call to getUserMedia(). The original stream displays fine until the subsequent getUserMedia() call, then goes black.

Note that this doesn't happen on Desktop Safari, only on iOS Safari in my tests.
Comment 1 youenn fablet 2018-12-19 08:27:19 PST
I believe this is a known limitation for now.
This issue is tracked there: https://bugs.webkit.org/show_bug.cgi?id=179363
Let's continue the discussion there.

*** This bug has been marked as a duplicate of bug 179363 ***
Comment 2 Ramya D 2018-12-19 21:41:25 PST
Ok, But still that issue is not assigned. Is there any solution for that @youennfablet
Comment 3 youenn fablet 2018-12-19 22:00:24 PST
(In reply to Ramya D from comment #2)
> Ok, But still that issue is not assigned. Is there any solution for that
> @youennfablet

It depends on your use case.
Can you give details about your usecase?
Comment 4 Ramya D 2018-12-19 22:06:54 PST
I'm using getUserMedia,

1) Sharing a media stream from one browser to another browser. It works
2) Again Sharing another stream on top of the existing stream but it kills the existing media stream but it works fine in all browsers but not in safari. It returns a black screen

Comment 5 Ramya D 2018-12-19 22:20:15 PST
All I want to do is, I want to pass multiple media stream. It works fine in all browsers but not in safari. @youennfablet
Comment 6 youenn fablet 2018-12-19 22:23:47 PST
What does it mean to pass multiple streams?
Do you want to send the same stream with different resolutions on a single peer connection? on different peer connection?

WebKit support some form of simulcast which would allow you the latter.
The former is not yet available unfortunately.

There is no support for capturing both front and back cameras at the same time.
Comment 7 Ramya D 2018-12-19 22:35:23 PST
I shared my video stream on one layer and again I made another connection to share my annotation/drawing like AR on top of the video stream. 

But it fails with safari. I have attached the link also You can Experiment here.




or else any idea will be appreciated to pass two streams in a safari browser or else without getUserMedia how can I take my stream to safari browser.
Comment 8 youenn fablet 2018-12-20 12:51:28 PST
Can you use track/stream cloning?
Comment 9 Ramya D 2018-12-20 21:26:01 PST
I have received the stream using call.answer(window.localStream) without getUserMedia. Now I'm facing another problem of alpha transparency in canvas

Alpha transparency works in all browsers but not in safari and this how I'm removing the black screen and trying to make it as transparency.This one works in all browsers but not in safari.

function draw(img) {
	var buffer = document.createElement('canvas');
  var bufferctx = buffer.getContext('2d');
  bufferctx.drawImage(img, 0, 0);
  var imageData = bufferctx.getImageData(0,0,buffer.width,  buffer.height);
  var data = imageData.data;
  var removeBlack = function() {
    for (var i = 0; i < data.length; i += 4) {
      if(data[i]+ data[i + 1] + data[i + 2] < 10){ 
      	data[i + 3] = 0; // alpha
    ctx.putImageData(imageData, 0, 0);

Help will be greatly appreciated. @youennfablet