0

I have AspectRationFrameLayout with three views (in this sequence):

  1. Exoplayer view (view with video)
  2. Cordova view (player's UI)
  3. Subtitle view

I need subtitles to be above "1.Exoplayer view", but below "2.Cordova view" to see player's UI. The problem is that when I place subtitle view below "2.Cordova view", subtitles disappear and not showing anymore.

The question itself is: what are the possible reasons why this is happening? What can I check?

Cordova view is transparent and you can see video through it, but not subtitles. Subtitles showing only when they are on top of Cordova view.

Please check screenshot below:

subtitle view on top

Konstantin Kozirev
  • 944
  • 1
  • 10
  • 23

1 Answers1

0

Hi there is no need of adding subtitle view exoplayer is coming with the subtitle feature u can use it like this

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);

for more detail check this tutorial and also you can check this bug discution

Virendra Varma
  • 895
  • 1
  • 12
  • 23
  • The thing is that I use closed captions track, that is inside ExoPlayer View. Sorry, but thank you very much for answer, but this won't help me, as I don't have *.srt subtitles. They are one of the renderedTracks of exoplayer. I just need some advise of where to check and what about View overlapping. Why View beneath can't be seen, while other view shows normally. – Konstantin Kozirev Sep 30 '18 at 10:51
  • to see the beneath view just set the transparent background to top_view – Virendra Varma Sep 30 '18 at 11:12
  • Didn't help, still doesn't show up. But thank you very much for answer. If you have any more suggestion, please write. – Konstantin Kozirev Sep 30 '18 at 11:46
  • check this https://stackoverflow.com/questions/46500962/how-to-make-custom-view-transparent-in-android – Virendra Varma Sep 30 '18 at 13:50