Using the following code I was able to play back a udp stream (mpeg2 ts) which has 3 tracks (video, audio and dvb subtitles), but I am trying to retrieve the subtitle track and display it, i couldn't find any clear documentation on how to do it.
// Create LibVLC
ArrayList<String> options = new ArrayList<String>();
options.add("-vvv"); // verbosity
options.add("--autoscale");
libvlc = new LibVLC(this, options);
holder.setKeepScreenOn(true);
// Creating media player
mMediaPlayer = new MediaPlayer(libvlc);
mMediaPlayer.setAspectRatio("16:9");
mMediaPlayer.setEventListener(mPlayerListener);
// Seting up video output
final IVLCVout vout = mMediaPlayer.getVLCVout();
vout.setVideoView(mSurface);
if (mSubtitlesSurface != null)
vout.setSubtitlesView(mSubtitlesSurface);
vout.setWindowSize(1920,1080);
vout.addCallback(this);
vout.attachViews();
Media m = new Media(libvlc, Uri.parse(media));
mMediaPlayer.setMedia(m);
mMediaPlayer.play();
I am trying to use mMediaPlayer.getMedia().getTrackCount()
and mMediaPlayer.getSpuTracksCount()
which are returning zero in all cases; even the basic audio and video tracks are not counted.
Any help on this?
Note: I compiled LibVLC from [https://wiki.videolan.org/AndroidCompile/] and got the .aar archive to my project.
An argument added to options will help show the subtitles: