Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AudioClip

The audio clip asset.
'started' event is emitted once the audio began to play.
'ended' event is emitted once the audio stopped.
Low-level platform-specific details are handled independently inside each clip.

Hierarchy

Index

Constructors

constructor

Properties

__asyncLoadAssets__

__asyncLoadAssets__: boolean = false

__depends__

__depends__: any = null

__nativeDepend__

__nativeDepend__: any = null

__onLoadedInvoked__

__onLoadedInvoked__: boolean = false

Protected _duration

_duration: number = 0

Protected _loadMode

_loadMode: number = AudioType.UNKNOWN_AUDIO

_native

_native: string = ""

Serializable url for native asset. For internal usage.

default

""

Protected _nativeAudio

_nativeAudio: any = null

_nativeUrl

_nativeUrl: string = ""

Protected _player

_player: AudioPlayer | null = null

_uuid

_uuid: string

loaded

loaded: boolean = true

Whether the asset is loaded or not

Static AudioType

AudioType: { DOM_AUDIO: number; JSB_AUDIO: number; UNKNOWN_AUDIO: number; WEB_AUDIO: number } = AudioType

Type declaration

  • DOM_AUDIO: number
  • JSB_AUDIO: number
  • UNKNOWN_AUDIO: number
  • WEB_AUDIO: number

Static PlayingState

PlayingState: { INITIALIZING: number; PLAYING: number; STOPPED: number } = PlayingState

Type declaration

  • INITIALIZING: number
  • PLAYING: number
  • STOPPED: number

Static preventDeferredLoadDependents

preventDeferredLoadDependents: boolean = true

Static preventPreloadNativeObject

preventPreloadNativeObject: boolean = false

Indicates whether its native object should be preloaded from native url.

default

false

Accessors

nativeAsset

  • get nativeAsset(): any
  • set nativeAsset(nativeAudio: any): void

nativeDep

  • get nativeDep(): { __isNative__: boolean; audioLoadMode: number; ext: string; uuid: string }

loadMode

  • get loadMode(): number

nativeUrl

  • get nativeUrl(): string

refCount

  • get refCount(): number

state

  • get state(): number

Methods

Private getPlayer

  • getPlayer(clip: any): {}

Private setRawAsset

  • setRawAsset(filename: string, inLibrary?: boolean): void

addRef

Optional createNode

decRef

  • decRef(autoRelease?: boolean): Asset

destroy

  • destroy(): any

getCurrentTime

  • getCurrentTime(): number

getDuration

  • getDuration(): number

getLoop

  • getLoop(): boolean

getVolume

  • getVolume(): number

onLoaded

  • onLoaded(): void

pause

  • pause(): void

play

  • play(): void

playOneShot

  • playOneShot(volume: number): void

Private serialize

  • serialize(): void

setCurrentTime

  • setCurrentTime(val: number): void

setLoop

  • setLoop(val: boolean): void

setVolume

  • setVolume(val: number, immediate?: undefined | false | true): void

stop

  • stop(): void

toString

  • toString(): string
  • Returns the string representation of the object.
    The Asset object overrides the toString() method of the Object object.
    JavaScript calls the toString() method automatically
    when an asset is to be represented as a text value or when a texture is referred to in a string concatenation.

    For assets of the native type, it will return this.nativeUrl.
    Otherwise, an empty string is returned.
    This method may be overwritten by subclasses.

    method

    toString

    Returns string

Static deserialize

  • deserialize(data: any): any

Generated using TypeDoc