WebView Radio Stream Player
This is an experimental, no frills radio stream player. The app uses the Custom Webview control by Sunny vknow360 CustomWebView : An extended form of Web Viewer . No audio player component is needed. The app requires the stream's direct MP3 web address, the URL, to connect to the live streams. In general most of the streams provided with the example are low bandwidth 24 kbps MP3 streams.
Streams with higher bit rates produce better sound than streams with lower rates. This bit rate is measured in kilobits per second (kbps). Higher bit rate streams sound better, they also require higher bandwidth internet connections and might not work well on some mobil data plans.*
-
The Project is an app in progress. I reached a point where I am unable to improve its stability. I am soliciting the community for some help and ideas. I initially started this Project with the WebViewer. I discovered some of the tools in the Custom WebViewer are needed.*
-
The objective for this project is to develop a stream player easily controlled by visually impaired users. The stream should load automatically without having to press a button on the link. All the urls in the accompanying list of streams except WNYC, AustraliaBC, VOA, NRK and LA Country fulfill those requirements. The web links for these streams display a web page with a clickable player link; difficult for someone with unstable sight to navigate.
-
The app has four methods of stream selection meant to be easy for the visually challenged to navigate. All four announce the selected link using TextToSpeech.
One method uses a ListViewer (useful for those users who have some ability to navigate the app's screen).
A second method is a Button that selects a link randomly using a large button.
A third method is a Button that traverses the list of links one at a time with each Button touch. No image posted, this is just another Button that is not currently cluttering the app screen.
A fourth method uses the SpeechRecognizer to select a stream number (say zero and then the stream number). The item in the csv corresponding to the url appears to the right of the SR Request by number Button.
A large number of urls that stream is:
CSV Table of some active direct radio streams:
BBC Radio 1,http://stream.live.vc.bbcmedia.co.uk/bbc_radio_one \n
BBC Radio 1 Extra,http://stream.live.vc.bbcmedia.co.uk/bbc_1xtra \n
BBC Radio 2,http://stream.live.vc.bbcmedia.co.uk/bbc_radio_two \n
BBC Radio 3,http://stream.live.vc.bbcmedia.co.uk/bbc_radio_three \n
BBC Radio 4,http://stream.live.vc.bbcmedia.co.uk/bbc_radio_fourfm \n
BBC Radio 4 Extra,http://stream.live.vc.bbcmedia.co.uk/bbc_radio_four_extra \n
BBC Radio 6 Music,http://stream.live.vc.bbcmedia.co.uk/bbc_6music \n
BBC Asian Network,http://stream.live.vc.bbcmedia.co.uk/bbc_asian_network \n
CRI (1008 kHz English),http://sk.cri.cn/am1008.m3u8 \n
(ILR) Classic FM,http://media-ice.musicradio.com:80/ClassicFMMP3 \n
(ILR) Classic FM at the Movies,http://media-ice.musicradio.com:80/ClassicFM-M-Movies \n
Radio North Sea International,http://radionorthsea.zapto.org:8008/stream \n
Radio Luxembourg Memories,https://stream-016.zeno.fm/3384cgvyk2zuv?zs=56tQOKgYTbeKSoAV6OjEhA \n
WUSR,http://wusrstreaming.scranton.edu:8080/live.mp3 \n
NPR, https://npr-ice.streamguys1.com/live.mp3 \n
Jazz, https://vprmix.streamguys1.com/vprmix64.mp3 \n
Unknown, https://streams.radiozum.md/listen/zum1/ZUM1 \n
unknown2, http://mediaserv30.live-streams.nl:8088/live \n
unknown3, http://mediaserv30.live-streams.nl:8086/live \n
Hi Pop, http://mediaserv30.live-streams.nl:8086/live \n
Hi Latin,http://mediaserv33.live-streams.nl:8034/live \n
Hi Jazz,http://mediaserv38.live-streams.nl:8006/live \n
Hi Lounge,http://mediaserv33.live-streams.nl:8036/live \n
Hi Gold,http://mediaserv30.live-streams.nl:8000/live \n
Hi Classical,http://mediaserv30.live-streams.nl:8088/live \n
Hi World,http://mediaserv38.live-streams.nl:8027/live \n
Hi France,http://mediaserv21.live-streams.nl:8000/live \n
Heart70s, https://media-ice.musicradio.com/Heart70s \n
Heart00s, https://media-ice.musicradio.com/Heart00s \n
Heart80s, https://media-ice.musicradio.com/Heart80s \n
Heart90s, https://media-ice.musicradio.com/Heart90s \n
Big Top 40, https://media-ice.musicradio.com/BigTop40 \n
SmoothCountry,https://media-ice.musicradio.com/SmoothCountry \n
Heart Dance,https://media-ice.musicradio.com/HeartDance \n
Gold,https://media-ice.musicradio.com/Gold \n
LA Country,https://countryradio-musicbox4friends.torontocast.stream /\n
NRK_Norway,radio.nrk.no/direkte/p13 \n
WNYC,WNYC | New York Public Radio, Podcasts, Live Streaming Radio, News \n
AustraliaBC, ABC Radio Australia Live Audio - ABC Pacific \n
VOA, Border Crossings \n
Multimix, https://listen.multimixradio.com:443/;audio.mp3 \n
KERA Dallas, https://kera.streamguys1.com/keralive \n
WRR Classical, WRR-FM
====================== radio stream urls from various ownline sources ===============
Almost all of the links in the playlist load and start the audio stream automatically. Several urls in the playlist do not load automatically; they require viewing the stream provider's web page and searching for the web player on the Web page. For the most part, these urls are the last eight items in the provided csv of links.
Facts about the example app:
-
To avoid issues, compile the aia and install the apk. The Companion cannot ensure it uses all the features of the extension.
-
error control is minimal; looking for suggestions to handle errors and dropped streaming.
-
plays a large number of direct audio streams
-
What to do when Webviewer becomes un-responsive or locked. if you lose the feed, here are some possible remedies
1 if the player controls show, you might toggle the play stop icons or grab the progress indicator and drag the indicator towards 0:00 Sometimes switching to another stream allows the player to continue (but on another stream) -
you might lose the feed if you have a network issue.
2 if the error is not recoverable, close the compiled app, then restart the app and make your stream selection again. This usually happens when you listen to a stream for a long time then decide to change streams and the app locks up. You have to restart the app until I or you provide a way to continue gracefully. -
I notice some streams play continuously for as much as on hour; others might have network issues within a few or dozen minutes of playing. Some radio streams are more stable than others. Usually these streams are those that stream in lower audio quality.
The Future
- a File control could be used to provide a csv listing of stream links from an external source to update the links in the app. No code is provided.
How to use the app:
There are four ways to select an audio stream. One option is disabled in Screen1.Initialize. Three selection methods are enabled. The app you build only needs one.
The enabled selection methods: one uses a ListPicker, another is a routine to provide a random link using a Button touch (Each time it is touched, a new link is selected. No effort was made to eliminate previously selected links.) and another uses the SpeechRecognizer. Select Button8, say the stream number preceded by a zero, for example 05. The zero said first helps the recognizer to determine the USER is saying a number when the number is less than two digits in length. Currently 43 streams are provided. The recognizer understands English.
The disabled method uses a Button to cycle through the streamLinkList, one item at a time. You can enable it (Button7) by setting Button7.Visible to true in Screen1.Initialize.
Load the apk, select the app, then use one of the mention methods to select a radio stream. Be patient, it may take a few seconds to load the stream an begin playing.
Tools to handle and debug issues are primitive
There are a few hidden testing tools. Enable Button5.Visible and Button6.Visible by setting them to true in the Screen1.Initialize event handler.
References
Screen Readers for the visually impaired. How some Android users are able to navigate an Android app. Two are Jieshuo and TalkBack. TalkBack is accessible in the Android device system settings.
Community discussions about visual impairment: Search results for 'blind' - MIT App Inventor Community
Testing
Does this app help anyone with a visual impairment. Sorry, I don't know how useful it is at present. It was started when a totally blind person asked a question regarding his ability to code such an app. I am aware of several individuals who do successfully code app inventor Projects who have various degrees of visual impairment. Until now I never met one who has to entirely rely on screen readers. I found this app a challenge getting a stable player to work despite being able to use the graphic interface.
I did some early testing using TalkBack. It works but working with it was extremely frustrating.
I did not test with the help of any visually impaired individual. Whether this app is actually useful is not known.
Challenges
Develop user friendly user interface for the visually impaired that can use screen readers. It means using meaningful Labels, Text and the TextToSpeech component. I tried the TalkBack Android screen reader. It confuses me and is awkward to turn off the feature on a device.
- How can we handle the following Errors
=======================
net::ERR_FAILED
net::ERR_NAME_NOT_RESOLVED
net::ERR_CONNECTION_ABORTED
ERR-CONNECTION-TIMED-OUT
errorCode -1 (ERR_FAILED) is usually self correcting.
========================
I attempted some code but it does not allow having to restart the app to recover from the errors. Perhaps someone has some ideas?
Keep the number of options simple . Cluttered screens are to be avoided. Since this is a demo, the screen is getting crowded unfortunately. The final app should limit the selection option.
Battery level. Streaming constantly depletes your battery. Should you monitor battery state and provide a battery level warning?
Using the SpeechRecognizer to control the audio stream selection makes the app accessible to those with other handicaps and perhaps easier to use for the visually impaired.
The app was designed and tested on an Android 13, Samsung A13 cell. Performance in part depends on whether you are wifi or data connected to the Web and the speed of your connection and the stability of the streaming url.
The Font used in the ListViewer: Mynerve Project Authors (GitHub - carolinashort/MyNerve: A handwritten font for notes and comments) is licensed under the SIL Open Font License, Version 1.1 available with a FAQ at: SIL Open Font License (OFL) Caution: this pretty font causes the app to crash on an Android 9 and possibly lower. If you have issues, change the ListViewer font to the default font in it's Properties.
I hope this app contains some code and ideas that can make App Inventor apps more user friendly to handicapped users.
Can you improve error control or performance? Please post some Blocks. I suspect the app is not taking advantage of all the techniques in the CustomWebView to make the work again if Android locks the ability to restart the viewer.
Radio Streaming aia
RadioStreamVI_SR.aia (225.0 KB)
Running using the Companion works but you get better performance by building and loading the apk.
Radio Streaming aia with Stay Awake
RadioStreamVI_SR_SA.aia (224.9 KB)
Version of app that uses default font in the ListViewer. It uses a Stay Awake routine. Stay Awake prevents the app from going to sleep extending stream play to avoid 'doze'. Default font is required on Android 9 and perhaps lower versions since ttf fonts not supported. See post #5 📻 WebView Radio Stream Player - #5 by SteveJG .
Radio Streaming aia with Keep Alive Service (KAS)
RadioStreamVI_SR2KAS.aia (287.3 KB)
RadioStreamVI_SR2KAS.aia uses Ullis' Keep Alive Service to play radio streams in excess of 60 minutes in the foreground while allowing you to use other apps concurrently.
Be aware, like a Stay Awake routine, KAS eats battery energy. You must test this after compiling and installing the apk. The KAS version won't run using Companion.
This is a beta version. Hope to eventually fix the bug that freezes the player after many changes of channel switching. No issues have been noticed if you stay on a single channel or only switch among a few. If the player freezes; turn off the service (Stop KAS first). Android 9 and lower developers probably need to reset the pretty ttf font to default to get this version of to play.
Enjoy this simple streaming app.
Regards,
Steve