add metadata support
This commit is contained in:
parent
6e0bfa99be
commit
c2a0bf2f45
3 changed files with 35 additions and 1 deletions
24
src/main/base/castcontroller.js
Normal file
24
src/main/base/castcontroller.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
var util = require('util');
|
||||||
|
var castv2Cli = require('castv2-client');
|
||||||
|
var RequestResponseController = castv2Cli.RequestResponseController;
|
||||||
|
|
||||||
|
function CiderCastController(client, sourceId, destinationId) {
|
||||||
|
RequestResponseController.call(this, client, sourceId, destinationId, 'urn:x-cast:com.ciderapp.customdata');
|
||||||
|
this.once('close', onclose);
|
||||||
|
var self = this;
|
||||||
|
function onclose() {
|
||||||
|
self.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(CiderCastController, RequestResponseController);
|
||||||
|
|
||||||
|
CiderCastController.prototype.sendIp = function(ip) {
|
||||||
|
// TODO: Implement Callback
|
||||||
|
let data = {
|
||||||
|
ip : ip
|
||||||
|
}
|
||||||
|
this.request(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = CiderCastController;
|
|
@ -3,11 +3,13 @@ var util = require('util');
|
||||||
// var debug = require('debug')('castv2-client');
|
// var debug = require('debug')('castv2-client');
|
||||||
var Application = require('castv2-client').Application;
|
var Application = require('castv2-client').Application;
|
||||||
var MediaController = require('castv2-client').MediaController;
|
var MediaController = require('castv2-client').MediaController;
|
||||||
|
var CiderCastController = require('./castcontroller');
|
||||||
|
|
||||||
function CiderReceiver(client, session) {
|
function CiderReceiver(client, session) {
|
||||||
Application.apply(this, arguments);
|
Application.apply(this, arguments);
|
||||||
|
|
||||||
this.media = this.createController(MediaController);
|
this.media = this.createController(MediaController);
|
||||||
|
this.mediaReceiver = this.createController(CiderCastController);
|
||||||
|
|
||||||
this.media.on('status', onstatus);
|
this.media.on('status', onstatus);
|
||||||
|
|
||||||
|
@ -18,7 +20,7 @@ function CiderReceiver(client, session) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// FE96A351
|
||||||
CiderReceiver.APP_ID = '27E1334F';
|
CiderReceiver.APP_ID = '27E1334F';
|
||||||
|
|
||||||
util.inherits(CiderReceiver, Application);
|
util.inherits(CiderReceiver, Application);
|
||||||
|
@ -67,4 +69,8 @@ CiderReceiver.prototype.queueUpdate = function(items, callback) {
|
||||||
this.media.queueUpdate.apply(this.media, arguments);
|
this.media.queueUpdate.apply(this.media, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CiderReceiver.prototype.sendIp = function(opts){
|
||||||
|
this.mediaReceiver.sendIp.apply(this.mediaReceiver, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = CiderReceiver;
|
module.exports = CiderReceiver;
|
||||||
|
|
|
@ -178,6 +178,10 @@ export default class ChromecastPlugin {
|
||||||
client.stepInterval = status.volume.stepInterval;
|
client.stepInterval = status.volume.stepInterval;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// send websocket ip
|
||||||
|
|
||||||
|
player.sendIp("ws://"+this.getIp()+":26369");
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue