Sound.AudioClip

Description: Defines a single audio clip that can be played, stopped or paused.

Implements: EndGate.IDisposable

Constructors

AudioClip (source)
Creates a new instance of the AudioClip object.

source: HTMLAudioElement
An audio element to use as the source audio clip.

AudioClip (source)
Creates a new instance of the AudioClip object.

source: string[]
An array of source paths to audio clips. Pass in multiple audio types of the same clip to ensure cross browser compatibility.

AudioClip (source)
Creates a new instance of the AudioClip object.

source: string
Source path to an audio clip.

AudioClip (source, settings)
Creates a new instance of the AudioClip object.

source: string
Source path to an audio clip.

settings: Sound.AudioSettings
Audio clip settings.

AudioClip (source, settings)
Creates a new instance of the AudioClip object.

source: string[]
An array of source paths to audio clips. Pass in multiple audio types of the same clip to ensure cross browser compatibility.

settings: Sound.AudioSettings
Audio clip settings.

AudioClip (source, settings)
Creates a new instance of the AudioClip object.

source: HTMLAudioElement
An audio element to use as the source audio clip.

settings: Sound.AudioSettings
Audio clip settings.

Fields

OnComplete: EndGate.EventHandler1 <Event>
Gets an event that is triggered when the audio clip has completed, will not trigger if the audio clip is repeating. Functions can be bound or unbound to this event to be executed when the event triggers.

Volume: number
Gets or sets the audio clip volume.

Methods

IsPlaying()
Determines if the AudioClip is currently playing.

IsComplete()
Determines if the AudioClip has completed.

Play()
Plays the current audio clip.

Pause()
Pauses the current audio clip.

Seek()
Seeks the audio clip to the provided time.

Stop()
Stops the current audio clip and seeks back to time 0.

Dispose()
Unbinds all events and nulls out the settings and audio component to allow for garbage collection.

Examples

There's currently no example available for this page. If you'd like to suggest one send me an containing a description, code, and link to the page for the suggested example. As a thanks I'll associate the code snippet with your name directly below the example if approved.