update chromecast loading

This commit is contained in:
Luke Pulverenti 2016-01-08 23:28:09 -05:00
parent 27045096ea
commit 9f48886829
2 changed files with 18 additions and 6 deletions

View File

@ -1,4 +1,4 @@
(function (window, chrome, console) {
define(['https://www.gstatic.com/cv/js/sender/v1/cast_sender.js'], function () {
// Based on https://github.com/googlecast/CastVideos-chrome/blob/master/CastVideos.js
var currentResolve;
@ -90,6 +90,8 @@
*/
CastPlayer.prototype.initializeCastPlayer = function () {
var chrome = window.chrome;
if (!chrome) {
return;
}
@ -861,9 +863,17 @@
castPlayer = new CastPlayer();
MediaController.registerPlayer(new chromecastPlayer());
var registeredPlayer = new chromecastPlayer();
MediaController.registerPlayer(registeredPlayer);
// To allow the native android app to override
document.dispatchEvent(new CustomEvent("chromecastloaded", {
detail: {
player: registeredPlayer
}
}));
}
requirejs(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"], initializeChromecast);
initializeChromecast();
})(window, window.chrome, console);
});

View File

@ -2276,16 +2276,18 @@ var AppInfo = {};
if (Dashboard.isRunningInCordova()) {
postInitDependencies.push('cordova/connectsdk');
if (browserInfo.android) {
postInitDependencies.push('cordova/android/mediasession');
postInitDependencies.push('cordova/android/chromecast');
} else {
postInitDependencies.push('cordova/volume');
}
if (browserInfo.safari) {
postInitDependencies.push('cordova/connectsdk/connectsdk');
postInitDependencies.push('cordova/ios/orientation');
if (Dashboard.capabilities().SupportsSync) {