small improvements
This commit is contained in:
27
src/timec.ts
27
src/timec.ts
@ -35,8 +35,10 @@ class FrameTime{
|
||||
this.lminutes = millis.minutes;
|
||||
this.lhours = millis.hours;
|
||||
this.calcMillis();
|
||||
} else if(Number.isInteger(millis.milliseconds)){
|
||||
} else if(Number.isInteger(Number(millis.milliseconds))){
|
||||
this.milliseconds = millis.milliseconds;
|
||||
} else if(Number.isInteger(Number(millis.lmilliseconds))){
|
||||
this.milliseconds = millis.lmilliseconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -111,11 +113,27 @@ class Timecode {
|
||||
vlcUpdate(vlc:VlcUpdate) {
|
||||
if(!vlc.is_playing){
|
||||
this.stop();
|
||||
return;
|
||||
} else {
|
||||
this.startTime = new Date().getTime() - vlc.time;
|
||||
this.filePlaying = vlc.file;
|
||||
console.log("vlc_update", vlc);
|
||||
//console.log("vlc_update", vlc);
|
||||
}
|
||||
var d = vlc.time;
|
||||
this.toTrigger.forEach(e=>{
|
||||
if(e.time.milliseconds <= d) {
|
||||
console.log(e);
|
||||
ios.emit("artnet", e.art);
|
||||
artnet.set(universe, e.art.subnet)
|
||||
var i = this.toTrigger.indexOf(e);
|
||||
this.toTrigger.splice(i, 1);
|
||||
}
|
||||
});
|
||||
var data:any = {};
|
||||
data.time = new FrameTime(d);
|
||||
data.track = this.activeTrack.id;
|
||||
data.filePlaying = this.filePlaying;
|
||||
ios.emit("update", data);
|
||||
}
|
||||
|
||||
update(time:FrameTime) {
|
||||
@ -159,7 +177,7 @@ class Timecode {
|
||||
ioClient.emit("play", {file:this.filePlaying});
|
||||
ioClient.on("playing", ()=>{
|
||||
this.startTime = new Date().getTime();
|
||||
this.interval = setInterval(this.update.bind(this), 1000/25);
|
||||
//this.interval = setInterval(this.update.bind(this), 1000/25);
|
||||
this.playing = true;
|
||||
});
|
||||
ioClient.on("update", (data)=>{
|
||||
@ -233,7 +251,8 @@ ios.on("connection", socket=>{
|
||||
});
|
||||
socket.on("stop", ()=>{
|
||||
timecode.stop();
|
||||
timecode.loadTrack(timecode.activeTrack.id);
|
||||
if(timecode.activeTrack)
|
||||
timecode.loadTrack(timecode.activeTrack.id);
|
||||
});
|
||||
socket.on("create", (data)=>{
|
||||
var track = new Track();
|
||||
|
Reference in New Issue
Block a user