XamarinCommunityToolkit icon indicating copy to clipboard operation
XamarinCommunityToolkit copied to clipboard

MediaElement's Background Play

Open jrahma opened this issue 5 years ago • 9 comments

Hi,

Please add an option to keep the media file (audio) running in the background when the app is not active

Thanks, Jassim

jrahma avatar Feb 15 '20 21:02 jrahma

I would love this option too.

jtorvald avatar Apr 14 '20 08:04 jtorvald

I would love too ! Any released date ?

ZeAleks avatar Sep 16 '20 23:09 ZeAleks

Love the idea, I'm wondering though if this is something that should be in the MediaElement or should this be implemented in some kind of background service? Not sure how these things work. We need some more specification and clarification on this before we can make this happen.

jfversluis avatar Nov 18 '20 16:11 jfversluis

I think it should be from the Media Element which will invoke a background process at the backend

jrahma avatar Nov 19 '20 05:11 jrahma

I have gone over the iOS implementation here: https://www.youtube.com/watch?v=1XVjsUO-Ayw

We might want to add some boolean maybe that says: ContinuePlayingInBackground that will enable this functionality? Provided that it works similar on Android

jfversluis avatar May 12 '21 09:05 jfversluis

Still needs to be a andriod documented verison of this @jfversluis trying to do same on both platforms thanks

davidbuckleyni avatar Jan 17 '22 00:01 davidbuckleyni

Another request for the mentioned feature cross-platform (listen to audio in background from MediaElement) in Android, iOS.

AlphaPy avatar Feb 05 '22 03:02 AlphaPy

@jfversluis @davidbuckleyni @jrahma This can be achieved by running the audio url as a url in a webview. It should autoplay, and even when the app is out of focus, the audio will still play. You can make the webview very small, maybe even not even visible, as long as it plays, with the caveat that the user won't be able to stop the audio without exiting the app completely, but if the webview is visible, there's a pause button so they can halt the audio.

AlphaPy avatar Feb 05 '22 06:02 AlphaPy

@AlphaPy while true we are talking about using the andriod audio service to achieve this as standard without a messy hack.

And it doesnt work with live streams it crashes cause youtube protects against it.

davidbuckleyni avatar Feb 06 '22 18:02 davidbuckleyni