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

Don't use .clone() on tracks to render them in demos #3009

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions html/audiobridgetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ $(document).ready(function() {
$('#roomaudio').remove();
return;
}
remoteStream = new MediaStream();
remoteStream.addTrack(track.clone());
remoteStream = new MediaStream([track]);
$('#room').removeClass('hide').show();
if($('#roomaudio').length === 0) {
$('#mixedaudio').append('<audio class="rounded centered" id="roomaudio" width="100%" height="100%" autoplay/>');
Expand Down
6 changes: 2 additions & 4 deletions html/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand All @@ -230,8 +229,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videoright .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand Down
9 changes: 3 additions & 6 deletions html/devicetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#videoleft .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
$('#videoleft').append('<video class="rounded centered" id="myvideo' + trackId + '" width="100%" height="100%" autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -390,8 +389,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand All @@ -411,8 +409,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videoright .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand Down
9 changes: 3 additions & 6 deletions html/e2etest.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#videoleft .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
$('#videoleft').append('<video class="rounded centered" id="myvideo' + trackId + '" width="100%" height="100%" autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -266,8 +265,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand All @@ -287,8 +285,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videoright .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand Down
9 changes: 3 additions & 6 deletions html/echotest.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#videoleft .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
$('#videoleft').append('<video class="rounded centered" id="myvideo' + trackId + '" width="100%" height="100%" autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -321,8 +320,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand All @@ -342,8 +340,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videoright .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand Down
6 changes: 2 additions & 4 deletions html/multiopus.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand All @@ -267,8 +266,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videoright .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
if($('#peervideo'+mid).length === 0)
Expand Down
9 changes: 3 additions & 6 deletions html/mvideoroomtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#videolocal .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
Janus.log(stream.getTracks());
Expand Down Expand Up @@ -769,8 +768,7 @@ function subscribeTo(sources) {
return;
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
$('#videoremote' + slot).append('<audio class="hide" id="remotevideo' + slot + '-' + mid + '" autoplay playsinline/>');
Expand All @@ -789,8 +787,7 @@ function subscribeTo(sources) {
// New video track: create a stream out of it
feed.remoteVideos++;
$('#videoremote' + slot + ' .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
$('#videoremote' + slot).append('<video class="rounded centered" id="remotevideo' + slot + '-' + mid + '" width=100% autoplay playsinline/>');
Expand Down
9 changes: 3 additions & 6 deletions html/nosiptest.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#videoleft .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
$('#videoleft').append('<video class="rounded centered" id="myvideot' + trackId + '" width="100%" height="100%" autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -283,8 +282,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("[caller] Created remote audio stream:", stream);
$('#videoright').append('<audio class="hide" id="peervideo' + mid + '" autoplay playsinline/>');
Expand All @@ -303,8 +301,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videoright .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("[caller] Created remote video stream:", stream);
$('#videoright').append('<video class="rounded centered" id="peervideo' + mid + '" width="100%" height="100%" autoplay playsinline/>');
Expand Down
9 changes: 3 additions & 6 deletions html/recordplaytest.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#videobox .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
$('#videobox').append('<video class="rounded centered" id="thevideo' + trackId + '" width="100%" height="100%" autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -313,8 +312,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
$('#videobox').append('<audio class="hide" id="thevideo' + mid + '" autoplay playsinline/>');
Expand All @@ -333,8 +331,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videobox .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
$('#videobox').append('<video class="rounded centered" id="thevideo' + mid + '" width="100%" height="100%" autoplay playsinline/>');
Expand Down
9 changes: 3 additions & 6 deletions html/screensharingtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#screencapture .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
$('#screencapture').append('<video class="rounded centered" id="screenvideo' + trackId + '" width=100% autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -565,8 +564,7 @@ function newRemoteFeed(id, display) {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
$('#screencapture').append('<audio class="hide" id="screenvideo' + mid + '" playsinline/>');
Expand All @@ -588,8 +586,7 @@ function newRemoteFeed(id, display) {
// New video track: create a stream out of it
remoteVideos++;
$('#screencapture .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteFeed.remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
$('#screencapture').append('<video class="rounded centered" id="screenvideo' + mid + '" width=100% playsinline/>');
Expand Down
18 changes: 6 additions & 12 deletions html/siptest.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#videoleft .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
$('#videoleft').append('<video class="rounded centered" id="myvideot' + trackId + '" width="100%" height="100%" autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -635,8 +634,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
$('#videoright').append('<audio class="hide" id="peervideom' + mid + '" autoplay playsinline/>');
Expand All @@ -655,8 +653,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videoright .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
$('#videoright').append('<video class="rounded centered" id="peervideom' + mid + '" width="100%" height="100%" autoplay playsinline/>');
Expand Down Expand Up @@ -1435,8 +1432,7 @@ function addHelper(helperCreated) {
// New video track: create a stream out of it
helpers[helperId].localVideos++;
$('#videoleft' + helperId + ' .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
helpers[helperId].localTracks[trackId] = stream;
Janus.log("[Helper #" + helperId + "] Created local stream:", stream);
$('#videoleft' + helperId).append('<video class="rounded centered" id="myvideo' + helperId + 't' + trackId + '" width="100%" height="100%" autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -1593,8 +1589,7 @@ function addHelper(helperCreated) {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
helpers[helperId].remoteTracks[mid] = stream;
Janus.log("[Helper #" + helperId + "] Created remote audio stream:", stream);
$('#videoright' + helperId).append('<audio class="hide" id="peervideo' + helperId + 'm' + mid + '" autoplay playsinline/>');
Expand All @@ -1613,8 +1608,7 @@ function addHelper(helperCreated) {
// New video track: create a stream out of it
helpers[helperId].remoteVideos++;
$('#videoright' + helperId + ' .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
helpers[helperId].remoteTracks[mid] = stream;
Janus.log("[Helper #" + helperId + "] Created remote video stream:", stream);
$('#videoright' + helperId).append('<video class="rounded centered" id="peervideo' + helperId + 'm' + mid + '" width="100%" height="100%" autoplay playsinline/>');
Expand Down
6 changes: 2 additions & 4 deletions html/streamingtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ $(document).ready(function() {
var stream = null;
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
$('#'+mstreamId).append('<audio class="hide" id="remotevideo' + mid + '" playsinline/>');
Expand All @@ -206,8 +205,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('.no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
$('#'+mstreamId).append('<video class="rounded centered hide" id="remotevideo' + mid + '" width="100%" height="100%" playsinline/>');
Expand Down
9 changes: 3 additions & 6 deletions html/videocalltest.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
localVideos++;
$('#videoleft .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
localTracks[trackId] = stream;
Janus.log("Created local stream:", stream);
$('#videoleft').append('<video class="rounded centered" id="myvideo' + trackId + '" width="100%" height="100%" autoplay playsinline muted="muted"/>');
Expand Down Expand Up @@ -392,8 +391,7 @@ $(document).ready(function() {
}
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote audio stream:", stream);
$('#videoright').append('<audio class="hide" id="peervideo' + mid + '" autoplay playsinline/>');
Expand All @@ -412,8 +410,7 @@ $(document).ready(function() {
// New video track: create a stream out of it
remoteVideos++;
$('#videoright .no-video-container').remove();
stream = new MediaStream();
stream.addTrack(track.clone());
stream = new MediaStream([track]);
remoteTracks[mid] = stream;
Janus.log("Created remote video stream:", stream);
$('#videoright').append('<video class="rounded centered" id="peervideo' + mid + '" width="100%" height="100%" autoplay playsinline/>');
Expand Down
Loading