-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.js
46 lines (36 loc) · 815 Bytes
/
index.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
var node_demux = require('./build/Release/node_demux');
var messages = [
"error",
"metadata",
"start",
"end",
"frame"
];
function demux() {
this.video = new node_demux.VideoDemux();
this.load = function(filename, options) {
if(options) this.video.LoadVideo(filename, options);
else this.video.LoadVideo(filename);
};
this.play = function() {
this.video.StartDemuxing();
};
this.nextFrame = function() {
this.video.DemuxFrame();
};
this.pause = function(cb) {
this.video.PauseDemuxing(cb);
};
this.stop = function(cb) {
this.video.StopDemuxing(cb);
};
this.seek = function(timestamp, cb) {
this.video.SeekVideo(timestamp, cb);
};
this.on = function(type, cb) {
if (messages.indexOf(type) >= 0) {
this.video.On(type, cb);
}
};
}
module.exports = demux;