File tree Expand file tree Collapse file tree 3 files changed +50
-4
lines changed
blueprints-integration/src
documentation/docs/for-developers/device-integrations
shared-lib/src/core/model Expand file tree Collapse file tree 3 files changed +50
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export enum TimelineObjClassesCore {
1818
1919/** TimelineObject extension for additional fields needed by onTimelineGenerate */
2020export interface OnGenerateTimelineObj <
21- TContent extends { deviceType : TSR . DeviceType } ,
21+ TContent extends { deviceType : TSR . DeviceTypeExt } ,
2222 TMetadata = unknown ,
2323 TKeyframeMetadata = unknown ,
2424> extends TimelineObjectCoreExt < TContent , TMetadata , TKeyframeMetadata > {
Original file line number Diff line number Diff line change @@ -78,3 +78,47 @@ FROM sofietv/tv-automation-playout-gateway:release53
7878ENV TSR_PLUGIN_PATHS=/opt/tsr-plugin-example
7979COPY --from=0 /opt/tsr-plugin-example /opt/tsr-plugin-example
8080```
81+
82+ ## Using in Sofie blueprints
83+
84+ To use a TSR plugin in your blueprints, make sure you have your content types available in the blueprints.
85+
86+ You can create a file in your src folder such as ` tsr-types.d.ts ` with content being something like:
87+
88+ ``` ts
89+ import type { FakeDeviceType , TimelineContentFakeAny } from ' ./test-types.js'
90+
91+ declare module ' timeline-state-resolver-types' {
92+ interface TimelineContentMap {
93+ [FakeDeviceType ]: TimelineContentFakeAny
94+ }
95+ }
96+ ```
97+
98+ The ` FakeDeviceType ` should be defined as ` export const FakeDeviceType = 'fake' as const ` and should be used as the deviceType property of your types.
99+
100+ A minimal example of the types is:
101+
102+ ``` ts
103+ export const FakeDeviceType = ' fake' as const
104+
105+ export declare enum TimelineContentTypeFake {
106+ AUX = ' aux' ,
107+ }
108+
109+ export type TimelineContentFakeAny = TimelineContentFakeAUX
110+
111+ export interface TimelineContentFakeBase {
112+ deviceType: typeof FakeDeviceType
113+ type: TimelineContentTypeFake
114+ }
115+
116+ export interface TimelineContentFakeAUX extends TimelineContentFakeBase {
117+ type: TimelineContentTypeFake .AUX
118+ aux: {
119+ input: number
120+ }
121+ }
122+ ```
123+
124+ With this, all of the sofie timeline object and tsr types will accept your custom types as well as the default ones.
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export enum TimelineObjHoldMode {
3636}
3737
3838export interface TimelineObjectCoreExt <
39- TContent extends { deviceType : TSR . DeviceType } ,
39+ TContent extends { deviceType : TSR . DeviceTypeExt } ,
4040 TMetadata = unknown ,
4141 TKeyframeMetadata = unknown ,
4242> extends TSR . TSRTimelineObj < TContent > {
@@ -58,8 +58,10 @@ export interface TimelineObjectCoreExt<
5858 priority : number
5959}
6060
61- export interface TimelineKeyframeCoreExt < TContent extends { deviceType : TSR . DeviceType } , TKeyframeMetadata = unknown >
62- extends TSR . Timeline . TimelineKeyframe < Partial < TContent > > {
61+ export interface TimelineKeyframeCoreExt <
62+ TContent extends { deviceType : TSR . DeviceTypeExt } ,
63+ TKeyframeMetadata = unknown ,
64+ > extends TSR . Timeline . TimelineKeyframe < Partial < TContent > > {
6365 metaData ?: TKeyframeMetadata
6466 /** Whether to keep this keyframe when the object is copied for lookahead. By default all keyframes are removed */
6567 preserveForLookahead ?: boolean
You can’t perform that action at this time.
0 commit comments