How to Stream live Audio/Radio via Streaming URL

194 views
Skip to first unread message

Owusu Samuel

unread,
Feb 25, 2021, 4:08:29 AM2/25/21
to DroidScript
Hi please I'm streaming live radio using VideoView. It worked but the drawback is it stops when you leave the app to home screen or when the screen is off and it doesn't fulfill the purpose very well. Please I need help to properly stream audio without interruption when app is paused or left to home screen. And does MediaPlayer accept Streaming URL? Thank you.

Dave

unread,
Feb 25, 2021, 8:08:28 AM2/25/21
to DroidScript
Hi,

Try usiing the 'nopause' option on the app.CreateWebView() method.  This should work, but I've not tested it on Android 10 or 11 yet.

Webviews will be paused when the app looses focus normally, but using the 'nopause' option will allow the webview to keep running while the app is in the background.  However Android may still decide to shut down your app when it is in the background.  You could try creating a foreground service using a Service.js file and that might stop Android from shutting down your app.

Be aware that Google will suspend your App if you use this technique to allow playing of Youtube videos in the background (they now charge for this privilege)
Reply all
Reply to author
Forward
0 new messages