@scrypted/chromecast
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@scrypted/chromecast", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Send video, audio, and text to speech notifications to Chromecast and Google Home devices", | ||
@@ -32,3 +32,3 @@ "author": "Scrypted", | ||
"raw-loader": "^1.0.0", | ||
"scrypted-deploy": "^1.3.3", | ||
"scrypted-deploy": "^1.3.5", | ||
"webpack-merge": "^4.2.1" | ||
@@ -35,0 +35,0 @@ }, |
@@ -34,3 +34,3 @@ const fs = require('fs'); | ||
this.player.load(media, { autoplay: true }, function (err, status) { | ||
console.log('media loaded playerState=%s', status.playerState); | ||
log.i(`media loaded playerState=${status.playerState}`); | ||
}); | ||
@@ -43,11 +43,21 @@ return; | ||
this.player.on('status', function (status) { | ||
console.log('status broadcast playerState=%s', status.playerState); | ||
log.i(`status broadcast playerState=${status.playerState}`); | ||
}); | ||
this.player.on('close', () => { | ||
log.i('player closed'); | ||
delete this.player; | ||
if (this.client) { | ||
this.client.close(); | ||
delete this.client; | ||
} | ||
}); | ||
console.log('app "%s" launched, loading media %s ...', player.session.displayName, media.contentId); | ||
log.i(`app "${player.session.displayName}" launched, loading media ${media.contentId} ...`); | ||
this.player.load(media, { autoplay: true }, function (err, status) { | ||
console.log('media loaded playerState=%s', status.playerState); | ||
if (status) { | ||
log.i(`media loaded playerState=${status.playerState}`); | ||
} | ||
else if (err) { | ||
log.e(`media load failed ${err}`); | ||
} | ||
}); | ||
@@ -59,3 +69,3 @@ }); | ||
if (this.client) { | ||
console.log('reusing client') | ||
log.i('reusing client') | ||
this.sendMediaToClient(title, mediaUrl, mimeType); | ||
@@ -72,5 +82,8 @@ return; | ||
this.client.on('error', (err) => { | ||
console.log('Error: %s', err.message); | ||
this.client.close(); | ||
delete this.client; | ||
log.i(`Error: ${err.message}`); | ||
delete this.player; | ||
if (this.client) { | ||
this.client.close(); | ||
delete this.client; | ||
} | ||
}); | ||
@@ -122,3 +135,3 @@ } | ||
this.browser.on('serviceUp', function(service) { | ||
console.log(JSON.stringify(service)); | ||
log.i(JSON.stringify(service)); | ||
var id = service.txtRecord.id; | ||
@@ -125,0 +138,0 @@ if (!id) { |
Sorry, the diff of this file is too big to display
239101
1106