Skip to main content

mocks

Index

Classes

MockFilter

MockFilter<TSource>:

Type parameters

constructor

  • new MockFilter<TSource>(args: CustomFilterArgs<MockFilterSettings>): MockFilter<TSource>
  • Type parameters

    Parameters

    Returns MockFilter<TSource>

enabled

enabled: boolean

kind

kind: string

name

name: string

ref

ref: string

settings

settings: { a?: number; b?: string } = ...

Type declaration

  • optionala?: number
  • optionalb?: string

source

source: TSource

getDefaultSettings

  • getDefaultSettings(): Promise<Settings>
  • Returns Promise<Settings>

remove

  • remove(): Promise<void>
  • Returns Promise<void>

setEnabled

  • setEnabled(enabled: boolean): Promise<void>
  • Parameters

    • enabled: boolean

    Returns Promise<void>

setSettings

  • setSettings(settings: { a?: number; b?: string }, overlay?: boolean): Promise<void>
  • Parameters

    • settings: { a?: number; b?: string }
    • overlay: boolean = true

    Returns Promise<void>

MockInput

MockInput<F>:

Type parameters

constructor

  • new MockInput<F>(args: CustomInputArgs<MockInputSettings, F>): MockInput<F>

audioMonitorType

audioMonitorType: MonitoringType = MonitoringType.None

audioSyncOffset

audioSyncOffset: number = 0

filters

filters: Filter<Settings, Source<{}>>[] = []

itemInstances

itemInstances: Set<SceneItem<Source<{}>, Scene<{}, {}>>> = ...

kind

kind: string

linked

linked: boolean = false

muted

muted: boolean = false

name

name: string

obs

obs: OBS

settings

settings: { a?: number; b?: string } = ...

Set transitively in initialize if source exists Set manually in createFirstSceneItem if source doesn’t exist


Type declaration

  • optionala?: number
  • optionalb?: string

volume

volume: { db?: number; mul?: number } = ...

Type declaration

  • db: number
  • mul: number

exists

  • get exists(): boolean
  • Whether this source has at least one scene item in OBS


    Returns boolean

initialized

  • get initialized(): boolean
  • Whether initialize has been called on this source yet


    Returns boolean

addFilter

  • addFilter(ref: string, filter: Filter<Settings, Source<{}>>): Promise<void>
  • Adds a filter to this source, provided that 1. The filter has not already been applied to another source, and 2. The source in OBS does not have a filter with a different type but the same name as the filter being added.


    Parameters

    Returns Promise<void>

createSceneItemObject

  • createSceneItemObject(scene: Scene<{}, {}>, id: number, ref: string): SceneItem<MockInput<F>, Scene<{}, {}>>
  • Overridable function for creating SceneItem instances for a source. Doesn’t create any objects in OBS. Instead, creates SceneItem objects that can override default SceneItem behaviours.


    Parameters

    • scene: Scene<{}, {}>
    • id: number
    • ref: string

    Returns SceneItem<MockInput<F>, Scene<{}, {}>>

    An instance of SceneItem or a class that extends it.

fetchExists

  • fetchExists(): Promise<boolean>
  • Returns Promise<boolean>

fetchProperties

  • fetchProperties(): Promise<void>
  • Fetches the input’s mute, volume, audio sync offset and audio monitor type from OBS and assigns them to the input


    Returns Promise<void>

filter

  • filter<R>(ref: R): {}[R]
  • filter(ref: string): undefined | Filter<Settings, Source<{}>>
  • Gets a filter from the input by its ref


    Type parameters

    • R: never

    Parameters

    • ref: R

    Returns {}[R]

getDefaultSettings

  • getDefaultSettings(): Promise<MockInputSettings>
  • Returns Promise<MockInputSettings>

getPrivateSettings

  • getPrivateSettings(): Promise<Settings>
  • 8 Get a source’s private settings. This is an UNDOCUMENTED request of obs-websocket, and SHOULD NOT be used unless you know what you’re doing.


    Returns Promise<Settings>

initialize

  • initialize(obs: OBS): Promise<void>
  • Parameters

    Returns Promise<void>

remove

  • remove(): Promise<void>
  • Returns Promise<void>

setAudioMonitorType

  • Parameters

    Returns Promise<void>

setAudioSyncOffset

  • setAudioSyncOffset(offset: number): Promise<void>
  • Parameters

    • offset: number

    Returns Promise<void>

setMuted

  • setMuted(muted: boolean): Promise<void>
  • Parameters

    • muted: boolean

    Returns Promise<void>

setName

  • setName(name: string): Promise<void>
  • Parameters

    • name: string

    Returns Promise<void>

setPrivateSettings

  • setPrivateSettings(settings: Settings): Promise<void>
  • Set a source’s private settings. This is an UNDOCUMENTED request of obs-websocket, and SHOULD NOT be used unless you know what you’re doing.


    Parameters

    • settings: Settings

    Returns Promise<void>

setSettings

  • setSettings(settings: { a?: number; b?: string }, overlay?: boolean): Promise<void>
  • Parameters

    • settings: { a?: number; b?: string }
    • overlay: boolean = true

    Returns Promise<void>

setVolume

  • setVolume(data: { db?: number; mul?: number }): Promise<void>
  • Parameters

    • data: { db?: number; mul?: number }

    Returns Promise<void>

toggleMuted

  • toggleMuted(): Promise<boolean>
  • Returns Promise<boolean>

MockOBSWebSocket

MockOBSWebSocket:

constructor

  • new MockOBSWebSocket(): MockOBSWebSocket
  • Returns MockOBSWebSocket

obs

obs: OBS = ...

call

  • Type parameters

    • Type: keyof OBSRequestTypesOverrides | GetPersistentData | SetPersistentData | GetSceneCollectionList | SetCurrentSceneCollection | CreateSceneCollection | GetProfileList | SetCurrentProfile | CreateProfile | RemoveProfile | GetProfileParameter | SetProfileParameter | GetVideoSettings | SetVideoSettings | GetStreamServiceSettings | SetStreamServiceSettings | GetVersion | GetStats | BroadcastCustomEvent | CallVendorRequest | GetHotkeyList | TriggerHotkeyByName | TriggerHotkeyByKeySequence | Sleep | GetInputList | GetInputKindList | CreateInput | RemoveInput | SetInputName | GetInputDefaultSettings | GetInputSettings | SetInputSettings | GetInputMute | SetInputMute | ToggleInputMute | GetInputVolume | SetInputVolume | GetInputAudioSyncOffset | SetInputAudioSyncOffset | GetInputAudioMonitorType | GetInputPropertiesListPropertyItems | PressInputPropertiesButton | GetMediaInputStatus | SetMediaInputCursor | OffsetMediaInputCursor | TriggerMediaInputAction | GetRecordStatus | ToggleRecord | StartRecord | StopRecord | ToggleRecordPause | PauseRecord | ResumeRecord | GetRecordDirectory | GetSceneItemList | GetGroupItemList | GetSceneItemId | CreateSceneItem | RemoveSceneItem | DuplicateSceneItem | GetSceneItemTransform | GetSceneItemEnabled | SetSceneItemEnabled | GetSceneItemLocked | SetSceneItemLocked | GetSceneItemIndex | SetSceneItemIndex | GetSceneList | GetCurrentProgramScene | SetCurrentProgramScene | GetCurrentPreviewScene | SetCurrentPreviewScene | CreateScene | RemoveScene | SetSceneName | GetSourceActive | GetSourceScreenshot | SaveSourceScreenshot | GetStreamStatus | ToggleStream | StartStream | StopStream | GetTransitionKindList | GetSceneTransitionList | GetCurrentSceneTransition | SetCurrentSceneTransition | SetCurrentSceneTransitionDuration | SetCurrentSceneTransitionSettings | TriggerStudioModeTransition | GetStudioModeEnabled | SetStudioModeEnabled

    Parameters

    Returns Promise<Omit<OBSResponseTypes, keyof OBSResponseTypesOverrides> & OBSResponseTypesOverrides[Type]>

connect

  • connect(url: string, password: string, subscriptions: any): { rpcVersion?: number }
  • Parameters

    • url: string
    • password: string
    • subscriptions: any

    Returns { rpcVersion?: number }

    • rpcVersion: number

Interfaces

MockFilterSettings

MockFilterSettings:

a

a: number

b

b: string

MockInputSettings

MockInputSettings:

a

a: number

b

b: string