small improvements
This commit is contained in:
parent
49d584e989
commit
3c37537365
25
lib/timec.js
25
lib/timec.js
@ -35,9 +35,12 @@ class FrameTime {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
get milliseconds() {
|
||||
@ -90,12 +93,27 @@ class Timecode {
|
||||
vlcUpdate(vlc) {
|
||||
if (!vlc.is_playing) {
|
||||
this.stop();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
this.startTime = new Date().getTime() - vlc.time;
|
||||
this.filePlaying = vlc.file;
|
||||
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 = {};
|
||||
data.time = new FrameTime(d);
|
||||
data.track = this.activeTrack.id;
|
||||
data.filePlaying = this.filePlaying;
|
||||
ios.emit("update", data);
|
||||
}
|
||||
update(time) {
|
||||
var d = new Date().getTime() - this.startTime;
|
||||
@ -137,7 +155,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) => {
|
||||
@ -191,6 +209,7 @@ ios.on("connection", socket => {
|
||||
});
|
||||
socket.on("stop", () => {
|
||||
timecode.stop();
|
||||
if (timecode.activeTrack)
|
||||
timecode.loadTrack(timecode.activeTrack.id);
|
||||
});
|
||||
socket.on("create", (data) => {
|
||||
|
File diff suppressed because one or more lines are too long
25
src/timec.ts
25
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,6 +251,7 @@ ios.on("connection", socket=>{
|
||||
});
|
||||
socket.on("stop", ()=>{
|
||||
timecode.stop();
|
||||
if(timecode.activeTrack)
|
||||
timecode.loadTrack(timecode.activeTrack.id);
|
||||
});
|
||||
socket.on("create", (data)=>{
|
||||
|
Loading…
Reference in New Issue
Block a user