ukasz123 / soundpool

Soundpool plugin for Flutter
88 stars 63 forks source link

repeat not work #97

Open ash0080 opened 2 years ago

ash0080 commented 2 years ago

iOS / macOS version 2.3.0

No matter how many repeat settings are set, it will only play once Because of a bug, I haven't been able to test it on Android

pitazzo commented 2 years ago

Same problem here, I can confirm the issue does not happen in Android devices

ash0080 commented 2 years ago

Same problem here, I can confirm the issue does not happen in Android devices

I switched to audioplayers

eximius313 commented 9 months ago

I have a question: Specification of SoundPool states:

Sounds can be looped by setting a non-zero loop value. A value of -1 causes the sound to loop forever. In this case, the application must explicitly call the stop() function to stop the sound. Any other non-zero value will cause the sound to repeat the specified number of times, e.g. a value of 3 causes the sound to play a total of 4 times.

but in the code there is:

assert(soundId > -1,
        "Invalid 'soundId' parameter. Only values greater than -1 are valid.");

Should't it handle >=-1 ?

eximius313 commented 9 months ago

There is also setLoop API, but unfortunatelly it's not implemented here ;(

ukasz123 commented 9 months ago

I have a question: Specification of SoundPool states:

Sounds can be looped by setting a non-zero loop value. A value of -1 causes the sound to loop forever. In this case, the application must explicitly call the stop() function to stop the sound. Any other non-zero value will cause the sound to repeat the specified number of times, e.g. a value of 3 causes the sound to play a total of 4 times.

but in the code there is:

assert(soundId > -1,
        "Invalid 'soundId' parameter. Only values greater than -1 are valid.");

Should't it handle >=-1 ?

soundId is a key to decoded sound content in the storage not number of repeats. The number of loops is passed directly to play method here as repeat variable.

eximius313 commented 9 months ago

@ukasz123, oh, you're right. I've mistaken soundId with repeat :D

but setLoop is not implemented, right?

It would be also great if you add -1 as infinite into the documentation :)