Skip to main content

SceneItem <TSource, TScene>

Represents an item of a source in OBS. Creation of a SceneItem assumes that the item already exists in OBS. It’s the responsibility of the caller (probably a Source) to ensure that the item has been created. SceneItems are for accessing already existing items.

Hierarchy

Index

Constructors

constructor

  • new SceneItem<TSource, TScene>(source: TSource, scene: TScene, id: number, ref: string): SceneItem<TSource, TScene>
  • Type parameters

    Parameters

    • source: TSource
    • scene: TScene
    • id: number
    • ref: string

    Returns SceneItem<TSource, TScene>

Properties

enabled

enabled: boolean = true

publicid

id: number

locked

locked: boolean = false

publicref

ref: string

publicscene

scene: TScene

publicsource

source: TSource

transform

transform: SceneItemTransform = ...

Methods

fetchProperties

  • fetchProperties(): Promise<void>
  • Fetches the item’s transform, enabled, and locked properties and assigns them to the item.


    Returns Promise<void>

remove

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

setEnabled

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

    • enabled: boolean

    Returns Promise<void>

setLocked

  • setLocked(locked: boolean): Promise<void>
  • Parameters

    • locked: boolean

    Returns Promise<void>

setTransform

updateSizeFromSource

  • updateSizeFromSource(sourceWidth?: number, sourceHeight?: number): void
  • Some sources have custom settings for width and height. Thus, sourceWidth and sourceHeight for their scene items can change. This method reassigns these values and calculates properties.width and properties.height as a product of the source dimensions and item scale.


    Parameters

    • optionalsourceWidth: number
    • optionalsourceHeight: number

    Returns void