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.lhours = millis.hours;
|
||||||
this.calcMillis();
|
this.calcMillis();
|
||||||
}
|
}
|
||||||
else if (Number.isInteger(millis.milliseconds)) {
|
else if (Number.isInteger(Number(millis.milliseconds))) {
|
||||||
this.milliseconds = millis.milliseconds;
|
this.milliseconds = millis.milliseconds;
|
||||||
}
|
}
|
||||||
|
else if (Number.isInteger(Number(millis.lmilliseconds))) {
|
||||||
|
this.milliseconds = millis.lmilliseconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get milliseconds() {
|
get milliseconds() {
|
||||||
@ -90,12 +93,27 @@ class Timecode {
|
|||||||
vlcUpdate(vlc) {
|
vlcUpdate(vlc) {
|
||||||
if (!vlc.is_playing) {
|
if (!vlc.is_playing) {
|
||||||
this.stop();
|
this.stop();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.startTime = new Date().getTime() - vlc.time;
|
this.startTime = new Date().getTime() - vlc.time;
|
||||||
this.filePlaying = vlc.file;
|
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) {
|
update(time) {
|
||||||
var d = new Date().getTime() - this.startTime;
|
var d = new Date().getTime() - this.startTime;
|
||||||
@ -137,7 +155,7 @@ class Timecode {
|
|||||||
ioClient.emit("play", { file: this.filePlaying });
|
ioClient.emit("play", { file: this.filePlaying });
|
||||||
ioClient.on("playing", () => {
|
ioClient.on("playing", () => {
|
||||||
this.startTime = new Date().getTime();
|
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;
|
this.playing = true;
|
||||||
});
|
});
|
||||||
ioClient.on("update", (data) => {
|
ioClient.on("update", (data) => {
|
||||||
@ -191,6 +209,7 @@ ios.on("connection", socket => {
|
|||||||
});
|
});
|
||||||
socket.on("stop", () => {
|
socket.on("stop", () => {
|
||||||
timecode.stop();
|
timecode.stop();
|
||||||
|
if (timecode.activeTrack)
|
||||||
timecode.loadTrack(timecode.activeTrack.id);
|
timecode.loadTrack(timecode.activeTrack.id);
|
||||||
});
|
});
|
||||||
socket.on("create", (data) => {
|
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.lminutes = millis.minutes;
|
||||||
this.lhours = millis.hours;
|
this.lhours = millis.hours;
|
||||||
this.calcMillis();
|
this.calcMillis();
|
||||||
} else if(Number.isInteger(millis.milliseconds)){
|
} else if(Number.isInteger(Number(millis.milliseconds))){
|
||||||
this.milliseconds = 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) {
|
vlcUpdate(vlc:VlcUpdate) {
|
||||||
if(!vlc.is_playing){
|
if(!vlc.is_playing){
|
||||||
this.stop();
|
this.stop();
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
this.startTime = new Date().getTime() - vlc.time;
|
this.startTime = new Date().getTime() - vlc.time;
|
||||||
this.filePlaying = vlc.file;
|
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) {
|
update(time:FrameTime) {
|
||||||
@ -159,7 +177,7 @@ class Timecode {
|
|||||||
ioClient.emit("play", {file:this.filePlaying});
|
ioClient.emit("play", {file:this.filePlaying});
|
||||||
ioClient.on("playing", ()=>{
|
ioClient.on("playing", ()=>{
|
||||||
this.startTime = new Date().getTime();
|
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;
|
this.playing = true;
|
||||||
});
|
});
|
||||||
ioClient.on("update", (data)=>{
|
ioClient.on("update", (data)=>{
|
||||||
@ -233,6 +251,7 @@ ios.on("connection", socket=>{
|
|||||||
});
|
});
|
||||||
socket.on("stop", ()=>{
|
socket.on("stop", ()=>{
|
||||||
timecode.stop();
|
timecode.stop();
|
||||||
|
if(timecode.activeTrack)
|
||||||
timecode.loadTrack(timecode.activeTrack.id);
|
timecode.loadTrack(timecode.activeTrack.id);
|
||||||
});
|
});
|
||||||
socket.on("create", (data)=>{
|
socket.on("create", (data)=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user