new TrackPlayer(options)
This class handles the playback of sound tracks.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
- To Do:
-
- stopTime is currently not implemented (tracks will play from startTime to finish)
- stereo is currently not implemented
Extends
- SoundPlayer
Methods
(static) accept() → {Object|undefined}
Determine whether this player can play the given sound.
Parameters:
Type | Description |
---|---|
module:sound.Sound | the sound |
- Source:
Returns:
an instance of TrackPlayer that can play the given sound or undefined otherwise
- Type
- Object | undefined
getDuration() → {number}
Get the duration of the sound, in seconds.
- Source:
Returns:
the duration of the track, in seconds
- Type
- number
play(loops)
Start playing the sound.
Parameters:
Name | Type | Description |
---|---|---|
loops |
number | how many times to repeat the track after it has played once. If loops == -1, the track will repeat indefinitely until stopped. |
- Source:
setLoops(loops)
Set the number of loops.
Parameters:
Name | Type | Description |
---|---|---|
loops |
number | how many times to repeat the track after it has played once. If loops == -1, the track will repeat indefinitely until stopped. |
- Source:
setVolume(volume, muteopt)
Set the volume of the tone.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
volume |
Integer | the volume of the track (must be between 0 and 1.0) | ||
mute |
booleam |
<optional> |
false | whether or not to mute the track |
- Source:
stop()
Stop playing the sound immediately.
- Source: