fix screen sharing: audio now works when peers connect with another peer that is screen sharing
This commit is contained in:
parent
4090bbc0c4
commit
c79aa54842
|
@ -73,6 +73,7 @@ var VideoChat = {
|
||||||
onMediaStream: function (stream) {
|
onMediaStream: function (stream) {
|
||||||
logIt("onMediaStream");
|
logIt("onMediaStream");
|
||||||
VideoChat.localStream = stream;
|
VideoChat.localStream = stream;
|
||||||
|
VideoChat.localAudio = stream.getAudioTracks()[0];
|
||||||
// Add the stream as video's srcObject.
|
// Add the stream as video's srcObject.
|
||||||
// Now that we have webcam video sorted, prompt user to share URL
|
// Now that we have webcam video sorted, prompt user to share URL
|
||||||
Snackbar.show({
|
Snackbar.show({
|
||||||
|
@ -610,6 +611,8 @@ function swap() {
|
||||||
swapIcon.classList.remove("fa-desktop");
|
swapIcon.classList.remove("fa-desktop");
|
||||||
swapIcon.classList.add("fa-camera");
|
swapIcon.classList.add("fa-camera");
|
||||||
swapText.innerText = "Share Webcam";
|
swapText.innerText = "Share Webcam";
|
||||||
|
stream.addTrack(VideoChat.localAudio);
|
||||||
|
console.log(stream);
|
||||||
switchStreamHelper(stream);
|
switchStreamHelper(stream);
|
||||||
})
|
})
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
|
@ -620,7 +623,7 @@ function swap() {
|
||||||
// If mode is screenshare then switch to webcam
|
// If mode is screenshare then switch to webcam
|
||||||
} else {
|
} else {
|
||||||
// Stop the screen share track
|
// Stop the screen share track
|
||||||
VideoChat.localVideo.srcObject.getTracks().forEach((track) => track.stop());
|
VideoChat.localVideo.srcObject.getVideoTracks().forEach((track) => track.stop());
|
||||||
// Get webcam input
|
// Get webcam input
|
||||||
navigator.mediaDevices
|
navigator.mediaDevices
|
||||||
.getUserMedia({
|
.getUserMedia({
|
||||||
|
|
Loading…
Reference in New Issue