Android MediaPlayer/VideoView w/Subtitles (SRT)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11403134/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android MediaPlayer/VideoView w/Subtitles (SRT)
提问by ajporterfield
Does Android's MediaPlayer support SRT subtitles? I've attempted to place the SRT file in the same directory as the video file and name it the same (with the exception of the extension of course), but haven't had any luck getting them to display. Any thoughts, recommendations?
Android 的 MediaPlayer 是否支持 SRT 字幕?我试图将 SRT 文件与视频文件放在同一目录中并为其命名(当然扩展名除外),但没有任何运气让它们显示。有什么想法、建议吗?
回答by Oak Bytes
Android 4.0.x version and below
Android 4.0.x 及以下版本
In case of Android 4.0 version and below, default Media Player did not support subtitles.
对于 Android 4.0 及以下版本,默认媒体播放器不支持字幕。
There are third party player apps available in Google Play which support subtitles. One of them is MoboPlayer
Google Play 中提供了支持字幕的第三方播放器应用程序。其中之一是MoboPlayer
If you are planning to do it using code, the following link is a good resource http://www.ittiam.com/wp-content/knowledge-center/whitepapers/WP006_rendering-subtitles-in-android.pdf
如果您打算使用代码来做,以下链接是一个很好的资源http://www.ittiam.com/wp-content/knowledge-center/whitepapers/WP006_rendering-subtitles-in-android.pdf
Android 4.1 (Jelly Bean - JB))
Android 4.1(果冻豆 - JB))
Android JB version has built in support for internal (present in MP4 files) and SRT external subtitles. More details is available at http://developer.android.com/about/versions/android-4.1.html#Multimedia
Android JB 版本内置支持内部(存在于 MP4 文件中)和 SRT 外部字幕。更多详细信息请访问http://developer.android.com/about/versions/android-4.1.html#Multimedia
回答by CodeFury
Hereis the awesome post on Subtitles support on Pre-Jellybean devices. Worked pretty well for me, indeed better than native support on 4.1. Hope this helps.
这是关于 Pre-Jellybean 设备上的字幕支持的精彩帖子。对我来说效果很好,确实比 4.1 的原生支持更好。希望这可以帮助。
Update: I made a demo project in my blogfor code reference
更新:我在我的博客中做了一个演示项目以供代码参考