Hi.
Did you set android.permission.INTERNET permission?
Regards,
Alex
On Monday, March 16, 2015 at 1:53:13 AM UTC+1, NewToAndroid wrote:
I tried that and now it is giving different error
03-16 00:25:53.020 29074-29074/com.example.android.playlivesound E/﹕
mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct 9 21:05:57 KST 2013
03-16 00:25:53.105 29074-29074/com.example.android.playlivesound
D/OpenGLRenderer﹕ Enabling debug mode 0
03-16 00:25:53.870 29074-29074/com.example.android.playlivesound
I/Choreographer﹕ Skipped 44 frames! The application may be doing too much
work on its main thread.
03-16 00:26:08.910 29074-29074/com.example.android.playlivesound
E/MediaPlayer﹕ Unable to to create media player
03-16 00:26:08.915 29074-29074/com.example.android.playlivesound
W/System.err﹕ java.io.IOException: setDataSource failed.: status=0x8000
03-16 00:26:08.940 29074-29074/com.example.android.playlivesound
W/System.err﹕ at android.media.MediaPlayer._setDataSource(Native Method)
03-16 00:26:08.940 29074-29074/com.example.android.playlivesound
W/System.err﹕ at
android.media.MediaPlayer.setDataSource(MediaPlayer.java:1185)
03-16 00:26:08.940 29074-29074/com.example.android.playlivesound
W/System.err﹕ at
android.media.MediaPlayer.setDataSource(MediaPlayer.java:1102)
03-16 00:26:08.940 29074-29074/com.example.android.playlivesound
W/System.err﹕ at
com.example.android.playlivesound.MainActivity$1.onClick(MainActivity.java:46)
03-16 00:26:08.940 29074-29074/com.example.android.playlivesound
W/System.err﹕ at android.view.View.performClick(View.java:4475)
03-16 00:26:08.940 29074-29074/com.example.android.playlivesound
W/System.err﹕ at android.view.View$PerformClick.run(View.java:18786)
03-16 00:26:08.940 29074-29074/com.example.android.playlivesound
W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:730)
03-16 00:26:08.940 29074-29074/com.example.android.playlivesound
W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:92)
03-16 00:26:08.945 29074-29074/com.example.android.playlivesound
W/System.err﹕ at android.os.Looper.loop(Looper.java:176)
03-16 00:26:08.945 29074-29074/com.example.android.playlivesound
W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5419)
03-16 00:26:08.945 29074-29074/com.example.android.playlivesound
W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
03-16 00:26:08.945 29074-29074/com.example.android.playlivesound
W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:525)
03-16 00:26:08.945 29074-29074/com.example.android.playlivesound
W/System.err﹕ at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
03-16 00:26:08.945 29074-29074/com.example.android.playlivesound
W/System.err﹕ at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
03-16 00:26:08.945 29074-29074/com.example.android.playlivesound
W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
03-16 00:27:23.000 29074-29074/com.example.android.playlivesound
D/dalvikvm﹕ GC_EXPLICIT freed 275K, 13% free 10262K/11728K, paused 4ms+3ms,
total 48ms
03-16 00:28:33.670 29074-29074/com.example.android.playlivesound
E/MediaPlayer﹕ Unable to to create media player
What can be the reason? Is it only because I have not put the prepare
method in a service ? and have included it in main thread?
On Sunday, March 15, 2015 at 8:57:22 PM UTC, Jonathan S wrote:
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)