Evaluating

This commit is contained in:
Kasper Rynning-Tønnesen
2018-02-27 10:53:59 +01:00
parent 8326c1b5f9
commit 3ab65acd9e
2 changed files with 24 additions and 1 deletions

View File

@@ -105,7 +105,28 @@ function hide_native(way) {
}
function chromecastListener(evt, data) {
console.log(evt, data);
var json_parsed = JSON.parse(data);
try {
json_parsed = JSON.parse(json_parsed);
} catch(e) {
console.log("error parsing again");
}
console.log(json_parsed.type, typeof(json_parsed));
if(json_parsed.type == 1) {
console.log("it is 1");
if(!$("#play").hasClass("hide")) {
$("#play").addClass("hide");
}
$("#pause").removeClass("hide");
} else if(json_parsed.type == 2) {
console.log("it is 1");
if(!$("#pause").hasClass("hide")) {
$("#pause").addClass("hide");
}
$("#play").removeClass("hide");
}
//console.log(JSON.parse(json_parsed), json_parsed.type, json_parsed.type == 1, json_parsed.type == "1");
switch(json_parsed.type){
case -1:
if(offline){