提交 c1bdaab7 编写于 作者: G guoshuyu

update exo subtitle

上级 b7d5983f
......@@ -92,9 +92,14 @@ public class GSYExoSubTitlePlayer extends IjkExo2MediaPlayer {
public MediaSource getTextSource(Uri subTitle) {
//todo C.SELECTION_FLAG_AUTOSELECT language MimeTypes
Format textFormat = new Format.Builder()
/// 其他的比如 text/x-ssa ,text/vtt,application/ttml+xml 等等
.setSampleMimeType(MimeTypes.APPLICATION_SUBRIP)
.setSelectionFlags(C.SELECTION_FLAG_FORCED)
.setLanguage("en").build();
/// 如果出现字幕不显示,可以通过修改这个语音去对应,
// 这个问题在内部的 selectTextTrack 时,TextTrackScore 通过 getFormatLanguageScore 方法判断语言获取匹配不上
// 就会不出现字幕
.setLanguage("en")
.build();
MediaItem.Subtitle subtitle = new MediaItem.Subtitle(
subTitle, checkNotNull(textFormat.sampleMimeType), textFormat.language, textFormat.selectionFlags);
......
......@@ -43,7 +43,7 @@ public class GSYExoSubTitleVideoView extends NormalGSYVideoPlayer {
mSubtitleView = findViewById(R.id.sub_title_view);
mSubtitleView.setStyle(new CaptionStyleCompat(Color.BLACK, Color.TRANSPARENT, Color.TRANSPARENT, CaptionStyleCompat.EDGE_TYPE_NONE, CaptionStyleCompat.EDGE_TYPE_NONE, null));
mSubtitleView.setStyle(new CaptionStyleCompat(Color.RED, Color.TRANSPARENT, Color.TRANSPARENT, CaptionStyleCompat.EDGE_TYPE_NONE, CaptionStyleCompat.EDGE_TYPE_NONE, null));
mSubtitleView.setFixedTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
}
......
......@@ -11,8 +11,8 @@ ext {
//Android
androidBuildToolsVersion = "28.0.3"
androidMinSdkVersion = 19
androidTargetSdkVersion = 28
androidCompileSdkVersion = 28
androidTargetSdkVersion = 29
androidCompileSdkVersion = 29
supportLibraryVersion = '1.1.0'
otherVersion = '1.0.0'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册