📻 WebView Radio Stream Player

Nice idea but using it refused to identify any errors I was getting. I tried the CustomWebView and it works to find errors.

Later today I will try your method of restart. Thanks

The only problem is that at this point when playback stops, CustomWebView doesn't return any error. He just freezes. I haven't noticed any dependencies either. I tried different streams mp3, aac, with different bitrates and the error occurs randomly.

Maybe it will be more stable just with some player. where you will also get metadata with the title of the song being played. I don't know if it makes sense to break down doors that are open.

It doesn't matter what audio format is used. The stream breaks off after a few minutes (~3-6 min randomly) in idle mode. I tested it (years ago) intensively and extensively on all AI2 distros. Doze mode shuts down all possible functions after a while to save battery power.

Again, the only way to avoid the problem is to use a Foreground service (at least if the app is going to be published on the Play Store; otherwise, there is a workaround).

It's not about idleness. We're talking about another bug, when switching streams sometimes some streams stop the player and then no other stream can be played. it's like webview is hanging... Then you have to turn the app off and on again. But later on the same link works that previously failed...

For that matter, I'm already experimenting with the Itoo extension, and your ActivityLifecycle. Is there any extension you recommend for the Foreground service?
I also made an extension that fetches Metadata from the url link, useful when using a WebView instead of a player.

It may be because it takes some time to buffer.

Taifun

2 Likes

Tried using open another screen screenName Block as you suggested. Unfortunately it does not unlock the Custom Web Viewer. Interesting potential work around but it is not a solution. Thanks

Can you make the webview freeze on demand, I have not had it freeze on me yet?

I'm having this bug too. And it cannot be done by demand. You can try changing the stream often.

Congratulations.
I've done a radio app before. You can update the radio list via google drive. No problem so far though
The radio was a problem when the phone rang. You had to turn off the radio. That's why I added dialing blocks. If a call comes in, the radio is switched to mute. After the call ends, the radio starts playing again.
I was making it keep playing with the clock block in the background.
Maybe you can add something like this.
I would recommend.

Be good if you could show your blocks coding for this, so that others can learn....

It might be worth a try creating an html file to play back the audio streams, then you could use javascript to detect/handle any errors in the playback stream....

Regarding a foreground service

I modified Ullis' Keep Alive Service example as follows .

The code plays a single radio stream in excess of 45 minutes in the foreground while allowing you to use other apps concurrently.

I will clean up this example up and integrate KAS into a version of Radio Stream Player later today or tomorrow (unless someone else post a more detailed example first) that supports doze mode. Be aware, like a Stay Awake routine, KAS eats battery energy.

Tested on an Android 13 Samsung A13. Played the stream continuously for over 45 minutes (when I stopped testing) while allowing a phone call and use of other apps while streaming. :astonished:

This is how I used phone call blocks in my radio show.
My app used to work better. It even worked on Android 2.4 version.
But it started to cause problems in higher versions. I did not fix the program afterwards. I am doing the update from a file on google drive.
I haven't updated my radio app because of this.
I moved it to the internet.
It can be listened through the internet browser.
www.mikrobotikradyo.tk

image

MY source code :
SAFAK_RADIO_V3.aia (203.9 KB)

1 Like

You are using the player component. I tested yesterday with the Player, loading the stream to the Player is synchronous and freezes the entire app for a while or longer. Are you experiencing this? This is especially noticeable in the ListView.

I did some tests with custom <audio> and custom <video> in html. Unfortunately, I cannot make the playback start automatically like it does with the original player. I have the autoplay control set.

Yes, I had a play with this too. Requires some form of interaction from the user.

Thanks, will try with <iframe> later.

Doesn't work, Chrome blocked that too. To play sound, user must interact with the web page (touch/click), you cannot program it (e.g. with javascript).