Load internal subtitle with Codec: DVD Subtitles (spu) in Android MediaPlayer

Viewed 47

I'm trying to build a media player from scratch to improve my skills in android, the current problem I'm facing is that I am unable to read the internal subtitles as MediaPlayer does not support the codec I'm trying to load.

I tried using FFmpeg but the application does not even build when I use the library. Is there an alternate way to integrate a library into my application to get MediaPlayer to read the internal subtitle?

I read a bit about vlc but I cannot figure out how to integrate it to my application.

Any help would be appreciated

1 Answers

I used this library to compile VLC which allowed me to get the subtitle encoding.

implementation 'org.videolan.android:libvlc-all:3.3.13'

to get the subtitle track you need to pass the file to the media player and get the subtitle using this method

mediaPlayer.getSpuTracks();
Related