-
Notifications
You must be signed in to change notification settings - Fork 19
/
Youtube.js
51 lines (36 loc) · 1.25 KB
/
Youtube.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var util = require('util');
var castv2Cli = require('castv2-client');
var Application = castv2Cli.Application;
var MediaController = castv2Cli.MediaController;
var YoutubeController = require('./YoutubeController');
function Youtube(client, session) {
Application.apply(this, arguments);
this.media = this.createController(MediaController);
this.youtube = this.createController(YoutubeController);
this.media.on('status', onstatus);
var self = this;
function onstatus(status) {
self.emit('status', status);
}
}
Youtube.APP_ID = '233637DE';
util.inherits(Youtube, Application);
Youtube.prototype.getStatus = function(callback) {
this.media.getStatus.apply(this.media, arguments);
};
Youtube.prototype.load = function(videoId) {
this.youtube.load.apply(this.youtube, arguments);
};
Youtube.prototype.play = function(callback) {
this.media.play.apply(this.media, arguments);
};
Youtube.prototype.pause = function(callback) {
this.media.pause.apply(this.media, arguments);
};
Youtube.prototype.stop = function(callback) {
this.media.stop.apply(this.media, arguments);
};
Youtube.prototype.seek = function(currentTime, callback) {
this.media.seek.apply(this.media, arguments);
};
module.exports = Youtube;