Adds support for Janus 1.x

This commit is contained in:
Jonathan Bennett 2022-02-28 17:54:54 -06:00
parent 1749afc8e2
commit c28c043773
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