如何仅从视频文件在Android上播放音频? [英] How to play audio only from video file on Android?

查看:178
本文介绍了如何仅从视频文件在Android上播放音频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有MP4和WMV视频文件,并需要播放只有声音没有视频画面。怎么做??我可以从电影文件中获取音轨??

I have mp4 and wmv movie files and need to play only sound not video screen. How to do it?? Could I get sound track from movie file??

我知道,如果我隐藏屏幕SurfaceView,我只能听到声音。但我已经尝试了很多,但..这是不可能的。

I know if I hide the SurfaceView from screen, I can only hear sound.. but I have tried a lot but.. it is impossible.

如果您有任何解决方案,从电影文件中提取音轨,请让我知道..

If you have any solution to extract sound track from movie file, please let me know..

在此先感谢。

推荐答案

如果你在你的应用程序中使用的媒体播放器API,然后不要调用API 公共无效setDisplay(SurfaceHolder SH)。这将确保只有音频播放出来,即使在视频内容为present ..

If you are using the mediaplayer API in your app then don't call the API public void setDisplay (SurfaceHolder sh). This will ensure that only the audio is played out even if the video content is present..

在Android的DOC <一个更多信息href="http://developer.android.com/reference/android/media/MediaPlayer.html#setDisplay%28android.view.SurfaceHolder%29"相对=nofollow>这里

More info in android doc here

这篇关于如何仅从视频文件在Android上播放音频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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