mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 01:13:55 +00:00
Feat/studio clock (#60)
This commit is contained in:
@@ -63,6 +63,7 @@ export class EventTimer extends Timer {
|
||||
nextPublicEventId = null;
|
||||
numEvents = null;
|
||||
_eventlist = null;
|
||||
onAir = false;
|
||||
|
||||
constructor(httpServer, oscClient, config) {
|
||||
// call super constructor
|
||||
@@ -199,7 +200,7 @@ export class EventTimer extends Timer {
|
||||
// send current timer
|
||||
broadcastTimer() {
|
||||
// through websockets
|
||||
this.io.emit('timer', this.getObject());
|
||||
this.io.emit('timer', this.getTimes());
|
||||
|
||||
// through OSC, only if running
|
||||
if (this.state === 'start' || this.state === 'roll') {
|
||||
@@ -211,7 +212,7 @@ export class EventTimer extends Timer {
|
||||
|
||||
// broadcast state
|
||||
broadcastState(update = true) {
|
||||
this.io.emit('timer', this.getObject(update));
|
||||
this.io.emit('timer', this.getTimes(update));
|
||||
this.io.emit('playstate', this.state);
|
||||
this.io.emit('selected', {
|
||||
id: this.selectedEventId,
|
||||
@@ -224,6 +225,7 @@ export class EventTimer extends Timer {
|
||||
this.io.emit('publicnext-id', this.nextPublicEventId);
|
||||
this.io.emit('titles', this.titles);
|
||||
this.io.emit('publictitles', this.titlesPublic);
|
||||
this.io.emit('onAir', this.onAir);
|
||||
}
|
||||
|
||||
// broadcast message
|
||||
@@ -359,7 +361,7 @@ export class EventTimer extends Timer {
|
||||
);
|
||||
|
||||
// send state
|
||||
socket.emit('timer', this.getObject());
|
||||
socket.emit('timer', this.getTimes());
|
||||
socket.emit('playstate', this.state);
|
||||
socket.emit('selected-id', this.selectedEventId);
|
||||
socket.emit('next-id', this.nextEventId);
|
||||
@@ -385,7 +387,7 @@ export class EventTimer extends Timer {
|
||||
/*******************************************/
|
||||
// general playback state
|
||||
socket.on('get-state', () => {
|
||||
socket.emit('timer', this.getObject());
|
||||
socket.emit('timer', this.getTimes());
|
||||
socket.emit('playstate', this.state);
|
||||
socket.emit('selected-id', this.selectedEventId);
|
||||
socket.emit('next-id', this.nextEventId);
|
||||
@@ -400,7 +402,7 @@ export class EventTimer extends Timer {
|
||||
});
|
||||
|
||||
socket.on('get-timer', () => {
|
||||
socket.emit('timer', this.getObject());
|
||||
socket.emit('timer', this.getTimes());
|
||||
});
|
||||
|
||||
socket.on('increment-timer', (data) => {
|
||||
@@ -419,6 +421,15 @@ export class EventTimer extends Timer {
|
||||
socket.emit('playstate', this.state);
|
||||
});
|
||||
|
||||
socket.on('set-onAir', (data) => {
|
||||
this.onAir = data;
|
||||
this.broadcastThis('onAir', this.onAir);
|
||||
});
|
||||
|
||||
socket.on('get-onAir', () => {
|
||||
socket.emit('onAir', this.onAir);
|
||||
});
|
||||
|
||||
/*******************************************/
|
||||
// selection data
|
||||
socket.on('get-selected', () => {
|
||||
@@ -949,6 +960,14 @@ export class EventTimer extends Timer {
|
||||
`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Set onAir property of timer
|
||||
* @param {boolean} onAir - whether flag is active
|
||||
*/
|
||||
set onAir(onAir) {
|
||||
this.onAir = onAir;
|
||||
}
|
||||
|
||||
start() {
|
||||
// if there is nothing selected, no nothing
|
||||
if (this.selectedEventId == null) return;
|
||||
|
||||
Reference in New Issue
Block a user