switch id
This commit is contained in:
parent
8268cb6662
commit
6e0bfa99be
3 changed files with 75 additions and 3 deletions
70
src/main/base/castreceiver.js
Normal file
70
src/main/base/castreceiver.js
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
//@ts-nocheck
|
||||||
|
var util = require('util');
|
||||||
|
// var debug = require('debug')('castv2-client');
|
||||||
|
var Application = require('castv2-client').Application;
|
||||||
|
var MediaController = require('castv2-client').MediaController;
|
||||||
|
|
||||||
|
function CiderReceiver(client, session) {
|
||||||
|
Application.apply(this, arguments);
|
||||||
|
|
||||||
|
this.media = this.createController(MediaController);
|
||||||
|
|
||||||
|
this.media.on('status', onstatus);
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
function onstatus(status) {
|
||||||
|
self.emit('status', status);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CiderReceiver.APP_ID = '27E1334F';
|
||||||
|
|
||||||
|
util.inherits(CiderReceiver, Application);
|
||||||
|
|
||||||
|
CiderReceiver.prototype.getStatus = function(callback) {
|
||||||
|
this.media.getStatus.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.load = function(media, options, callback) {
|
||||||
|
this.media.load.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.play = function(callback) {
|
||||||
|
this.media.play.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.pause = function(callback) {
|
||||||
|
this.media.pause.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.stop = function(callback) {
|
||||||
|
this.media.stop.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.seek = function(currentTime, callback) {
|
||||||
|
this.media.seek.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.queueLoad = function(items, options, callback) {
|
||||||
|
this.media.queueLoad.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.queueInsert = function(items, options, callback) {
|
||||||
|
this.media.queueInsert.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.queueRemove = function(itemIds, options, callback) {
|
||||||
|
this.media.queueRemove.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.queueReorder = function(itemIds, options, callback) {
|
||||||
|
this.media.queueReorder.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.queueUpdate = function(items, callback) {
|
||||||
|
this.media.queueUpdate.apply(this.media, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = CiderReceiver;
|
|
@ -1,6 +1,7 @@
|
||||||
import * as electron from 'electron';
|
import * as electron from 'electron';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import {resolve} from 'path';
|
import {resolve} from 'path';
|
||||||
|
import * as CiderReceiver from '../base/castreceiver';
|
||||||
|
|
||||||
export default class ChromecastPlugin {
|
export default class ChromecastPlugin {
|
||||||
|
|
||||||
|
@ -133,9 +134,8 @@ export default class ChromecastPlugin {
|
||||||
|
|
||||||
private loadMedia(client: any, song: any, artist: any, album: any, albumart: any, cb?: any) {
|
private loadMedia(client: any, song: any, artist: any, album: any, albumart: any, cb?: any) {
|
||||||
// const u = 'http://' + this.getIp() + ':' + server.address().port + '/';
|
// const u = 'http://' + this.getIp() + ':' + server.address().port + '/';
|
||||||
const DefaultMediaReceiver : any = require('castv2-client').DefaultMediaReceiver;
|
// const DefaultMediaReceiver : any = require('castv2-client').DefaultMediaReceiver;
|
||||||
|
client.launch(CiderReceiver, (err: any, player: any) => {
|
||||||
client.launch(DefaultMediaReceiver, (err: any, player: any) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return;
|
return;
|
||||||
|
@ -273,6 +273,7 @@ export default class ChromecastPlugin {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base Plugin Details (Eventually implemented into a GUI in settings)
|
* Base Plugin Details (Eventually implemented into a GUI in settings)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
|
"allowJs": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue