Add pause video button

This commit is contained in:
ian ramzy 2020-03-27 00:52:33 -04:00
parent 478f67ec9a
commit 18bb31c529
2 changed files with 9 additions and 8 deletions

View File

@ -34,7 +34,7 @@
<a href="/" class="round-button">Back</a> <a href="/" class="round-button">Back</a>
<a class="round-button" onclick="{openFullscreen()}">Fullscreen</a> <a class="round-button" onclick="{openFullscreen()}">Fullscreen</a>
<a class="round-button" onclick="{muteMicrophone()}" id="muteButton">Mute </a> <a class="round-button" onclick="{muteMicrophone()}" id="muteButton">Mute </a>
<!-- <a class="round-button" onclick="{pauseVideo()}" id="videoPauseButton">Pause </a>--> <a class="round-button" onclick="{pauseVideo()}" id="videoPauseButton">Pause </a>
</div> </div>
</div> </div>

View File

@ -279,10 +279,10 @@ function openFullscreen() {
function muteMicrophone() { function muteMicrophone() {
var muted = !VideoChat.localStream.getAudioTracks()[0].enabled; var muted = VideoChat.localStream.getAudioTracks()[0].enabled;
VideoChat.localStream.getAudioTracks()[0].enabled = muted; VideoChat.localStream.getAudioTracks()[0].enabled = !muted;
var mutedButton = document.getElementById("muteButton"); const mutedButton = document.getElementById("muteButton");
if (!muted) { if (muted) {
mutedButton.innerText = "Unmute" mutedButton.innerText = "Unmute"
} else { } else {
mutedButton.innerText = "Mute" mutedButton.innerText = "Mute"
@ -290,9 +290,10 @@ function muteMicrophone() {
} }
function pauseVideo() { function pauseVideo() {
VideoChat.localStream.getVideoTracks()[0].enabled = !VideoChat.localStream.getVideoTracks()[0].enabled; var paused = VideoChat.localStream.getVideoTracks()[0].enabled;
var pausedButton = document.getElementById("videoPauseButton"); VideoChat.localStream.getVideoTracks()[0].enabled = !paused;
if (!muted) { const pausedButton = document.getElementById("videoPauseButton");
if (paused) {
pausedButton.innerText = "Unpause" pausedButton.innerText = "Unpause"
} else { } else {
pausedButton.innerText = "Pause" pausedButton.innerText = "Pause"