mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 19:42:38 +02:00
This commit is contained in:
parent
23390b15e9
commit
148ac1ac44
1 changed files with 8 additions and 8 deletions
|
@ -219,6 +219,7 @@ function changeVideoSrcLoad() {
|
||||||
console.log("changeVideoSrcLoad: Load player Success, Play");
|
console.log("changeVideoSrcLoad: Load player Success, Play");
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
player.load();
|
player.load();
|
||||||
|
console.log("changeVideoSrcLoad: Trying to play");
|
||||||
player.play();
|
player.play();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
@ -400,13 +401,19 @@ var promisePlaytry = 10;
|
||||||
var promisePlayTimeoutTime = 0;
|
var promisePlayTimeoutTime = 0;
|
||||||
var promisePlayTimeout;
|
var promisePlayTimeout;
|
||||||
var promisePlay;
|
var promisePlay;
|
||||||
|
|
||||||
function playerPlay(currentTime) {
|
function playerPlay(currentTime) {
|
||||||
|
if(typeof player === 'undefined' || !player.isReady_){
|
||||||
|
setTimeout(function(){playerPlay(currentTime);},200);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (userIsControling) { // stops here if the user already clicked on play or pause
|
if (userIsControling) { // stops here if the user already clicked on play or pause
|
||||||
console.log("playerPlay: userIsControling");
|
console.log("playerPlay: userIsControling");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (promisePlaytry <= 0) {
|
if (promisePlaytry <= 0) {
|
||||||
console.log("playerPlay: promisePlaytry <= 0");
|
console.log("playerPlay: promisePlaytry <= 0");
|
||||||
|
$.toast("Your browser prevent autoplay");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
promisePlaytry--;
|
promisePlaytry--;
|
||||||
|
@ -415,7 +422,7 @@ function playerPlay(currentTime) {
|
||||||
player.currentTime(currentTime);
|
player.currentTime(currentTime);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
console.log("playerPlay: Trying to play");
|
console.log("playerPlay: Trying to play", player);
|
||||||
promisePlay = player.play();
|
promisePlay = player.play();
|
||||||
if (promisePlay !== undefined) {
|
if (promisePlay !== undefined) {
|
||||||
tryToPlay(currentTime);
|
tryToPlay(currentTime);
|
||||||
|
@ -491,13 +498,6 @@ function playerPlay(currentTime) {
|
||||||
function tryToPlay(currentTime) {
|
function tryToPlay(currentTime) {
|
||||||
clearTimeout(promisePlayTimeout);
|
clearTimeout(promisePlayTimeout);
|
||||||
promisePlayTimeoutTime += 200;
|
promisePlayTimeoutTime += 200;
|
||||||
if (promisePlayTimeoutTime >= 1000) {
|
|
||||||
if (promisePlayTimeoutTime == 1000) {
|
|
||||||
$.toast("Your browser prevent autoplay");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
promisePlayTimeout = setTimeout(function () {
|
promisePlayTimeout = setTimeout(function () {
|
||||||
if (player.paused()) {
|
if (player.paused()) {
|
||||||
playerPlay(currentTime);
|
playerPlay(currentTime);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue