Socket
Socket
Sign inDemoInstall

castv2-client

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

castv2-client - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

109

lib/controllers/media.js

@@ -119,2 +119,111 @@ var util = require('util');

//Load a queue of items to play (playlist)
//See https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest
MediaController.prototype.queueLoad = function(items, options, callback) {
if(typeof options === 'function' || typeof options === 'undefined') {
callback = options;
options = {};
}
var data = { type: 'QUEUE_LOAD' };
//REPEAT_OFF, REPEAT_ALL, REPEAT_SINGLE, REPEAT_ALL_AND_SHUFFLE
data.repeatMode = (typeof options.repeatMode === "string" &&
typeof options.repeatMode !== 'undefined')
? options.repeatMode
: "REPEAT_OFF";
data.currentTime = (typeof options.currentTime !== 'undefined')
? options.currentTime
: 0;
data.startIndex = (typeof options.startIndex !== 'undefined')
? options.startIndex
: 0;
data.items = items;
this.request(data, function(err, response) {
if(err) return callback(err);
if(response.type === 'LOAD_FAILED') {
return callback(new Error('queueLoad failed'));
}
if(response.type === 'LOAD_CANCELLED') {
return callback(new Error('queueLoad cancelled'));
}
var status = response.status[0];
callback(null, status);
});
};
MediaController.prototype.queueInsert = function(items, options, callback) {
if(typeof options === 'function' || typeof options === 'undefined') {
callback = options;
options = {};
}
var data = {
type: 'QUEUE_INSERT',
currentItemId: options.currentItemId, //Item ID to play after this request or keep same item if undefined
currentItemIndex: options.currentItemIndex, //Item Index to play after this request or keep same item if undefined
currentTime: options.currentTime, //Seek in seconds for current stream
insertBefore: options.insertBefore, //ID or append if undefined
items: items
};
this.sessionRequest(data, callback);
};
MediaController.prototype.queueRemove = function(itemIds, options, callback) {
if(typeof options === 'function' || typeof options === 'undefined') {
callback = options;
options = {};
}
var data = {
type: 'QUEUE_REMOVE',
currentItemId: options.currentItemId,
currentTime: options.currentTime,
itemIds: itemIds
};
this.sessionRequest(data, callback);
};
MediaController.prototype.queueReorder = function(itemIds, options, callback) {
if(typeof options === 'function' || typeof options === 'undefined') {
callback = options;
options = {};
}
var data = {
type: 'QUEUE_REORDER',
currentItemId: options.currentItemId,
currentTime: options.currentTime,
insertBefore: options.insertBefore,
itemIds: itemIds
};
this.sessionRequest(data, callback);
};
MediaController.prototype.queueUpdate = function(items, options, callback) {
if(typeof options === 'function' || typeof options === 'undefined') {
callback = options;
options = {};
}
var data = {
type: 'QUEUE_UPDATE',
currentItemId: options.currentItemId,
currentTime: options.currentTime,
jump: options.jump, //Skip or go back (if negative) number of items
repeatMode: options.repeatMode,
items: items
};
this.sessionRequest(data, callback);
};
module.exports = MediaController;

22

lib/senders/default-media-receiver.js

@@ -49,2 +49,22 @@ var util = require('util');

module.exports = DefaultMediaReceiver;
DefaultMediaReceiver.prototype.queueLoad = function(items, options, callback) {
this.media.queueLoad.apply(this.media, arguments);
};
DefaultMediaReceiver.prototype.queueInsert = function(items, options, callback) {
this.media.queueInsert.apply(this.media, arguments);
};
DefaultMediaReceiver.prototype.queueRemove = function(itemIds, options, callback) {
this.media.queueRemove.apply(this.media, arguments);
};
DefaultMediaReceiver.prototype.queueReorder = function(itemIds, options, callback) {
this.media.queueReorder.apply(this.media, arguments);
};
DefaultMediaReceiver.prototype.queueUpdate = function(items, callback) {
this.media.queueUpdate.apply(this.media, arguments);
};
module.exports = DefaultMediaReceiver;

2

package.json
{
"name": "castv2-client",
"version": "1.1.2",
"version": "1.2.0",
"description": "A Chromecast client based on the new (CASTV2) protocol",

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

@@ -104,1 +104,2 @@ castv2-client

* [xat](https://github.com/xat) (Simon Kusterer)
* [angelnu](https://github.com/angelnu) (Angel Nunez Mencias)
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc