Skip to main content

Audio

Hierarchy

  • BaseObject
    • Audio

Index

Constructors

publicconstructor

  • new Audio(source: string, volume?: number, radio?: boolean, clearCache?: boolean): Audio
  • Creates a new Audio instance.

Properties

publicreadonlycurrentTime

currentTime: number

publicreadonlyid

id: number

publicreadonlyisRemote

isRemote: boolean

Whether this entity was created clientside or serverside. (Clientside = false, Serverside = true).

publiclooped

looped: boolean

publicreadonlymaxTime

maxTime: number

publicreadonlyplaying

playing: boolean

publicreadonlyrefCount

refCount: number

Returns the ref count of the entity.

Remarks

It’s only available in debug-mode.

publicreadonlyremoteID

remoteID: number

The serverside id of this entity.

publicsource

source: string

publicreadonlytype

type: BaseObjectType

Type of the object.

publicreadonlyvalid

valid: boolean

Object usability.

Returns

False if object is no longer usable.

publicvolume

volume: number

publicstaticreadonlyall

all: readonly Audio[]

publicstaticreadonlycount

count: number

Methods

publicaddOutput

  • addOutput(output: AudioOutput): void
  • Remarks

    This method has no effect if the frontendPlay property returns true.

publicdeleteMeta

  • deleteMeta(key: string): void
  • deleteMeta<K>(key: K): void

publicdestroy

  • destroy(): void
  • Removes the object from the world.

publicgetMeta

  • getMeta<K>(key: Exclude<K, never>): unknown
  • getMeta<K>(key: K): undefined | ICustomAudioMeta[K]
  • getMeta<V>(key: string): undefined | V
  • Type parameters

    • K: string

publicgetMetaDataKeys

  • getMetaDataKeys(): readonly string[]

publicgetOutputs

  • getOutputs(): readonly (number | AudioOutput)[]
  • Remarks

    This method has no effect if the frontendPlay property returns true.

publicgetSyncedMeta

  • getSyncedMeta<K>(key: Exclude<K, never>): unknown
  • getSyncedMeta<K>(key: K): undefined | ICustomBaseObjectSyncedMeta[K]
  • getSyncedMeta<V>(key: string): undefined | V
  • Gets a value using the specified key.


    Type parameters

    • K: string

publicgetSyncedMetaKeys

  • getSyncedMetaKeys(): readonly string[]

publichasMeta

  • hasMeta(key: string): boolean
  • hasMeta<K>(key: K): boolean

publichasSyncedMeta

  • hasSyncedMeta(key: string): boolean
  • hasSyncedMeta<K>(key: K): boolean
  • Determines whether contains the specified key.

publicon

  • on(event: inited, callback: () => void): void
  • on(event: streamStarted, callback: () => void): void
  • on(event: streamEnded, callback: () => void): void
  • on(event: streamPaused, callback: () => void): void
  • on(event: streamReset, callback: () => void): void
  • on(event: streamSeek, callback: (time: number) => void): void
  • on(event: volumeChange, callback: (vol: number) => void): void
  • on(event: error, callback: (code: number, message: string) => void): void

publicpause

  • pause(): void

publicplay

  • play(): void

publicremoveOutput

  • removeOutput(output: AudioOutput): void
  • Remarks

    This method has no effect if the frontendPlay property returns true.

publicreset

  • reset(): void

publicseek

  • seek(time: number): void

publicsetMeta

  • setMeta<K>(key: K, value: InterfaceValueByKey<ICustomAudioMeta, K, unknown, void>): void
  • setMeta<K>(key: K, value: ICustomAudioMeta[K]): void
  • setMeta<V, K>(key: K, value: InterfaceValueByKey<ICustomAudioMeta, K, V, void>): void
  • Type parameters

    • K: string

publicstaticgetByID

  • getByID(id: number): null | Audio
  • Retrieves the audio from the pool.

publicstaticgetByRemoteID

  • getByRemoteID(type: BaseObjectType, id: number): null | BaseObject