【问题标题】:View appears only on top or doesn't appear at all视图仅出现在顶部或根本不出现
【发布时间】:2018-09-30 10:22:12
【问题描述】:

我有带有三个视图的 AspectRationFrameLayout(按此顺序):

  1. Exoplayer 视图(带视频查看)
  2. Cordova 视图(玩家的 UI)
  3. 字幕视图

我需要字幕在“1.Exoplayer view”之上,但在“2.Cordova view”之下才能看到播放器的用户界面。 问题是,当我将字幕视图放在“2.Cordova 视图”下方时,字幕消失并且不再显示。

问题本身是:发生这种情况的可能原因是什么?我可以检查什么?

Cordova 视图是透明的,您可以通过它看到视频,但不能看到字幕。字幕仅在 Cordova 视图顶部显示。

请查看下面的截图:

【问题讨论】:

    标签: android android-layout exoplayer exoplayer2.x


    【解决方案1】:

    您好,无需添加字幕查看 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);
    

    更多细节请查看this tutorial,您也可以查看this 错误提示

    【讨论】:

    • 问题是我使用隐藏字幕轨道,即在 ExoPlayer 视图中。抱歉,非常感谢您的回答,但这对我没有帮助,因为我没有 *.srt 字幕。它们是 exoplayer 的 renderTracks 之一。我只需要一些关于在哪里检查以及如何查看重叠的建议。为什么看不到下面的视图,而其他视图正常显示。
    • 要查看下面的视图,只需将透明背景设置为 top_view
    • 没有帮助,仍然没有出现。但是非常感谢您的回答。如果您有更多建议,请写信。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-06
    • 1970-01-01
    • 2017-05-02
    • 2016-01-20
    • 2019-03-05
    • 1970-01-01
    • 2023-04-04
    相关资源
    最近更新 更多