howler.js icon indicating copy to clipboard operation
howler.js copied to clipboard

The sound acceleration function does not work correctly in the mode html5 with sprite

Open musaev-haybulla opened this issue 2 years ago • 1 comments

The Problem

var sound = new Howl({ src: ['sounds.mp3'], sprite: { first: [0, 8160], second: [8160, 15380], third: [15380, 18900], fourth: [18900, 22410], fifth: [22410, 26820] }, html5: true }); $("#first").click(e => { var s1 = sound.play('first'); sound.rate(1.5, s1); });

This option does not change the speed

$("#first").click(e => { sound.rate(1.5).play('first'); });

This variant does not work [Error] TypeError: undefined is not an object (evaluating 't._sprite[d._sprite][0]')

If I try to run without audio sprites, then everything works correctly in html5 mode, but if I disable the html5 mode, then the sound is accelerated by increasing the pitch. How can you solve this puzzle?

Reproducible Example

No response

Reproduction Steps

I have described above

Possible Solution

No response

Context

No response

Howler.js Version

2.2.3

Affected Browser(s)/Versiuon(s)

safari, chrome

musaev-haybulla avatar May 06 '23 12:05 musaev-haybulla

Solution:

var sound = new Howl({ src: ['sounds.mp3'], sprite: { first: [0, 8160], second: [8160, 15380], third: [15380, 18900], fourth: [18900, 22410], fifth: [22410, 26820] }, html5: true, rate: 2 });

musaev-haybulla avatar May 06 '23 20:05 musaev-haybulla