Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

Commit

Permalink
v.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Miala-python authored Dec 22, 2023
1 parent a242973 commit 1e4600c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
34 changes: 21 additions & 13 deletions YT.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
console.log('YT.js >> V2.00.08');
console.log('YT.js >> V2.00.09');

// 1. Créez un objet de lecteur IFrame
var player = 'none';
Expand All @@ -10,7 +10,6 @@ function onPlayerReady(event) {
console.log(event, ': Player Ready => ', player);
event.target.playVideo();
player.playVideo();

}

function changeVideo(vid_id) {
Expand Down Expand Up @@ -131,16 +130,25 @@ function onYouTubeIframeAPIReady() {
// }

function waitLoad() {
if (YT.loaded === 1) {
console.log('YTiframe API ready !');
onYouTubeIframeAPIReady();
} else {
console.log('Wait for YTiframe API...');
// Appel récursif avec un délai d'attente de 1 seconde
setTimeout(function() {
waitLoad();
}, 1000);
try {

if (YT.loaded === 1) {
console.log('YTiframe API ready !');
onYouTubeIframeAPIReady();
} else {
console.log('Wait for YTiframe API...');
// Appel récursif avec un délai d'attente de 1 seconde
setTimeout(function () {
waitLoad();
}, 1000);
}

} catch (error) {
console.log('Wait for iframe_api.js run...');
setTimeout(function () {
waitLoad();
}, 2000);
}
}
}

waitLoad()
4 changes: 2 additions & 2 deletions iframe_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ try {
var ttPolicy = window.trustedTypes.createPolicy("youtube-widget-api", { createScriptURL: function (x) { return x } });
scriptUrl = ttPolicy.createScriptURL(scriptUrl)
} catch (e) {}
var YT = none;
var YT; // = none
if (!window["YT"]) YT = { loading: 0, loaded: 0 };
var YTConfig = none;
var YTConfig; // = none
if (!window["YTConfig"]) YTConfig = { "host": "https://www.youtube.com" };
if (!YT.loading) {
// console.log('¤C2');
Expand Down

0 comments on commit 1e4600c

Please sign in to comment.