Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture from Merger canvas appears blank when using getDisplayMedia #59

Open
nikz opened this issue Sep 15, 2020 · 9 comments
Open

Capture from Merger canvas appears blank when using getDisplayMedia #59

nikz opened this issue Sep 15, 2020 · 9 comments

Comments

@nikz
Copy link

nikz commented Sep 15, 2020

Hi,

First off, thanks for the package!

I'm encountering a somewhat odd bug. I'm using video-stream-merger to let my customers narrate over top of a screen share. I was having problems where the audio and video would get out of sync, but this fixed it 😃

However, I am encountering an odd potential bug. If you use getDisplayMedia and the user selects a non-frontmost Chrome tab, the output from video-stream-merger appears to be a black square (even though the MediaStream itself has data).

It doesn't look like an issue with the captureStream because I can use a custom draw() function to draw a red circle (or anything) and that sticks around.

Here's a jsfiddle with a minimal reproduction of the bug.

I have been trying everything here (order of creating the merger etc. etc) with no luck. Any help at this point is much appreciated! Hopefully this is a case of me doing something silly. Happy to work on a patch/fix too if anyone can point me in the right direction.

Cheers,

Nik

@t-mullen
Copy link
Owner

t-mullen commented Sep 15, 2020

I can't reproduce. getDisplayMedia with a background tab works fine for me. It's possible it's OS specific - I've tried OSX 10.15.6 and Ubuntu 18. Are you using Windows (if so, which verison)?

That JSFiddle errors for me with Uncaught InvalidStateError: Failed to execute 'requestData' on 'MediaRecorder': The MediaRecorder's state is 'inactive'.". Is the use of MediaRecorder required to reproduce this?

Example of recording background tab, output is fine:
Screen Shot 2020-09-15 at 6 43 20 PM

@nikz
Copy link
Author

nikz commented Sep 15, 2020

@t-mullen thanks for taking a look!

Try this jsfiddle - I used the wrong link!

I think it may well be a MediaRecorder issue, but without using that I'm not sure how to see the stream when the shared tab is foregrounded?

@t-mullen
Copy link
Owner

Super weird, you don't even need to add the DisplayMedia stream to the merger cause this. It looks like captureStream goes black if you are capturing another Chrome tab and the receiving tab is unfocused.

This looks like a browser bug, but I'll see if I can get it working anyways.

@nikz
Copy link
Author

nikz commented Sep 16, 2020

Odd! Is it worth reporting to the Chrome team?

@nikz
Copy link
Author

nikz commented Jun 11, 2021

@t-mullen Sorry to be a pain - did you manage to get anywhere here, or can you shed any light on where I should go to next? Much appreciated!

@t-mullen
Copy link
Owner

No, sorry - I wasn't able to find a workaround.

Yes, this should be reported to the Chromium team. Be sure to include your jsfiddle for reproduction.

@hthetiot
Copy link
Contributor

I do not reproduce the issue using this sample:

@hthetiot
Copy link
Contributor

The issue is:

Uncaught DOMException: Failed to execute 'createMediaStreamSource' on 'AudioContext': MediaStream has no audio track

Will fix in #71 and add sample.

@hthetiot
Copy link
Contributor

hthetiot commented Jun 29, 2021

Fixed in #71 via 92f0251 added demo also for debug see https://hthetiot.github.io/video-stream-merger/demo/p2p-screen.html

Screenshot 2021-06-29 at 14 23 26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants