Skip to content

Commit 836b9a0

Browse files
committed
chore: docs
1 parent a1c7ead commit 836b9a0

File tree

1 file changed

+44
-0
lines changed
  • packages/documentation/docs/for-developers/device-integrations

1 file changed

+44
-0
lines changed

packages/documentation/docs/for-developers/device-integrations/tsr-plugins.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,47 @@ FROM sofietv/tv-automation-playout-gateway:release53
7878
ENV TSR_PLUGIN_PATHS=/opt/tsr-plugin-example
7979
COPY --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.

0 commit comments

Comments
 (0)