How to add Subtitles(.SRT files) to video in Exoplayer android?

前端 未结 6 803
眼角桃花
眼角桃花 2020-12-28 10:03

i am working on a project where i should play .srt files along with video in android. I was working through the samples of Exoplayer but cant able to play .srt files with vi

6条回答
  •  北海茫月
    2020-12-28 10:57

    Aside from the merged media source I created a Listener for the Text Rendered as an Interface as in the Demo

        private final class ComponentListener implements TextRenderer.Output{
    
            @Override
            public void onCues(List cues) {
                if (subtitleView != null) {
                    subtitleView.onCues(cues);
                }
            }
        }
    
    player.setTextOutput(componentListener);
    

    I created an object and set the TextOutput as this

提交回复
热议问题