TaifunPlayer Runtime Error failure code: -38

Hi!
I have been happy using TaifunPlayer for some time so thank you for the extension. Though while testing slightly modified version for Android 11+ I got this error. It works most of the time and it is not easy to reproduce the error.



Unfortunately I don't know what the value of global_player_position was but it should have been 0.
Any help would be appreciated.
Thanks.

in this case just use the Start method instead of StartAt

from the documentation App Inventor Extensions: Audio Player | Pura Vida Apps

Start at a given position.
Precondition: player must be in status PLAYING or PAUSED and position must be < duration.

what Stackoverflow says see here java - mediaPlayer error -38,0 - Stack Overflow

Taifun

Thanks for the quick reply.
Do you mean something like this?


It should have been in paused state because I check for duration before playing.

Maybe there is a better way to do this?

To do what?
Please explain exactly what this is all about. (I actually thought I was pretty familiar with (audio) player extensions after more than 10 years.)

Yes
Taifun

Hi Anke,
Thanks for looking into this.
These particular blocks calculate audio duration of an mp3 file. The duration value of TaifunPlayer is 0 after source is set. Only when playing starts then duration is set after some time.
I am developing an mp3 player app with special features like auto-play at particular time, auto-play to finish at particular time, countdown etc. For this to work I need to know mp3 duration before actually playing it. Therefore I save current volume to a temporary variable, set volume to 0, start playing, get duration, stop and restore original volume.
I agree that the infinite while loop waiting for duration to become available is not a clean solution. I could rewrite it with a separate timer but there probably are better options.
Thanks

and here with a simple Player extension (unpublished):
grafik

That's much better, thanks.

This takes the path, name, artist and duration of all MP3 songs on the device.

I have been working on a music extension for some time, I just need to adjust a few details and I will publish it.

Also from the assets? Most likely not.

Of the assets not yet.
Unable to obtain artist and duration data.
But I think I have found another method, I will continue testing.

Take artist name and duration from assets.

Example: