6

The create method in MediaPlayer of the following code is NOT working with galaxy s3. it works fine with galaxy s2 and s1 devices. The program hangs when reachs the create method, and i have been inforced to close the application. i don't know what the problem is, can any one help me with this. Thanks

Uri path = Uri.parse(url);
player = MediaPlayer.create(getBaseContext(), path);
player.start();

1 Answers1

0

In this situation, sometimes it helps to use the MediaPlayer constructor instead:

MediaPlayer player = new MediaPlayer();
Uri ringtoneUri = ...;
player.setDataSource(context, ringtoneUri);
player.prepare();
player.start();
acj
  • 4,821
  • 4
  • 34
  • 49
  • Thanks for your answer. your approach does not work either, the app does not hang like in the MediaPlayer create method, but i can't hear the sound. However, either MediaPlayer create or setDataSource method works perfectly on the emulator and galaxy s1, and s2, but not s3. i would like to work with the MediaPlayer create method because i have a synchronization problem with setDataSource method because my app downloads a stream of mp3 files from the internet, and i am using ArrayBlockingQueue class for that. is there any way to make MediaPlayer create method work on S3 ? – user1735273 Oct 10 '12 at 17:25
  • Sorry to hear that. The accepted answer on [this post](http://stackoverflow.com/questions/3533837/mediaplayer-setdatasource-and-prepare-not-working-android) might be useful since the issue varies between devices. Good luck! – acj Oct 10 '12 at 17:30