new Sound(name, url, options)
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Name of the sound |
url |
string | URL of the sound |
options |
Sound#ConstructorOptions |
Properties:
| Name | Type | Description |
|---|---|---|
isPlaying |
boolean | Whether the Sound is currently playing audio. |
name |
string | Name of the sound |
url |
string | URL of the sound |
audioContext |
AudioContext | The AudioContext to use if available for AudioPlayer. |
Methods
play()
Start playing the sound. Will stop the currently playing sound first.
setSinkIds()
Update the sinkIds of the audio output devices this sound should play through.
stop() → {void}
Stop playing the sound.
Returns:
- Type
- void
Type Definitions
ConstructorOptions
Type:
- Object
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
maxDuration |
number |
<optional> |
0 | The maximum length of time to play the sound before stopping it. |
shouldLoop |
Boolean |
<optional> |
false | Whether the sound should be looped. |