Audiocomponent

AudioComponent class

Audio component, used to play audio in the game

See AudioComponentData for the data schema used to create an audio component

Signature:

export declare class AudioComponent extends Component3D<AudioComponentData> 

Extends: Component3D<AudioComponentData>

Properties

Property

Modifiers

Type

Description

_changeCallbacks

protected

{ volume: (value: any) => void; loop: (value: any) => void; playbackRate: (value: any) => void; autoPlay: (value: any) => void; }

ambient

boolean

weather the audio is used to play a background music. Defaults to false

autoPlay

boolean

isPlaying

readonly

boolean

Returns true if the audio is playing

loop

boolean

Whether the audio should loop. Defaults to false

playbackRate

number

audio playback rate. Defaults to 1

volume

number

Volume of the audio, from 0 to 1. Defaults to 1

Methods

Method

Modifiers

Description

_pauseTrigger()

protected

_playTrigger()

protected

dispose()

protected

init()

protected

pause()

pause the audio

play()

play the audio

stop()

stop the audio, this will reset the audio to the beginning