This commit is contained in:
Pierre Rudloff 2016-06-22 12:20:00 +02:00
parent 8b30070a86
commit 9542285e72

View file

@ -1,17 +1,15 @@
/*global chrome*/ /*global chrome*/
/*jslint devel: true, browser: true */ /*jslint browser: true */
var launchBtn, disabledBtn, stopBtn; var launchBtn, disabledBtn, stopBtn;
var session, currentMedia; var session;
function receiverListener(e) { function receiverListener(e) {
'use strict'; 'use strict';
console.log('receiverListener', e); return (e === chrome.cast.ReceiverAvailability.AVAILABLE);
} }
function onMediaDiscovered(how, media) { function onMediaDiscovered() {
'use strict'; 'use strict';
console.log('onMediaDiscovered', how);
currentMedia = media;
if (launchBtn) { if (launchBtn) {
stopBtn.classList.remove('cast_hidden'); stopBtn.classList.remove('cast_hidden');
launchBtn.classList.add('cast_hidden'); launchBtn.classList.add('cast_hidden');
@ -40,7 +38,6 @@ function stopCast() {
function onMediaError() { function onMediaError() {
'use strict'; 'use strict';
console.log('onMediaError');
stopCast(); stopCast();
} }
@ -53,7 +50,7 @@ function onRequestSessionSuccess(e) {
function onLaunchError(e) { function onLaunchError(e) {
'use strict'; 'use strict';
console.log('onLaunchError', e.description); throw e.description;
} }
function launchCast() { function launchCast() {
@ -74,9 +71,9 @@ function onInitSuccess() {
} }
} }
function onError() { function onError(e) {
'use strict'; 'use strict';
console.log('onError'); throw e.code;
} }
function initializeCastApi() { function initializeCastApi() {
@ -90,7 +87,7 @@ function loadCastApi(loaded, errorInfo) {
if (loaded) { if (loaded) {
initializeCastApi(); initializeCastApi();
} else { } else {
console.log(errorInfo); throw errorInfo;
} }
} }