I was going to guess the font made the issue. Great detective work. I did not anticipate that. Need to place a caution in the write up letting others know with Android 9 and possibly lower coders need to use the default fonts.
Sure. The Radio Stream player code is for everyone to experiment. I am trying to produce something that is stable and that a visually impaired individual could actually use.
I'm aware of all the ways to keep the screen alive. Having published numerous apps in the Play Store (Android) and App Store (iOS) for more than 10 years, I know very well how users react to such KeepScreenOn variants.
It shouldn't be a coincidence that almost everything has been done on both Android and iOS in recent years to reduce battery consumption (on Android, e.g. since API 23 through the introduction of the Doze mode). In this respect, the only option left is to use a Foreground service (at least with Android on devices with API 23+).
Yes, the battery is still a problem in new devices. The development of the battery does not keep up with the development of technology. In the past, an 800mAh battery lasted several days in phones, now 5Ah is not enough ... and we know that a larger battery is a bigger, thicker and heavier device... That's why they come up with newer and newer optimizations for apps...
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.
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
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.
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....
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.
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