exoplayer leanback字幕

时间:2018-07-24 22:49:44

标签: android exoplayer subtitle leanback

我正在使用leanback及其exoplayew扩展进行项目开发,使用以下示例作为基本代码:https://github.com/googlesamples/androidtv-Leanback,我的问题是,当尝试使用以下代码播放带字幕的视频时,视频已播放,但未显示字幕。有没有人在使用leanback和exoplayer时遇到相同的问题?

 Format subtitleFormat = Format.createTextSampleFormat(
                        null, // An identifier for the track. May be null.
                        MimeTypes.APPLICATION_SUBRIP, // The mime type. Must be set correctly.
                        Format.NO_VALUE, // Selection flags for the track.
                        "en"); // The subtitle language.
    DataSource.Factory mediaDataSourceFactory =  new DefaultDataSourceFactory(getActivity(), userAgent);
                MediaSource subtitleSource =       new SingleSampleMediaSource.Factory(mediaDataSourceFactory)
                .createMediaSource(Uri.parse("http://45.79.158.247/test.srt"), subtitleFormat, C.TIME_UNSET);
        // Plays the video with the sideloaded subtitle.
                MergingMediaSource mergedSource =
                        new MergingMediaSource(mediaSource, subtitleSource);

0 个答案:

没有答案