More updates receiver

This commit is contained in:
Kasper Rynning-Tønnesen
2016-11-18 12:54:22 +01:00
parent c12db4c3bf
commit fece31e31a
4 changed files with 80 additions and 9 deletions

View File

@@ -37,6 +37,7 @@ var embed_autoplay = "&autoplay";
var connect_error = false;
var access_token_data_youtube = {};
var youtube_authenticated = false;
var chromecastAvailable = false;
if(localStorage.debug === undefined){
var debug = false;
@@ -238,14 +239,24 @@ function init(){
initializeCastApi = function() {
cast.framework.CastContext.getInstance().setOptions({
receiverApplicationId: chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID});
receiverApplicationId: "E6856E24",
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED});
//var castSession = cast.framework.CastContext.getInstance().getCurrentSession();
//console.log(castSession);
var context = cast.framework.CastContext.getInstance();
context.addEventListener(
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
function(event) {
console.log(event);
switch (event.sessionState) {
case cast.framework.SessionState.SESSION_STARTING:
var castSession = cast.framework.CastContext.getInstance().getCurrentSession();
console.log(castSession);
break;
case cast.framework.SessionState.SESSION_STARTED:
var castSession = cast.framework.CastContext.getInstance().getCurrentSession();
//cast.framework.CastSession(castSession);
console.log(castSession);
$(".castButton").toggleClass("hide");
$(".castButton-active").toggleClass("hide");
break;
@@ -259,8 +270,15 @@ initializeCastApi = function() {
// Update locally as necessary
break;
}
})
$(".castButton").css("display", "inline-block");
});
console.log(context);
console.log("asd");
if(context.L == "NOT_CONNECTED"){
//$(".castButton").css("display", "inline-block");
var castSession = cast.framework.CastContext.getInstance().getCurrentSession();
console.log("hello");
console.log(castSession);
}
};
function setup_no_connection_listener(){