1 year ago

#94807

test-img

JackMorris

Java UTF8 encoding Subtitles Content

I take subtitle from URL and display it in exoplayer, but the subtitle content is full of symbols because the language of the text is Arabic, Greek, Chinese, etc. How do I encode MediaScource to UTF8 before displaying it in the video?

Here is my code to prepare the content of the subtitles:

MediaSource subtitleSource = 
    new SingleSampleMediaSource
            .Factory(dataSourceFactory)
            .createMediaSource(
                Uri.parse(subtitlesUrl), 
                subtitleFormat, 
                C.TIME_UNSET
            )
;

With this code it loads the subtitles correctly but only in English.

java

android-studio

utf-8

exoplayer

video-subtitles

0 Answers

Your Answer

Accepted video resources