mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
Add an option to not show the unmute alert anymore
This commit is contained in:
parent
2afa2750da
commit
01963c1376
1 changed files with 33 additions and 14 deletions
|
@ -607,20 +607,39 @@ function playerPlay(currentTime) {
|
||||||
playerPlay(currentTime);
|
playerPlay(currentTime);
|
||||||
} else {
|
} else {
|
||||||
if (player.muted() && !inIframe()) {
|
if (player.muted() && !inIframe()) {
|
||||||
|
var donotShowUnmuteAgain = Cookies.get('donotShowUnmuteAgain');
|
||||||
|
if (!donotShowUnmuteAgain) {
|
||||||
var span = document.createElement("span");
|
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>";
|
span.innerHTML = "<b>Would</b> you like to unmute it?<div id='allowAutoplay' style='max-height: 100px; overflow-y: scroll;'></div>";
|
||||||
swal({
|
swal({
|
||||||
title: "Your Media is Muted",
|
title: "Your Media is Muted",
|
||||||
icon: "warning",
|
icon: "warning",
|
||||||
buttons: true,
|
|
||||||
content: span,
|
content: span,
|
||||||
dangerMode: true,
|
dangerMode: true,
|
||||||
|
buttons: {
|
||||||
|
cancel: "Cancel",
|
||||||
|
unmute: true,
|
||||||
|
donotShowUnmuteAgain: {
|
||||||
|
text: "Don't show again",
|
||||||
|
value: "donotShowUnmuteAgain",
|
||||||
|
className: "btn-danger",
|
||||||
|
},
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.then((willDelete) => {
|
.then((value) => {
|
||||||
if (willDelete) {
|
switch (value) {
|
||||||
|
case "unmute":
|
||||||
player.muted(false);
|
player.muted(false);
|
||||||
|
break;
|
||||||
|
case "donotShowUnmuteAgain":
|
||||||
|
Cookies.set('donotShowUnmuteAgain', true, {
|
||||||
|
path: '/',
|
||||||
|
expires: 365
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
|
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue