Skip to content

Commit

Permalink
Added bootstrap-based spinner to a few demos
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Dec 1, 2023
1 parent cbc9bfa commit e4da5d7
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 3 deletions.
2 changes: 1 addition & 1 deletion html/audiobridgetest.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<div class="row">
<div class="col-md-12">
<div class="pb-2 mt-4 mb-2 border-bottom">
<h1>Plugin Demo: Audio Room (mixed)
<h1>Plugin Demo: Audio Bridge (mixed)
<button class="btn btn-secondary" autocomplete="off" id="start">Start</button>
</h1>
</div>
Expand Down
13 changes: 12 additions & 1 deletion html/audiobridgetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ $(document).ready(function() {
if(stereo && jsep.sdp.indexOf("stereo=1") == -1) {
// Make sure that our offer contains stereo too
jsep.sdp = jsep.sdp.replace("useinbandfec=1", "useinbandfec=1;stereo=1");
// Create a spinner waiting for the remote video
$('#mixedaudio').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
}
},
success: function(jsep) {
Expand Down Expand Up @@ -314,12 +321,16 @@ $(document).ready(function() {
$('#roomaudio').remove();
return;
}
$('#spinner').remove();
remoteStream = new MediaStream([track]);
$('#room').removeClass('hide');
if($('#roomaudio').length === 0) {
$('#mixedaudio').append('<audio class="rounded centered" id="roomaudio" width="100%" height="100%" autoplay/>');
$('#mixedaudio').append('<audio class="rounded centered w-100" id="roomaudio" controls autoplay/>');
$('#roomaudio').get(0).volume = 0;
}
Janus.attachMediaStream($('#roomaudio').get(0), remoteStream);
$('#roomaudio').get(0).play();
$('#roomaudio').get(0).volume = 1;
// Mute button
audioenabled = true;
$('#toggleaudio').click(
Expand Down
8 changes: 8 additions & 0 deletions html/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ $(document).ready(function() {
return;
}
// If we're here, a new track was added
$('#spinner').remove();
let addButtons = false;
if($('#videoright audio').length === 0 && $('#videoright video').length === 0) {
addButtons = true;
Expand Down Expand Up @@ -417,6 +418,13 @@ function createCanvas() {
success: function(jsep) {
Janus.debug("Got SDP!", jsep);
echotest.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#videoright').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error:", error);
Expand Down
8 changes: 8 additions & 0 deletions html/devicetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ function restartCapture() {
success: function(jsep) {
Janus.debug("Got SDP!", jsep);
echotest.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#videoright').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error:", error);
Expand Down Expand Up @@ -402,6 +409,7 @@ $(document).ready(function() {
return;
}
// If we're here, a new track was added
$('#spinner').remove();
let addButtons = false;
if($('#videoright audio').length === 0 && $('#videoright video').length === 0) {
addButtons = true;
Expand Down
8 changes: 8 additions & 0 deletions html/e2etest.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ $(document).ready(function() {
return;
}
// If we're here, a new track was added
$('#spinner').remove();
let addButtons = false;
if($('#videoright audio').length === 0 && $('#videoright video').length === 0) {
addButtons = true;
Expand Down Expand Up @@ -586,6 +587,13 @@ function promptCryptoKey() {
if(vcodec)
body["videocodec"] = vcodec;
echotest.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#videoright').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error:", error);
Expand Down
8 changes: 8 additions & 0 deletions html/echotest.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ $(document).ready(function() {
success: function(jsep) {
Janus.debug("Got SDP!", jsep);
echotest.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#videoright').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error:", error);
Expand Down Expand Up @@ -320,6 +327,7 @@ $(document).ready(function() {
return;
}
// If we're here, a new track was added
$('#spinner').remove();
let addButtons = false;
if($('#videoright audio').length === 0 && $('#videoright video').length === 0) {
addButtons = true;
Expand Down
8 changes: 8 additions & 0 deletions html/multiopus.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ $(document).ready(function() {
success: function(jsep) {
Janus.debug("Got SDP!", jsep);
echotest.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#videoright').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error:", error);
Expand Down Expand Up @@ -229,6 +236,7 @@ $(document).ready(function() {
return;
}
// If we're here, a new track was added
$('#spinner').remove();
let addButtons = false;
if($('#videoright audio').length === 0 && $('#videoright video').length === 0) {
addButtons = true;
Expand Down
8 changes: 8 additions & 0 deletions html/nosiptest.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ $(document).ready(function() {
srtp: srtp
};
caller.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#videoright').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error:", error);
Expand Down Expand Up @@ -270,6 +277,7 @@ $(document).ready(function() {
if($('#peervideo' + mid).length > 0)
return;
// If we're here, a new track was added
$('#spinner').remove();
if($('#videoright audio').length === 0 && $('#videoright video').length === 0) {
$('#videos').removeClass('hide');
$('#videoright').parent().find('h3').html(
Expand Down
10 changes: 9 additions & 1 deletion html/streamingtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ $(document).ready(function() {
if($('#remotevideo' + mid).length > 0)
return;
// If we're here, a new track was added
$('#spinner' + mid).remove();
let stream = null;
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
Expand Down Expand Up @@ -265,6 +266,7 @@ $(document).ready(function() {
oncleanup: function() {
Janus.log(" ::: Got a cleanup notification :::");
$('#videos').empty();
$('#info').addClass('hide');
for(let i in bitrateTimer)
clearInterval(bitrateTimer[i]);
bitrateTimer = {};
Expand Down Expand Up @@ -459,7 +461,13 @@ function addPanel(panelId, mid, desc) {
' <span class="badge bg-info hide" id="curbitrate' + mid + '"></span>' +
' </span>' +
' </div>' +
' <div class="card-body" id="mstream' + panelId + '"></div>' +
' <div class="card-body" id="mstream' + panelId + '">' +
' <div class="text-center">' +
' <div id="spinner' + mid + '" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
' </div>' +
' </div>' +
' </div>' +
'</div>'
);
Expand Down
8 changes: 8 additions & 0 deletions html/videocalltest.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ $(document).ready(function() {
if($('#peervideo' + mid).length > 0)
return;
// If we're here, a new track was added
$('#spinner').remove();
let addButtons = false;
if($('#videoright audio').length === 0 && $('#videoright video').length === 0) {
addButtons = true;
Expand Down Expand Up @@ -592,6 +593,13 @@ function doCall() {
Janus.debug("Got SDP!", jsep);
let body = { request: "call", username: $('#peer').val() };
videocall.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#videoright').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error...", error);
Expand Down
8 changes: 8 additions & 0 deletions html/virtualbg.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ $(document).ready(function() {
return;
}
// If we're here, a new track was added
$('#spinner').remove();
let addButtons = false;
if($('#videoright audio').length === 0 && $('#videoright video').length === 0) {
addButtons = true;
Expand Down Expand Up @@ -461,6 +462,13 @@ function createCanvas() {
success: function(jsep) {
Janus.debug("Got SDP!", jsep);
echotest.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#videoright').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error:", error);
Expand Down
8 changes: 8 additions & 0 deletions html/webaudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ $(document).ready(function() {
return;
}
// If we're here, a new track was added
$('#spinner').remove();
if(track.kind === "audio") {
// New audio track: create a stream out of it, and use a hidden <audio> element
let stream = new MediaStream([track]);
Expand Down Expand Up @@ -309,6 +310,13 @@ function setupWebAudioDemo() {
Janus.debug("Got SDP!", jsep);
let body = { audio: true, video: true };
echotest.send({ message: body, jsep: jsep });
// Create a spinner waiting for the remote video
$('#remote').html(
'<div class="text-center">' +
' <div id="spinner" class="spinner-border" role="status">' +
' <span class="visually-hidden">Loading...</span>' +
' </div>' +
'</div>');
},
error: function(error) {
Janus.error("WebRTC error:", error);
Expand Down

0 comments on commit e4da5d7

Please sign in to comment.