android - 视图仅出现在顶部或根本不出现
问题描述
我有具有三个视图的 AspectRationFrameLayout(按此顺序):
- Exoplayer 视图(带视频查看)
- Cordova 视图(玩家的 UI)
- 字幕视图
我需要字幕高于“1.Exoplayer 视图”,但低于“2.Cordova 视图”以查看播放器的 UI。问题是当我将字幕视图放在“2.Cordova 视图”下方时,字幕消失并且不再显示。
问题本身是:发生这种情况的可能原因是什么?我可以检查什么?
Cordova 视图是透明的,您可以通过它看到视频,但不能看到字幕。字幕仅在位于 Cordova 视图顶部时显示。
请检查下面的截图:
解决方案
嗨,无需添加字幕视图 exoplayer 带有字幕功能,您可以像这样使用它
MediaSource mediaSource = new ExtractorMediaSource(Uri.parse("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"),
mediaDataSourceFactory, extractorsFactory, null, null);
Format textFormat = Format.createTextSampleFormat(null, MimeTypes.APPLICATION_SUBRIP,
null, Format.NO_VALUE, Format.NO_VALUE, "en", null);
Uri uri = Uri.parse("http://www.storiesinflight.com/js_videosub/jellies.srt");
MediaSource subtitleSource = new SingleSampleMediaSource(uri, mediaDataSourceFactory, textFormat, C.TIME_UNSET);
MergingMediaSource mergedSource = new MergingMediaSource(mediaSource, subtitleSource);
player.prepare(mergedSource);
推荐阅读
- c - 如何在 C 中运行计时器
- javascript - 在 MongoDB 中将 _id 字段设置为 ObjectId,然后再将其写入 DB
- python - 在python中通过命令行强制用户输入
- python - GCD 分数代码错误且未打印出正确答案
- wpf - 如何将参数从构造函数参数传递给WPF中的viewmodel构造函数
- xaml - 我怎样才能使控件仅在绑定值不是空格时才可见?
- angular - 从 NgRx 中的 RESTful API “渐进式”加载实体
- linux - Linux Shell 脚本已执行但未返回命令提示符
- python - 基于大量 xy 点从二维数组中提取插值
- powershell - WinSCP SSH 错误 未知命令 'ssh-rsa'