1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00
Improve the autoplay
This commit is contained in:
daniel 2020-01-13 17:43:46 -03:00
parent ecd67054fc
commit da9411e231
7 changed files with 137 additions and 224 deletions

View file

@ -189,7 +189,7 @@ $(document).ready(function () {
}
});
});
$('.clearCacheFirstPageButton').on('click', function (ev) {
ev.preventDefault();
modal.showPleaseWait();
@ -466,10 +466,45 @@ function nl2br(str, is_xhtml) {
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
}
function inIframe () {
function inIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
function playerPlay(currentTime) {
if (typeof player === 'undefined') {
if(currentTime){
player.currentTime(currentTime);
}
try {
var promise = player.play();
if (promise !== undefined) {
promise.then(_ => {
// Autoplay started!
}).catch(error => {
// Show something in the UI that the video is muted
player.muted(true);
player.play();
});
}
} catch (e) {
setTimeout(function () {
var promise = player.play();
if (promise !== undefined) {
promise.then(_ => {
// Autoplay started!
}).catch(error => {
// Show something in the UI that the video is muted
player.muted(true);
player.play();
});
}
}, 1000);
}
}
}