开发者

Playing a WMA in my android app

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜