castv2-player
Advanced tools
Comparing version 1.1.8 to 1.1.9
@@ -262,22 +262,25 @@ "use strict" | ||
log.error("%s - Error parsing announcement URL as JSON: %s\nPassed URL: %s", that._name, error, url); | ||
return Promise.reject(error) | ||
return Promise.reject(error); | ||
} | ||
} | ||
return that.getDefaultPlayerPromise() | ||
.then(function(){ | ||
if (that.getStatus() === undefined || that.getCurrentPlaylistId() === undefined || that.getStatus().playerState == "IDLE") | ||
//currently not playing -> playUrl and wait for it to finish | ||
return that.playUrl (url, options) | ||
.then(function(playUrlPromise) { | ||
return new Promise(function (resolve, reject) { | ||
that.on(that.EVENT_STATUS, function(status) { | ||
let announcementCheckStatus = function (status) { | ||
if (status.media.contentId != url || (status.playerState != "PLAYING")) { | ||
log.info ("%s - Finished playing announcement", that._name); | ||
that.removeListener(that.EVENT_STATUS, announcementCheckStatus); | ||
resolve(playUrlPromise); | ||
} | ||
}); | ||
}; | ||
that.on(that.EVENT_STATUS, announcementCheckStatus); | ||
}); | ||
}); | ||
} | ||
} | ||
return that.getDefaultPlayerPromise() | ||
.then(function(){ | ||
if (that.getStatus() === undefined || that.getCurrentPlaylistId() === undefined || that.getStatus().playerState == "IDLE") | ||
//currently not playing -> playUrl and wait for it to finish | ||
return that.playUrl (url, options); | ||
else { | ||
@@ -284,0 +287,0 @@ |
{ | ||
"name": "castv2-player", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "A Chromecast client based on the new (CASTV2) protocol", | ||
@@ -32,4 +32,5 @@ "author": "angelnu", | ||
"chromecast", | ||
"castv2" | ||
"castv2", | ||
"home" | ||
] | ||
} |
84085
2140