播放WMA在我的Andr​​oid应用 [英] Playing a WMA in my android app

查看:158
本文介绍了播放WMA在我的Andr​​oid应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单问题:

我用的MediaPlayer 播放MP3文件(他们玩就好了),而且我需要WMA文件的支持。我知道有些设备支持它,但不是所有的人,但我想一些方法,我敢肯定它会在任何设备上播放。有什么我可以实现或这样做,我可以播放MP3和WMA文件?

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?

现在我有两个测试钮,用同样的code,其中一个源是MP3(作品)其他相同code与WMA(失败)

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

推荐答案

你为什么不颖code中的wma文件为MP3或OGG(preferentially)? WMA是一个封闭的格式,它的支持依赖于一些并不总是在Android设备上可用的库,和他们不是AOSP树本身的一部分。话虽这么说,大多数AOSP ROM的衍生不会播放wma的。
所以最好的办法就是颖code中的文件,OGG或MP3。

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.

这篇关于播放WMA在我的Andr​​oid应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆