Fixing issues with chromecastbutton

This commit is contained in:
Kasper Rynning-Tønnesen
2017-01-28 19:52:58 +01:00
parent 1bcf63f84e
commit 581b1eea4d
3 changed files with 12 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -277,6 +277,8 @@ function init(){
$(".castButton-unactive").css("display", "none"); $(".castButton-unactive").css("display", "none");
} }
console.log(chromecastReady);
if(chromecastAvailable){ if(chromecastAvailable){
hide_native(1); hide_native(1);
} else if(chromecastReady) { } else if(chromecastReady) {
@@ -349,6 +351,11 @@ initializeCastApi = function() {
break; break;
} }
}); });
if(cast.framework.CastContext.getInstance().getCastState() == "NOT_CONNECTED"){
$(".castButton-unactive").css("display", "block");
}
var cast_state = cast.framework.CastContext.getInstance(); var cast_state = cast.framework.CastContext.getInstance();
cast_state.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED, function(event){ cast_state.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED, function(event){
if(event.castState == "NOT_CONNECTED"){ if(event.castState == "NOT_CONNECTED"){