Skip to content

Commit 1dfdaad

Browse files
author
Mint de Wit
committed
chore: add playlist timings to LSG
1 parent e26a3d2 commit 1dfdaad

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

packages/live-status-gateway/api/schemas/activePlaylist.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,32 @@ $defs:
2929
$ref: '#/$defs/part'
3030
publicData:
3131
description: Optional arbitrary data
32-
required: [event, id, name, rundownIds, currentPart, currentSegment, nextPart]
32+
timing:
33+
description: Timing information about the active playlist
34+
type: object
35+
properties:
36+
timingMode:
37+
description: 'Timing mode for the playlist.'
38+
type: string
39+
enum:
40+
- none
41+
- forward-time
42+
- back-time
43+
startedPlayback:
44+
description: Unix timestamp of when the playlist started (milliseconds)
45+
type: number
46+
expectedStart:
47+
description: Unix timestamp of when the playlist is expected to start (milliseconds). Required when the timingMode is set to forward-time.
48+
type: number
49+
expectedDuration:
50+
description: Duration of the playlist in ms
51+
type: number
52+
expectedEnd:
53+
description: Unix timestamp of when the playlist is expected to end (milliseconds) Required when the timingMode is set to back-time.
54+
type: number
55+
required: [timingMode]
56+
additionalProperties: false
57+
required: [event, id, name, rundownIds, currentPart, currentSegment, nextPart, timing]
3358
additionalProperties: false
3459
examples:
3560
- event: activePlaylist
@@ -44,6 +69,10 @@ $defs:
4469
$ref: '#/$defs/part/examples/0'
4570
publicData:
4671
category: 'Evening News'
72+
timing:
73+
timingMode: 'forward-time'
74+
expectedStart: 1728895750727
75+
duration: 180000
4776
partBase:
4877
type: object
4978
properties:

packages/live-status-gateway/src/topics/activePlaylistTopic.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import _ = require('underscore')
1515
import { PartTiming, calculateCurrentPartTiming } from './helpers/partTiming'
1616
import { SelectedPieceInstances, PieceInstancesHandler, PieceInstanceMin } from '../collections/pieceInstancesHandler'
1717
import { PieceStatus, toPieceStatus } from './helpers/pieceStatus'
18+
import { PlaylistTimingType } from '@sofie-automation/blueprints-integration'
1819

1920
const THROTTLE_PERIOD_MS = 100
2021

@@ -45,6 +46,13 @@ export interface ActivePlaylistStatus {
4546
currentSegment: CurrentSegmentStatus | null
4647
nextPart: PartStatus | null
4748
publicData: unknown
49+
timing: {
50+
timingMode: PlaylistTimingType
51+
startedPlayback?: number
52+
expectedStart?: number
53+
expectedDuration?: number
54+
expectedEnd?: number
55+
}
4856
}
4957

5058
export class ActivePlaylistTopic
@@ -141,6 +149,19 @@ export class ActivePlaylistTopic
141149
})
142150
: null,
143151
publicData: this._activePlaylist.publicData,
152+
timing: {
153+
timingMode: this._activePlaylist.timing.type,
154+
startedPlayback: this._activePlaylist.startedPlayback,
155+
expectedDuration: this._activePlaylist.timing.expectedDuration,
156+
expectedStart:
157+
this._activePlaylist.timing.type !== PlaylistTimingType.None
158+
? this._activePlaylist.timing.expectedStart
159+
: undefined,
160+
expectedEnd:
161+
this._activePlaylist.timing.type !== PlaylistTimingType.None
162+
? this._activePlaylist.timing.expectedEnd
163+
: undefined,
164+
},
144165
})
145166
: literal<ActivePlaylistStatus>({
146167
event: 'activePlaylist',
@@ -151,6 +172,9 @@ export class ActivePlaylistTopic
151172
currentSegment: null,
152173
nextPart: null,
153174
publicData: undefined,
175+
timing: {
176+
timingMode: PlaylistTimingType.None,
177+
},
154178
})
155179

156180
this.sendMessage(subscribers, message)

0 commit comments

Comments
 (0)