mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Improving showing/hiding of chromecastbutton
This commit is contained in:
4
public/dist/embed.min.js
vendored
4
public/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
8
public/dist/main.min.js
vendored
8
public/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -263,7 +263,7 @@ var Frontpage = {
|
||||
window.history.pushState("to the channel!", "Title", "/" + new_channel);
|
||||
window.chan = new_channel;
|
||||
}
|
||||
|
||||
console.log(chromecastReady);
|
||||
var response = $("<div>" + e + "</div>");
|
||||
|
||||
$(".mega").remove();
|
||||
@@ -384,7 +384,6 @@ function initfp(){
|
||||
if (loaded) {
|
||||
chromecastReady = true;
|
||||
} else {
|
||||
console.log(errorInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,23 +243,24 @@ function init(){
|
||||
$("#search").attr("placeholder", "Find song on YouTube...");
|
||||
|
||||
if(chromecastAvailable){
|
||||
//hide_native(1);
|
||||
hide_native(1);
|
||||
} else if(chromecastReady) {
|
||||
initializeCastApi();
|
||||
} else {
|
||||
window['__onGCastApiAvailable'] = function(loaded, errorInfo) {
|
||||
if (loaded) {
|
||||
setTimeout(function(){
|
||||
chromecastReady = true;
|
||||
initializeCastApi();
|
||||
}, 1000);
|
||||
} else {
|
||||
chromecastReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initializeCastApi = function() {
|
||||
$(".castButton").css("display", "block");
|
||||
cast.framework.CastContext.getInstance().setOptions({
|
||||
receiverApplicationId: "E6856E24",
|
||||
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED});
|
||||
@@ -312,6 +313,10 @@ initializeCastApi = function() {
|
||||
break;
|
||||
}
|
||||
});
|
||||
Helper.log(cast.framework.CastContext.getInstance().getCastState());
|
||||
if(cast.framework.CastContext.getInstance().getCastState() == "NO_DEVICES_AVAILABLE"){
|
||||
$(".castButton").css("display", "none");
|
||||
}
|
||||
};
|
||||
|
||||
function hide_native(way){
|
||||
|
||||
Reference in New Issue
Block a user