How to play mp3+g on mediaplayer android

江枫思渺然 提交于 2019-12-22 07:00:18

问题


I know we can play mp3 file in MediaPlayer. But can we play mp3+g on android??

I saw in the documentation on android, but i didn't see it. http://developer.android.com/guide/appendix/media-formats.html

Is there any work around or library to do this? Thanks


回答1:


I don't "think" that Android is going to support mp3+g playback anytime soon. That being said an mp3+g "file" should either be one zipped file(with two files inside) or two separate files named the same with exception of the file extension. So other then playing the MP3 there is really nothing else that MediaPLayer can do, and changing MediaPlayer int the android framework to get this to work would not be portable from device to device.

Workaround 1

Use FFMPEG to transcode and mux these files to a different format that is supported such as mp4. Here is an example of someone using ffmpeg to mux mp3+g into FLV.

Workaround 2

Another option would be to use Android For VLC which is in pre-alpha found here. Now I'm not sure that VLC for android will support mp3+g, but libvlc does support decoding of the two files so I'm guessing it would work, or you could alter the code a bit to get it to work. I have checked out the VLC for Android code recently and I have to say its a cpu hog but since mp3 and cdg are generally smaller less cpu intensive files I think that android devices could handle the work load using VLC.

Workaround 3

Now as far as more complex options you could utilize the Android NDK and create a decoder yourself (This would take you a lot of time).

Hope some of this helps you.




回答2:


I have found the solution..

http://code.google.com/p/cdg-toolkit/ It was written in java so we should porting it first to Android if you want to use it.



来源:https://stackoverflow.com/questions/9752125/how-to-play-mp3g-on-mediaplayer-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!