0

I'm working media palyer app, in this i need to stream audio from URL. In my case some URL's are not streamed in some devices (Eg. Samsung Note III), after a long time i got this error message in onError() method.

 E/MediaPlayer(24445): error (1, -1004)

I used the following code to pay url.

mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
                        mediaPlayer.setDataSource(songPreViewUrl);
                        mediaPlayer.setOnPreparedListener(BackgroundAudioService.this);
                        mediaPlayer.setOnCompletionListener(BackgroundAudioService.this);
                        mediaPlayer.setOnBufferingUpdateListener(BackgroundAudioService.this);
                        mediaPlayer.prepareAsync(); 

Can any one please share the suggestion, why the urls are not streams in Samsung devices.

Aerrow
  • 12,086
  • 10
  • 56
  • 90
  • You might have a look here: http://stackoverflow.com/questions/16672568/mediaplayer-error-1-1004-aka-media-error-io-trying-to-stream-music-on-samsun – Mike M. Dec 20 '14 at 12:02
  • @MikeM. is there any way to handle this problem, because some URL's are not playing, that same URL played very well in other Devices (HTC, Sony) – Aerrow Dec 20 '14 at 12:04
  • If you mean get the stream working, that post would indicate no, not without Samsung releasing a firmware update. If you mean handling the error without crashing, the question itself demonstrates how to do so with an `OnErrorListener`. – Mike M. Dec 20 '14 at 12:08
  • See if the url is working correctly in some device and not in other, than it might be issue of the format support check that your device has the support of the format of url you are playing. – Hardik Chauhan Dec 20 '14 at 12:28

0 Answers0