Skip to content

Commit

Permalink
fix save mute setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Fefedu973 committed Jul 8, 2022
1 parent 0fb4200 commit ef2dcdf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/launcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,35 @@
</div>
</body>
<script>
window.onload = function() {
muteonload();
};
function muteonload() {
var muted = localStorage.getItem("muted");
var video=document.getElementById("myVideo")
var div=document.getElementById('button');
if (muted == "true") {
video.muted = true;
div.innerHTML = `<button class="mutebtn" id="btn" onclick="toggleMute();">Unmute <img id="muteimg" style="width: 25px;margin-left: 6px;vertical-align: middle;" src="assets/images/logo/unmute.svg"></button>`;
} else {
video.muted = false;
div.innerHTML = `<button class="mutebtn" id="btn" onclick="toggleMute();">Mute <img id="muteimg" style="width: 25px;margin-left: 6px;vertical-align: middle;" src="assets/images/logo/mute.svg"></button>`;
}
}

function toggleMute() {

var video=document.getElementById("myVideo")
var div=document.getElementById('button');

if(video.muted){
video.muted = false;
localStorage.setItem("muted", "false");
div.innerHTML = `<button class="mutebtn" id="btn" onclick="toggleMute();">Mute <img id="muteimg" style="width: 25px;margin-left: 6px;vertical-align: middle;" src="assets/images/logo/mute.svg"></button>`;

} else {
video.muted = true;
localStorage.setItem("muted", "true");
div.innerHTML = `<button class="mutebtn" id="btn" onclick="toggleMute();">Unmute <img id="muteimg" style="width: 25px;margin-left: 6px;vertical-align: middle;" src="assets/images/logo/unmute.svg"></button>`;
}

Expand Down

0 comments on commit ef2dcdf

Please sign in to comment.