Properties:
Name | Type | Description |
---|---|---|
id |
number |
Auto-incrementing ID for the instance. |
loop |
boolean |
If the current instance is set to loop |
muted |
boolean |
Set the muted state of the instance |
paused |
boolean |
If the instance is paused, if the sound or global context is paused, this could still be false. |
progress |
number |
Current progress of the sound from 0 to 1 |
speed |
number |
Current speed of the instance. This is not the actual speed since it takes into account the global context and the sound volume. |
volume |
number |
Current volume of the instance. This is not the actual volume since it takes into account the global context and the sound volume. |
Members
Auto-incrementing ID for the instance.
If the current instance is set to loop
Set the muted state of the instance
If the instance is paused, if the sound or global context is paused, this could still be false.
Current progress of the sound from 0 to 1
Current speed of the instance. This is not the actual speed since it takes into account the global context and the sound volume.
Current volume of the instance. This is not the actual volume since it takes into account the global context and the sound volume.
Methods
Fired when the sound when progress updates.
Name | Type | Description |
---|---|---|
name |
"speed" | "volume" | "muted" | "loop" | "paused" |
Name of property. |
value |
number | boolean |
The total number of seconds of audio |
Returns:
Type | Description |
---|---|
this |
Example
import { sound } from '@pixi/sound';
sound.play('foo')
.set('volume', 0.5)
.set('speed', 0.8);
Stop the current instance from playing.
Events
Fired when the sound finishes playing.
Fired when paused state changes.
Name | Type | Description |
---|---|---|
paused |
boolean |
If the current state is paused |
Fired when instance is paused.
Fired when the sound when progress updates.
Name | Type | Description |
---|---|---|
progress |
number |
Playback progress from 0 to 1 |
duration |
number |
The total number of seconds of audio |
Fired when instance is resumed.
Fired when the sound starts playing.
The sound is stopped. Don't use after this is called.