diff --git a/packages/quick-tsr/input/devices.ts b/packages/quick-tsr/input/devices.ts index 585c26dcb..e9b8087d0 100644 --- a/packages/quick-tsr/input/devices.ts +++ b/packages/quick-tsr/input/devices.ts @@ -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', }, }, }, diff --git a/packages/quick-tsr/input/mappings.ts b/packages/quick-tsr/input/mappings.ts index 3d72fcca6..75b9c3105 100644 --- a/packages/quick-tsr/input/mappings.ts +++ b/packages/quick-tsr/input/mappings.ts @@ -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' @@ -13,5 +20,38 @@ export const input: TSRInput = { layer: 10, }, }), + + obsLayer0: literal>({ + device: DeviceType.OBS, + deviceId: 'obs0', + options: { + mappingType: MappingObsType.CurrentScene, + }, + }), + obsLayerAudio: literal>({ + device: DeviceType.OBS, + deviceId: 'obs0', + options: { + mappingType: MappingObsType.InputAudio, + input: 'Media Source', + }, + }), + obsLayerMedia: literal>({ + device: DeviceType.OBS, + deviceId: 'obs0', + options: { + mappingType: MappingObsType.InputMedia, + input: 'Media Source', + }, + }), + obsLayerSceneItem: literal>({ + device: DeviceType.OBS, + deviceId: 'obs0', + options: { + mappingType: MappingObsType.SceneItem, + sceneName: 'Scene 1', + source: 'Image', + }, + }), }, } diff --git a/packages/quick-tsr/input/timeline.ts b/packages/quick-tsr/input/timeline.ts index d7f02e00f..4a543613e 100644 --- a/packages/quick-tsr/input/timeline.ts +++ b/packages/quick-tsr/input/timeline.ts @@ -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' @@ -82,5 +85,148 @@ export const input: TSRInput = { ], */ }), + + literal>({ + 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>({ + 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>({ + 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>({ + 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>({ + 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>({ + 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>({ + 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>({ + 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, + }, + }), + ], + }), ], }