Socket
Socket
Sign inDemoInstall

castv2-player

Package Overview
Dependencies
89
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.7 to 2.1.0

3

lib/mediaPlayer.js

@@ -67,2 +67,5 @@ "use strict"

close () {
if (this._player) {
this._player.close();
}
if (this._client) {

@@ -69,0 +72,0 @@ this._client.close();

@@ -44,3 +44,7 @@ "use strict"

close () {
this._detachPlayer();
}
//Play URL -> playlist.addUrl(arguments)

@@ -47,0 +51,0 @@ playUrl (url, options) {

55

lib/scanner.js

@@ -50,2 +50,5 @@ "use strict"

constructor(cb_new, options) {
this.intervalHandler = undefined;
this.timeoutHandler = undefined;
this.browser = mdns({});

@@ -61,9 +64,6 @@ //Add options default

//Search for a Chromecast
var browser = mdns({});
//Remember what devices we have already found
var found_devices = {};
browser.on('response', function(response) {
this.browser.on('response', function(response) {

@@ -124,31 +124,38 @@ var txt_field = find(response.additionals, function (entry) {

if (Object.keys(found_devices).length >= options.maxMatches) {
cb_new = undefined;
browser.removeAllListeners('response');
browser.destroy();
if (intervalHandler)
clearInterval(intervalHandler);
}
this.destroy()
}
}
});
//Send query to find Chromecasts
function sendQuery() {
//console.log("Sending query");
browser.query({
questions:[{
name: '_googlecast._tcp.local',
type: 'PTR'
}]
});
}
sendQuery();
this._sendQuery();
let intervalHandler = undefined;
if (options.scanInterval > 0)
//Trigger periodic scans
intervalHandler = setInterval(sendQuery, options.scanInterval);
this.intervalHandler = setInterval(this._sendQuery.bind(this), options.scanInterval);
else
//Destroy after 15 seconds after we found all devices
setTimeout(function(){ browser.destroy() }, 15000);
this.timeoutHandler = setTimeout(this.destroy.bind(this), 15000);
}
//Send query to find Chromecasts
_sendQuery() {
//console.log("Sending query");
this.browser.query({
questions:[{
name: '_googlecast._tcp.local',
type: 'PTR'
}]
});
}
destroy () {
log.info("Destroying chromecast scanner");
this.browser.removeAllListeners('response');
this.browser.destroy();
if (this.intervalHandler)
clearInterval(this.intervalHandler);
if (this.timeoutHandler)
clearTimeout(this.timeoutHandler);
}
}

@@ -155,0 +162,0 @@

{
"name": "castv2-player",
"version": "2.0.7",
"version": "2.1.0",
"description": "A Chromecast client based on the new (CASTV2) protocol",

@@ -5,0 +5,0 @@ "author": "angelnu",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc