How to show HLS embedded captions on Exoplayer

后端 未结 2 817
醉话见心
醉话见心 2021-02-11 00:40

how do I enable and also select different subtitles that are embedded in a Vimeo video in HLS format using Exoplayer, ExoMedia or another player? In iOS this same video already

2条回答
  •  执念已碎
    2021-02-11 01:46

    This works well!

    TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(rendererIndex);   
    
    TrackSelectionArray currentTrackGroups = player.getCurrentTrackSelections();
    TrackSelection currentTrackSelection = currentTrackGroups.get(rendererIndex);
    
    
        for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
    
            TrackGroup group = trackGroups.get(groupIndex);
    
            for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
                Format trackFormat = group.getFormat(trackIndex);
    
    
                if(currentTrackSelection!=null && currentTrackSelection.getSelectedFormat()==trackFormat){
                    //THIS ONE IS SELECTED
                }
    
    
    
    
            }
        }
    

    rendererIndex is 0 for Video, 1 for Audio and 2 for Subtitles/Text

提交回复
热议问题