I’ve been experimenting with the Cordova media plugin for a while. However, I haven’t been able to figure out whether it supports streaming at all or if it needs to download the whole media before being able to play it. The github page does not mention anything related to streaming media. I bet the alternative then is to use the web audio api. Any ideas?
It downloads the full media before starting playing.
If you run your app through xcode you watch the network usage, you’ll get a burst of traffic until the full file is loaded, then zero network and the file starts playing.
Also with the media plugin as it stands it locks entire app until it finishes downloading, I’ve put in a pull request that sends Media plugin operations to a background thread that fixes this. Once this is done it actually works fine if you have a decent speed connection and are just listening to say music tracks.
The solution I am looking at is downloading the file to the local file system and starting play back while it is still downloading, not sure how well it will work yet.
That’s what I supposed
But in my case the UI does not freeze, at least on Android. I am able to switch tabs while media is loading.
Thanks for your input!
Yeh the lock up is iOS specific, as are my comments about streaming. Android may support streaming media from a url I haven’t tested yet.
It looks like streaming works as expected on Android for me. I have forked the media plugin repo and updated it to use avplayer for streaming media on ios as well, I’ll contribute a pull request on github and hope it gets merged.
Any chance I can take a look at your forked plugin?
Of course the fork is public. Feel free to install the plugin directly from this branch on my fork if you want to play with it.
When you say streaming works as expected on Android, what type of media are you actually streaming? Is it a streaming URL or a remote MP3? In my case it seems that if you provide a URL for an MP3 file hosted on Amazon, it will download the whole file before starting playback. I could perhaps create a RTMP server but this is not supported on all mobile devices. Streaming MP3 audio seems to be challenge in fact… unless I switch to HLS protocol.
I’m streaming mp3s from the subsonic music server, you could take a look at how it’s stream urls work.
The other solution I saw mentioned if you have a bunch of remote MP3 files is to create a local m3u playlist file with the remote urls and open that with the media player then it will apparently stream the remote files. Haven’t tried that myself as it’s not a problem I encountered with the server I’m using.
I actually looked at Subsonic a few weeks ago and was wondering how difficult it is to set up my own Subsonic server on an Amazon Linux instance. Would that work out of the box (including streaming)? Or should I go for a Subsonic cloud hosting solution? Any advice on that?
I will look into the m3u playlists, but would that only work with the media player? Or also with the Cordova Media plugin? I want to manage streaming from within the app.
Thanks a lot for your help!
The m3u thing you just create a m3u with a single track in it then feed that to Cordova media I would think. Then you still manage the queue etc in your app. Try it and see though I haven’t had that problem.
I just run subsonic server on a synology box at home, it would take all of 10 minutes to setup on Amazon or any other cloud hosting service, just get a new Linux instance, download the appropriate binary and you’re away.
Is there any solution for this issue ? I have the same problem with IOS, the app is freezing
Is there a way to solve the freezing problem temporarily?
For example, show loading or something else… any help about this
No one find solution for this issue? I’m using ngCordova Media with Android and works fine and it’s possible to use stream audio. But when I try to use NgCorodova Media Plugin with iOS, the streaming doesn’t open.
If you get the latest version of the media plugin it has my streaming code for iOS integrated.
for any source starting with http or https it will now play as a stream and will be responsive while the stream buffers as well.
ghenry 22 you are GREAT:smile_cat:
This is awesome! I didn’t know this was in the plugin, and I will definitely be checking this out! Thanks!