Posts

Showing posts with the label android-exoplayer

Exoplayer HLS doesn't show subtitle

Exoplayer HLS doesn't show subtitle I am developing a streaming app. I used for this purpose exoplayer2. I am using HLS streaming protocol. I need to show subtitle when streaming my videos. Everything goes well except subtitle. My player doesn't show the sample subtitle. My code is as following: uri = Uri.parse(url); videoSource = new HlsMediaSource.Factory(DATA_SOURCE_FACTORY).createMediaSource(uri); Uri uri1 = Uri.parse("https://bitdash-a.akamaihd.net/content/sintel/hls/subtitles_en.vtt"); 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"); DefaultBandwidthMeter bandwidthMeter2 = new DefaultBandwidthMeter(); DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(this, U...