1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Add an option to not show the unmute alert anymore

This commit is contained in:
daniel 2020-05-11 14:37:37 -03:00
parent 2afa2750da
commit 01963c1376

View file

@ -607,20 +607,39 @@ function playerPlay(currentTime) {
playerPlay(currentTime);
} else {
if (player.muted() && !inIframe()) {
var span = document.createElement("span");
span.innerHTML = "<b>Would</b> you like to unmute it?<div id='allowAutoplay' style='max-height: 100px; overflow-y: scroll;'></div>";
swal({
title: "Your Media is Muted",
icon: "warning",
buttons: true,
content: span,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
player.muted(false);
}
});
var donotShowUnmuteAgain = Cookies.get('donotShowUnmuteAgain');
if (!donotShowUnmuteAgain) {
var span = document.createElement("span");
span.innerHTML = "<b>Would</b> you like to unmute it?<div id='allowAutoplay' style='max-height: 100px; overflow-y: scroll;'></div>";
swal({
title: "Your Media is Muted",
icon: "warning",
content: span,
dangerMode: true,
buttons: {
cancel: "Cancel",
unmute: true,
donotShowUnmuteAgain: {
text: "Don't show again",
value: "donotShowUnmuteAgain",
className: "btn-danger",
},
}
})
.then((value) => {
switch (value) {
case "unmute":
player.muted(false);
break;
case "donotShowUnmuteAgain":
Cookies.set('donotShowUnmuteAgain', true, {
path: '/',
expires: 365
});
break;
}
});
}
setTimeout(function () {
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
}, 500);