27

I am trying to play url using media player in activity using:

mediaPlayer = MediaPlayer.create(getApplicationContext(),
Uri.parse("http://www.pocketjourney.com/downloads/pj/video/famous.3gp"),
holder);

It's working fine. Same code I use to set it as an live wallpaper in @onSurfaceCreated in WallpaperService, it's giving me following error log

D/MediaPlayer( 4128): create failed: D/MediaPlayer( 4128):
java.io.IOException: setDataSource failed.: status=0x80000000
D/MediaPlayer( 4128):   at
android.media.MediaPlayer._setDataSource(Native Method) D/MediaPlayer(
4128):  at
android.media.MediaPlayer.setDataSource(MediaPlayer.java:844)D/MediaPlayer( 4128): at
android.media.MediaPlayer.setDataSource(MediaPlayer.java:806)......

If I use local video uri to set live wallpaper..it working fine.

Any idea/suggestion over here?

Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53
CoDe
  • 11,056
  • 14
  • 90
  • 197

1 Answers1

74

Do you remember to add this permission to your manifest file?

<uses-permission android:name="android.permission.INTERNET" />
Quyen Nguyen Tuan
  • 1,677
  • 17
  • 23
  • 1
    i am trying to load a local file, and still getting this error... var uri = RingtoneManager.GetActualDefaultRingtoneUri(this, RingtoneType.Ringtone).ToString(); I am trying to play the Current Ringtone in the media Player – N.K Apr 26 '16 at 11:29
  • @N.K have you found any solution ? I am facing the same issue :( – Bunny Jul 15 '16 at 14:31
  • @Bunny : Try cleaning the permissions and set them again, also the problem for me was my device was not asking for all the permissions, so try to add them manualy on the device after you install the test app . – N.K Jul 20 '16 at 06:56
  • This is a problem with the sample android tv app shipped with android studio. – Midhun Darvin Dec 06 '18 at 11:58