Merge pull request #3447 from jp-bennett/master

Adds support for Janus 1.x
This commit is contained in:
Isaac Connor 2022-02-28 20:49:56 -05:00 committed by GitHub
commit 5b9ca3f164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 1 deletions

View File

@ -561,9 +561,28 @@ async function attachVideo(id) {
} }
}, //onmessage function }, //onmessage function
onremotestream: function(ourstream) { onremotestream: function(ourstream) {
Janus.debug(" ::: Got a remote track :::"); Janus.debug(" ::: Got a remote stream :::");
Janus.debug(ourstream); Janus.debug(ourstream);
Janus.attachMediaStream(document.getElementById("liveStream" + id), ourstream); Janus.attachMediaStream(document.getElementById("liveStream" + id), ourstream);
},
onremotetrack: function(track, mid, on) {
Janus.debug(" ::: Got a remote track :::");
Janus.debug(track);
if (track.kind ==="audio") {
stream = new MediaStream();
stream.addTrack(track.clone());
if (document.getElementById("liveAudio" + id) == null) {
audioElement = document.createElement('audio');
audioElement.setAttribute("id", "liveAudio" + id);
audioElement.controls = true;
document.getElementById("imageFeed" + id).append(audioElement);
}
Janus.attachMediaStream(document.getElementById("liveAudio" + id), stream);
} else {
stream = new MediaStream();
stream.addTrack(track.clone());
Janus.attachMediaStream(document.getElementById("liveStream" + id), stream);
}
} }
}); // janus.attach }); // janus.attach
} //function attachVideo } //function attachVideo