Player.Source Unresponsive - API 35 (OK on 26)

When upgrading phones (moto e5 play to moto g 2025), one of my apps which plays several "radio" streams now fails when setting the Player.Source for one of the stations.

No error is displayed, although Screen1.Error_Ocurred event is populated and does catch attempts to set bad URLs (Player.PlayerError is also populated). Instead of catching one of these errors or displaying a runtime error, the app becomes unresponsive displaying "Close app or Wait" to the user. Even when selecting several subsequent "Wait" responses, the app continues unresponsive OR if the screen times-out, it closes(?).

The screen below depicts the expected API 24 (moto e5 play) behavior when executing the following sequence:

<lstpSelect_URL>, make the choice ending in /a28600
<btnPlayUI>
Results: plays WKUL live stream

<lstpSelect_URL>, make the choice ending in 443/KDFCFMMAC96 (a bad URL)
<btnPlayUI>
Result: expected handling of Screen1 errorNumber 702

<lstpSelect_URL> make the choice ending in "443/KDFCFMMAC96_SC" (a good URL)
<btnPlayUI>
Result: plays KDFC live stream

But when executing the same sequence on API 35 (moto g 2025), (1) the WKUL stream plays, (2) the bad URL causes the same Screen1 error (702), (3) but when attempting to play the KDFC good URL, it becomes unresponsive:

...which, eventually requests user input: Close or Wait (BTW, is this unresponsive timeout (secs) accessible from AI2 api?)

[Full disclosure: inconsistencies abound!]

After multiple attempts to get the KDFC URL to play, it has worked a few times. And on at least one occasion it played a few seconds ~10 and stopped. Pressing the btnResumeUI button (which simply calls Player.Start) seems to restart the same short segment of audio...and then it stops.

In addition, I have available 4 logcat files for failure cases which do not appear - to my inexperienced eye :slight_smile: - to show a common error or failure. I can supply these files if needed.

I also have ONE logcat file for a successful case!

[Finally, If I may whine a bit :cry: ] ....
Beyond my concern that there may be a problem (AI2 bug or an error in my code/understanding), I am also troubled by neither having a user level error indication nor a method which may be employed to catch one (I really hope I am wrong about this - what am I missing?). Granted, sufficient evidence of the problem/error is probably present in the logcat output, but it escapes my inexperienced grasp :frowning:

So, here are the blocks:

... and the AI2 source:

UIPlayer_badURL.aia (4.2 MB)

Any and all help and/or comments would be greatly appreciated!

Kind regards,
Randal

None of your URLs work.
Try this: https://sp0.redeaudio.com/8164/stream

@Anke, thanks for your attention to this post!

Do I understand that you imported the test case UIPlayer_badURL.aia, selected the URL ("https://streaming.live365.com/a28600") from the selection list using btn "Select URL" and then tapped the btn "Play" and the WKUL radio station was not played?

Hmmm...this URL works for me on API 26 as well as API 35...

Let me more briefly state my question/problem:

An app consisting of a single Player component and the following block works on Android 8 (API 26) (plays KDFC) but does NOT work on Android 15 (API 35), nor does it execute the Screen1.Error_Occurred, Player.PlayerError or raise a runtime error.... it becomes unresponsive.

If possible I would like to know why and whether or not I can fix/work around it. If not, how can the condition/error be "trapped" to avoid setting the source to a URL that will make the app unresponsive.

I hope that is clearer than my original post.

Any ideas? Perhaps the logcat output for this simplified case will reveal the problem...

Help?

-Randal

See here how to use logcat

Also what is the complete url you are using? And to make it as simple as possible for others, what about providing a simple example project?

Taifun

Thanks for the comments and suggestions!

I have been using "adb.exe logcat", but I need to take a look at the tutorial you mentioned above.

Opps! It is truncated in the text block above :frowning: The KDFC URL that is causing me problems is: "https://18243.live.streamtheworld.com:443/KDFCFMAAC96_SC"

Here is a single component, single block project that illustrates the issue. It works on API 26 and becomes unresponsive on API 35:
PlayAudioStream.aia (1.6 KB)

It contains a Player component and the single block shown above.

I have not yet looked at the logcat output.....

-Randal

This is an AAC stream (more precisely: AAC+ or HE-AAC at 96 kbps), as delivered by StreamTheWorld (a popular provider for radio stations like KDFC FM). AAC is a more efficient compression format than MP3, but it has known compatibility issues in App Inventor:

The Player component generally supports AAC, but not always AAC+ (enhanced AAC), especially for high-bitrate streams or specific encodings. It still works on older Android versions (< API 29) because the MediaPlayer implementation is more tolerant.

ExoPlayer (in Kodular) works seamlessly with all streaming formats.


My URL is a standard MP3 stream. MP3 has been fully supported by Android's MediaPlayer since version 4.4 (KitKat). There are no buffering issues, and compatibility is independent of the Android version. Therefore, it runs flawlessly on all Android versions (Android > 4.3).

I remember @Patryk_F sending me a test app (with an AudioExoPlayer extension) to test a while back.

It is here:

1 Like

@Anke, THANK-YOU for the explanation(s) ...

... this really helps me understand what to expect...as it turns out, I do not really need this particular station (KDFC) to work in my app (which focuses on live sports events). But as I select and add stations to my app I should watch for these extended AAC formats... if I continue to use the standard Player component.

How can I tell whether or not the AAC stream is AAC+ or HE-AAC?

Frequently I have choices as to which URL in a .pls file to use or even which station to select for my app, but I do not know how to tell what the precise format is.

I have yet to import/use a Kodular extension in AppInventor. Is this the extension to which you refer:
"V1.0.5 Exoplayer for AppInventor | Play media with Google's Exoplayer - Extensions - Kodular Community"?

What about the Audio Player extension by @Taifun? Do you think it would also have problems with some ACC streams?

Can you tell me more about this one: (AudioExoPlayer)? Is it available?

I am also concerned about recovery at runtime from making the error of attempting to set the source to an incompatible format.... Perhaps one of these implementations will do a better job of trapping the error so that the app does not become unresponsive.

I appreciate your discussing this with me.

Kind regards,
Randal

My extension App Inventor Extensions: Audio Player | Pura Vida Apps wlill have the same as the player component, because

The extension is a copy of the MIT Player component and fixes a Loop issue, which occurs for Android versions API 22 and newer

Taifun

1 Like

It looks like you have overseen this

Taifun

I suppose I should have just looked at this myself :frowning: - thanks for clarifying it for me.

Thanks for the link!

Finally, what about the Kodular Exoplayer? Is this it: "V1.0.5 Exoplayer for AppInventor | Play media with Google's Exoplayer - Extensions - Kodular Community" ? I found it linked on your extensions page.

I have downloaded and built the exoplayer_v1.0.5.aia ... and replaced the url with the KDFC that was causing my Player problems... and it works!

But I am having trouble correlating the coded blocks in the exoplayer_v1.0.5 app and with the documentation I found here : "ExoPlayer - Kodular Docs".

Am I missing a layer (is the Kodular ExoPlayer an implementation of the Core/Ui .aix components that I have not yet found?

Just how confused am I :slight_smile:

Thanks for your continued help,
-Randal

It's an outdated version of ExoPlayer, which, according to the Kodular team, should have been updated 6 years ago. See here:

However, as always, this hasn't happened. Nevertheless, ExoPlayer still works, and AAC+ streaming formats play flawlessly.


What's the problem with @Patryk_F 's great AudioExoPlayer extension?

@Anke, thanks again for continuing the discussion!

Nothing as far as I know - I like the K-ExoPlayer's selection of events (according to the docs here: "ExoPlayer - Kodular Docs") - includes OtherPlayer... events.

I gather you would recommend AudioExoPlayer over the Kodular ExoPlayer (1.0.5), correct? care to comment on specific issues with K-ExoPlayer for audio streams (other than what is written in the post above from Feb 2020)? I certainly like the fact that @Patryk_F's AudioExoPlayer seems to be currently under development/maintenance.

Thanks and kind regards,
-Randal

You're talking about two different components. Kodular has a built-in ExoPlayer component; you're showing its documentation. However, to use it, you need to build your app in Kodular, not AppInventor. In that case, you'll need to seek help from the Kodular community. @Anke is talking about the ExoPlayer extension. The documentation for the extension is included in the Kodular community thread where you downloaded the extension. This extension will never be updated, and if something stops working, you'll have to rebuild the app again. My extension is built on a newer version of the ExoPlayer library, which is included in Media3. If you're missing a function or block, I can add it.

1 Like

Hi @Patryk_f,

Thank you very much for explaining this.

Very kind offer. I will keep this in mind :slight_smile: :slight_smile:

BTW, is there a way for me to be auto-notified when you or others post in this forum regarding AudioExoPlayer extension?

Thanks again,
Randal

image

Select "Watching" in the topic you want new replies notified

Thanks, @TIMAI2!

-Randal

While the KDFC url works nicely, I am having trouble with another url: "https://streaming.live365.com/a28600"

When I set the AddMedia path to it, I get an error in the exoplayer_v1.0.5 app:

But this URL works from a web browser as well as other apps that use AI2 Player component...???

-Randal

This page does not work in my browser.