The bgm to use
Whether to loop the bgm
(Default 0) The starting point of the loop, in seconds
PrivatedestroyedWhether this BGM has been evicted from memory.
Private ReadonlyendCallbacks registered via onEnd, awaiting the end of the track or destruction.
PrivateendedWhether this track has ended (either naturally or via destroy).
ReadonlykeyThe key for the audio file
Private ReadonlypendingOperations queued before the sound finished loading.
PrivatesoundThe underlying sound instance used to stream music.
Private Static ReadonlyrefMaps the number of active BGM objects for a particular key.
This will almost always be 1, but with i.e. paused/resumed music it may be more.
Whether this BGM is currently paused mid-playback.
Whether this BGM is currently playing.
Fade the volume to zero over duration ms.
Fade time in milliseconds
(Default false) Whether duration should ignore game speed
(Default true) Whether to destroy the bgm after fading out, or just pause it
Optionalvolume: numberBegin playing after delay real-time milliseconds.
The delay before play in milliseconds (speed-sensitive unless FixedInt is passed)
Optionalvolume: numberVolume to play at
PrivaterunRun and clear pending operations, stopping if the object is destroyed
PrivatetriggerFire all pending onEnd callbacks exactly once.
PrivatewithRun an operation immediately, or defer it until the sound has loaded.
The function to run on ready
Class representing a single background music track.
Remarks
Operations on a BGM object may be deferred for an indefinite amount of time until the underlying Phaser sound object loads. It is not possible to preload these sounds as they are massive. For this reason, a BGM object is liable to be destroyed before any/all of these operations complete, including the music actually starting. The exception is callbacks registered to
onEnd, which will always run regardless of if the music is able to start and stop cleanly.