cinera_player_pre.js: Fix YouTube initialisation
Initialise the player if the YouTube API loads before us
This commit is contained in:
parent
c839e2ed85
commit
ee788b0c30
|
@ -23,7 +23,7 @@ typedef struct
|
||||||
version CINERA_APP_VERSION = {
|
version CINERA_APP_VERSION = {
|
||||||
.Major = 0,
|
.Major = 0,
|
||||||
.Minor = 10,
|
.Minor = 10,
|
||||||
.Patch = 0
|
.Patch = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <stdarg.h> // NOTE(matt): varargs
|
#include <stdarg.h> // NOTE(matt): varargs
|
||||||
|
|
|
@ -634,19 +634,26 @@ Player.initializePlatform = function(platform_id, callback) {
|
||||||
} break;
|
} break;
|
||||||
case vod_platform.YOUTUBE:
|
case vod_platform.YOUTUBE:
|
||||||
{
|
{
|
||||||
if (window.APYoutubeAPIReady === undefined) {
|
if(window.YT && window.YT.loaded)
|
||||||
window.APYoutubeAPIReady = false;
|
{
|
||||||
window.APCallbacks = (callback ? [callback] : []);
|
callback()
|
||||||
window.onYouTubeIframeAPIReady = function() {
|
}
|
||||||
window.APYoutubeAPIReady = true;
|
else
|
||||||
for (var i = 0; i < APCallbacks.length; ++i) {
|
{
|
||||||
APCallbacks[i]();
|
if (window.APYoutubeAPIReady === undefined) {
|
||||||
}
|
window.APYoutubeAPIReady = false;
|
||||||
};
|
window.APCallbacks = (callback ? [callback] : []);
|
||||||
} else if (window.APYoutubeAPIReady === false) {
|
window.onYouTubeIframeAPIReady = function() {
|
||||||
window.APCallbacks.push(callback);
|
window.APYoutubeAPIReady = true;
|
||||||
} else if (window.APYoutubeAPIReady === true) {
|
for (var i = 0; i < APCallbacks.length; ++i) {
|
||||||
callback();
|
APCallbacks[i]();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else if (window.APYoutubeAPIReady === false) {
|
||||||
|
window.APCallbacks.push(callback);
|
||||||
|
} else if (window.APYoutubeAPIReady === true) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue