1

Simple question:

I'm using MediaPlayer to play mp3 files (they play just fine), but also i need support for WMA files. I know some devices support it, but not all of them, but i want some way where I'm sure it will play in any device. Is there anything i can implement or do so i can play Mp3 and WMA files?

right now i got two test buttons, with the same code, one the source is an Mp3 (works) the other same code with a wma (fails)

MediaPlayer mp = MediaPlayer.create(this, Uri.fromFile(source));
mp.start(); // no need to call prepare(); create() does that for you

Thanks. Alex

Ale K.
  • 306
  • 5
  • 18

1 Answers1

1

Why don't you reencode the wma file to mp3 or ogg (preferentially)? wma is a closed format and it's support depend on some libraries not always available on Android devices, and they're not part of the AOSP tree itself. That being said, most AOSP derived ROMs wont play wma's. So the best thing to do is to reencode the files to ogg or mp3.

Carlos Silva
  • 544
  • 3
  • 11
  • Converting was my first option but at some point i felt i hit a dead end as i didn't find any libs to acomplish exactly that. Anyways on the other hand, I'm buffering the file and then playing it using the InputStream first to buffer audio into a file (was running into many problems trying to go MediaPlayer Stream straight) and then playing it. mp3 files work fine everywhere, wma fails everywhere (even when i copied to windows and try to use the WMP to run it). – Ale K. Aug 16 '11 at 00:26
  • Find a free software on the net to do that for you :) There's lot's of them that convert wma to mp3 or ogg :) – Carlos Silva Aug 16 '11 at 01:44
  • ain't that easy Carlos, look at this: http://stackoverflow.com/questions/4725773/ffmpeg-on-android As far as i know ffmpeg is the closest i can get, and seriously for what I'm trying to do I'm not sure if is worth the effort, unless you have any kind of link or info that i haven't found. – Ale K. Aug 16 '11 at 02:37