Skip to content

Commit

Permalink
chore: quicktsr stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-dewit committed Jan 9, 2024
1 parent 870b08a commit bcd87a6
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 4 deletions.
14 changes: 11 additions & 3 deletions packages/quick-tsr/input/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ import { DeviceType } from 'timeline-state-resolver'

export const input: TSRInput = {
devices: {
caspar0: {
type: DeviceType.CASPARCG,
// caspar0: {
// type: DeviceType.CASPARCG,
// options: {
// host: '127.0.0.1',
// port: 5250,
// },
// },
obs0: {
type: DeviceType.OBS,
options: {
host: '127.0.0.1',
port: 5250,
port: 4455,
password: 'PT7WXMT3iRTUnche',
},
},
},
Expand Down
42 changes: 41 additions & 1 deletion packages/quick-tsr/input/mappings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { DeviceType, Mapping, MappingCasparCGType, SomeMappingCasparCG } from 'timeline-state-resolver'
import {
DeviceType,
Mapping,
MappingCasparCGType,
MappingObsType,
SomeMappingCasparCG,
SomeMappingObs,
} from 'timeline-state-resolver'
import { literal } from 'timeline-state-resolver/dist/lib'
import type { TSRInput } from '../src'

Expand All @@ -13,5 +20,38 @@ export const input: TSRInput = {
layer: 10,
},
}),

obsLayer0: literal<Mapping<SomeMappingObs>>({
device: DeviceType.OBS,
deviceId: 'obs0',
options: {
mappingType: MappingObsType.CurrentScene,
},
}),
obsLayerAudio: literal<Mapping<SomeMappingObs>>({
device: DeviceType.OBS,
deviceId: 'obs0',
options: {
mappingType: MappingObsType.InputAudio,
input: 'Media Source',
},
}),
obsLayerMedia: literal<Mapping<SomeMappingObs>>({
device: DeviceType.OBS,
deviceId: 'obs0',
options: {
mappingType: MappingObsType.InputMedia,
input: 'Media Source',
},
}),
obsLayerSceneItem: literal<Mapping<SomeMappingObs>>({
device: DeviceType.OBS,
deviceId: 'obs0',
options: {
mappingType: MappingObsType.SceneItem,
sceneName: 'Scene 1',
source: 'Image',
},
}),
},
}
146 changes: 146 additions & 0 deletions packages/quick-tsr/input/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import {
TimelineContentTypeCasparCg,
TimelineContentCCGMedia,
TSRTimelineObj,
TimelineContentOBSAny,
TimelineContentTypeOBS,
TSRTimelineKeyframe,
} from 'timeline-state-resolver'
import { TSRInput } from '../src'
import { literal } from 'timeline-state-resolver/dist/lib'
Expand Down Expand Up @@ -82,5 +85,148 @@ export const input: TSRInput = {
],
*/
}),

literal<TSRTimelineObj<TimelineContentOBSAny>>({
id: 'scene0',
disabled: true,
enable: {
start: Date.now(),
duration: 20 * 1000,
},
layer: 'obsLayer0',
content: {
deviceType: DeviceType.OBS,
type: TimelineContentTypeOBS.CURRENT_SCENE,

sceneName: 'Screen cap',
},
keyframes: [
literal<TSRTimelineKeyframe<TimelineContentOBSAny>>({
id: 'kf0',
enable: {
start: 0,
// end: Date.now() + 20 * 1000,
duration: 3 * 1000,
repeating: 6 * 1000,
},
content: {
deviceType: DeviceType.OBS,
type: TimelineContentTypeOBS.CURRENT_SCENE,

sceneName: 'Scene 1',
},
}),
],
}),

literal<TSRTimelineObj<TimelineContentOBSAny>>({
id: 'audio0',
disabled: true,
enable: {
start: Date.now(),
duration: 20 * 1000,
},
priority: 1,
layer: 'obsLayerAudio',
content: {
deviceType: DeviceType.OBS,
type: TimelineContentTypeOBS.INPUT_AUDIO,

volume: -10,
},
keyframes: [
literal<TSRTimelineKeyframe<TimelineContentOBSAny>>({
id: 'kf1',
enable: {
start: 0,
// end: Date.now() + 20 * 1000,
duration: 1 * 1000,
repeating: 2 * 1000,
},
content: {
deviceType: DeviceType.OBS,
type: TimelineContentTypeOBS.INPUT_AUDIO,

volume: 0,
},
}),
],
}),

literal<TSRTimelineObj<TimelineContentOBSAny>>({
id: 'sceneItem0',
disabled: true,
enable: {
start: Date.now(),
duration: 20 * 1000,
},
priority: 1,
layer: 'obsLayerSceneItem',
content: {
deviceType: DeviceType.OBS,
type: TimelineContentTypeOBS.SCENE_ITEM,

transform: {
positionX: 1176,
positionY: 388,
},
},
keyframes: [
literal<TSRTimelineKeyframe<TimelineContentOBSAny>>({
id: 'sceneItem0_kf1',
enable: {
start: 0,
// end: Date.now() + 20 * 1000,
duration: 1 * 1000,
repeating: 2 * 1000,
},
content: {
deviceType: DeviceType.OBS,
type: TimelineContentTypeOBS.SCENE_ITEM,

transform: {
positionX: 104,
positionY: 52,
},
},
}),
],
}),

literal<TSRTimelineObj<TimelineContentOBSAny>>({
id: 'media0',
disabled: false,
enable: {
start: Date.now() - 30 * 1000,
duration: 120 * 1000,
},
priority: 1,
layer: 'obsLayerMedia',
content: {
deviceType: DeviceType.OBS,
type: TimelineContentTypeOBS.INPUT_MEDIA,

state: 'paused',
},
keyframes: [
literal<TSRTimelineKeyframe<TimelineContentOBSAny>>({
id: 'media_kf0',
disabled: true,
enable: {
start: 1000,
// end: Date.now() + 20 * 1000,
// duration: 1 * 1000,
// repeating: 2 * 1000,
},
content: {
deviceType: DeviceType.OBS,
type: TimelineContentTypeOBS.INPUT_MEDIA,

// state: 'playing',
seek: 1,
},
}),
],
}),
],
}

0 comments on commit bcd87a6

Please sign in to comment.