Howler.js: Sprite won't stop playing

Created on 15 Nov 2018  路  3Comments  路  Source: goldfire/howler.js

I am using Version 2.0.15

I have sprite sounds and when I start one, it plays but then continues to play the other sprite sounds instead of ending.

    var SFX = new Howl({
        src: [audioSFXSprite],
        sprite: {
            asteroidDeath: [0,5270],
            SFX_CatAppearsOnScreen: [6000,7150],
            NonRocketCollectible_SFX: [14000,14800],
            newGameSFX: [31000,32250],
        },
        onend: function() {
            console.log('Finished!');
          }
    })

I start it using for example SFX.play('asteroidDeath') it will start at the right spot, but not finish and not fire the onend callback.

Most helpful comment

@SandMoshi Thank you, it helped me. I thought just like you first ;-)

All 3 comments

By the way, I already imported audioSFXSprite using ES6 and it starts playing fine so the source shouldn't be the issue I think.

Okay, what I hadn't realized was that each sprite needs the [start_time, duration]. I thought the second parameter was end_time but now I know it's the duration.

@SandMoshi Thank you, it helped me. I thought just like you first ;-)

Was this page helpful?
0 / 5 - 0 ratings