optimize caption text jquery selection

This commit is contained in:
ian ramzy 2020-03-31 12:12:37 -04:00
parent ec88f5efe6
commit bba20c9533

View File

@ -251,7 +251,7 @@ var VideoChat = {
Snackbar.close(); Snackbar.close();
VideoChat.remoteVideo.style.background = "none"; VideoChat.remoteVideo.style.background = "none";
VideoChat.connected = true; VideoChat.connected = true;
$("#remote-video-text").fadeOut(); captionText.fadeOut();
$("#local-video-text").fadeOut(); $("#local-video-text").fadeOut();
var timesRun = 0; var timesRun = 0;
@ -464,7 +464,7 @@ function requestToggleCaptions() {
return; return;
} }
if (receivingCaptions) { if (receivingCaptions) {
$("#remote-video-text").text("").fadeOut(); captionText.text("").fadeOut();
$("#caption-text").text("Start Live Caption"); $("#caption-text").text("Start Live Caption");
receivingCaptions = false; receivingCaptions = false;
} else { } else {
@ -551,21 +551,21 @@ function startSpeech() {
} }
function recieveCaptions(captions) { function recieveCaptions(captions) {
$("#remote-video-text").text("").fadeIn(); captionText.text("").fadeIn();
if (!receivingCaptions) { if (!receivingCaptions) {
$("#remote-video-text").text("").fadeOut(); captionText.text("").fadeOut();
} }
if (captions === "notusingchrome") { if (captions === "notusingchrome") {
alert("Other caller must be using chrome for this feature to work"); alert("Other caller must be using chrome for this feature to work");
receivingCaptions = false; receivingCaptions = false;
$("#remote-video-text").text("").fadeOut(); captionText.text("").fadeOut();
$("#caption-text").text("Start Live Caption"); $("#caption-text").text("Start Live Caption");
return; return;
} }
if (captions.length > 299) { if (captions.length > 299) {
$("#remote-video-text").text(captions.substr(captions.length - 299)); captionText.text(captions.substr(captions.length - 299));
} else { } else {
$("#remote-video-text").text(captions); captionText.text(captions);
} }
rePositionCaptions(); rePositionCaptions();
} }
@ -690,7 +690,7 @@ function startUp() {
// get webcam on load // get webcam on load
VideoChat.requestMediaStream(); VideoChat.requestMediaStream();
$("#remote-video-text").text("").fadeOut(); captionText.text("").fadeOut();
$("#moveable").draggable({ containment: "window" }); $("#moveable").draggable({ containment: "window" });