it is looking for files in the assets directory over 
ContentResolver.openAssetFileDescriptor.

You should have to use 
http://developer.android.com/reference/android/media/MediaPlayer.html#setDataSource%28java.lang.String%29

you would need prepareAsync too

On Sunday, March 15, 2015 at 8:35:57 AM UTC-4, NewToAndroid wrote:
>
> Hi,
>
> Few other developers have asked this question before, I checked those 
> posts. But looks like I have a different issue here.
> I am using Android Developer Studio 1.0.1 sitting on JRE 1,7 (on a windows 
> laptop).
>
> I am developing an App around a live streaming audio, using MediaPlayer 
> class.
> If I place the URL in browser, which looks like, 
> http://something.org.uk:8000/blah.mp3, the URL woks/plays perfectly fine 
> from the browser.
>
> But my code
>         mediaPlayer = MediaPlayer.create(MainActivity.this, Uri.parse("
> http://something.org.uk:8000/blah.mp3";));
>         mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
>         mediaPlayer.start();
>
> gives exception
>
>     java.io.FileNotFoundException: No content provider: 
> http://something.org.uk:8000/blah.mp3
>             at 
> android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:761)
>             at 
> android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:665)
>             at 
> android.media.MediaPlayer.setDataSource(MediaPlayer.java:960)
>             at 
> android.media.MediaPlayer.setDataSource(MediaPlayer.java:914)
>             at android.media.MediaPlayer.create(MediaPlayer.java:837)
>             at android.media.MediaPlayer.create(MediaPlayer.java:818)
>             at 
> com.example.android.playlivenusound.MainActivity$1.onClick(MainActivity.java:52)
>             at android.view.View.performClick(View.java:4475)
>             at android.view.View$PerformClick.run(View.java:18786)
>             at android.os.Handler.handleCallback(Handler.java:730)
>             at android.os.Handler.dispatchMessage(Handler.java:92)
>             at android.os.Looper.loop(Looper.java:176)
>             at android.app.ActivityThread.main(ActivityThread.java:5419)
>             at java.lang.reflect.Method.invokeNative(Native Method)
>             at java.lang.reflect.Method.invoke(Method.java:525)
>             at 
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
>             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
>             at dalvik.system.NativeStart.main(Native Method)
>
> If I use a local MP3 file (added to the raw folder), it works fine.
> What am I missing here ??
>
> Please help.
>
> Thanks in advance.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to