Android Media Stream Error? java.io.FileNotFoundException: No content provider :http://

Whats Going On picture Whats Going On · Feb 8, 2017 · Viewed 47.5k times · Source

I followed this to Play Stream Radio In android

Here Its working Fine But Player Loading Bit Slow after clicking I need to wait for 30+ seconds time

But I am getting This error In console

MediaPlayer: setDataSource IOException happend : 
java.io.FileNotFoundException: No content provider: http://www.example.com:8000/live.ogg
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1074)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:927)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:854)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1087)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1061)
at org.oucho.radio.Player.playLaunch(Player.java:237)
at org.oucho.radio.Playlist.onPostExecute(Playlist.java:98)
at org.oucho.radio.Playlist.onPostExecute(Playlist.java:35)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

In the Link You can see all files like player etc

Due to this error My stream Is slow. Please any one help me on this type

Here this error is not with .ogg file I tried with .mp3 and Just /live

http://www.example.com:8000/beet.ogg
http://www.example.com:8000/mouthorgan.mp3
http://www.example.com:8000/live

The Audio is playing but after this error It is taking some 30 seconds time Some times it is taking too long ....When I plays Its showing this error and then its connecting to server.. and playing

please help me to fix this

Answer

Anurag Singh picture Anurag Singh · Feb 10, 2017

Go to this file https://github.com/Old-Geek/Radio/blob/master/app/src/main/java/org/oucho/radio/Player.java#L234 and change

player.setDataSource(context, Uri.parse(url));

to

player.setDataSource(url)

The problem is that void setDataSource (String path) Sets the data source (file-path or http/rtsp URL) to use.

path String: the path of the file, or the http/rtsp URL of the stream you want to play

the github code uses void setDataSource (Context context, Uri uri) which assumes uri to be of some form of ContentProvider

context Context: the Context to use when resolving the Uri
uri Uri: the Content URI of the data you want to play