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 class="round-button" onclick="{openFullscreen()}">Fullscreen</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>

View File

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