Sound#play()

play(marker, position, volume, loop, forceRestart) → {Phaser.Sound}

Play this sound, or a marked section of it.

Parameters
Name Type Argument Default Description
marker string <optional>
''

If you want to play a marker then give the key here, otherwise leave blank to play the full sound.

position number <optional>
0

The starting position to play the sound from - this is ignored if you provide a marker.

volume number <optional>
1

Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).

loop boolean <optional>
false

Loop when finished playing? If not using a marker / audio sprite the looping will be done via the WebAudio loop property, otherwise it's time based.

forceRestart boolean <optional>
true

If the sound is already playing you can set forceRestart to restart it from the beginning.

Returns

This sound instance.

Source code: sound/Sound.js (Line 505)
doc_phaser
2017-02-14 11:09:56
Comments
Leave a Comment

Please login to continue.