amazon-chime-sdk-js
amazon-chime-sdk-js copied to clipboard
Firefox video sharing results in losing audio-track for attendee that shares
NOTE: This issue is not necessarily about reporting a bug, but rather asking about a workaround.
Some time ago I reported the bug about sharing a video file that is black for recipients when send in Chrome or Edge: https://github.com/aws/amazon-chime-sdk-js/issues/1031
Now, I stumbled upon the problem that in Firefox when sharing a video-file (from an html <video> stream) the audio of that video is missing for the person sharing the video. So basically what we do in our system is:
- We create a
<video>tag and set thesrcof it to the URL of the video - We capture the stream of the video
- We send the stream to Chime using
startContentShare(mediaStream)
This works fine for the video-track itself, and the audio-track is being received by all other attendees fine as well, but for the person sharing the video the audio is completely gone. After some research I found out that this is caused by a bug in Firefox when using the mozCaptureStream, as defined in https://bugzilla-dev.allizom.org/show_bug.cgi?id=1178751 and https://bugzilla-dev.allizom.org/show_bug.cgi?id=1573031.
Now, at this point I don't know how to work around this bug and make the audio work again in Firefox. Also, because Chrome and Edge are not working properly either, the need for a workaround or fix for this problem is higher, which is why I am asking you guys for help. Currently my JS looks as followed (sidenote, it's in Vue):
async streamSelectedVideo(videoUrl) {
// ...
// The "videoShareElement" is the <video>
videoShareElement.src = videoUrl;
// ...
await videoShareElement.play();
let mediaStream = null;
if (typeof videoShareElement.captureStream === 'function') {
mediaStream = videoShareElement.captureStream();
} else if (typeof videoShareElement.mozCaptureStream === 'function') {
mediaStream = videoShareElement.mozCaptureStream(); // This removes the audio-track from the <video>
}
// ...
await this.meetingSession.audioVideo.startContentShare(mediaStream);
},
In the Firefox bug reports, 1 person described the following workaround but I wasn't able to get that to work so I am kinda stuck there as well:
Also, if you are looking for a workaround, you can hook up the element to the WebAudio destination node through a MediaElementAudioSourceNode. Volume and such carries through from the element that way, though there's a bug that makes it ~1s delayed.
Any help would be very very welcome! Whether it is a fix, workaround, or other ideas, everything is welcome at this point. :)
Platform
- OS: MacOS
- Browser: Firefox
- Browser Version: 89.0.2
- Amazon Chime SDK: 2.13.0