Wednesday 6 July 2016

Show subtitles



Hello!
I'm developing an App and i have to open MX Player with a video and a subtitle file.
I use this code:

Intent intent = new Intent(Intent.ACTION_VIEW);

Parcelable[] parcels = {Uri.parse(fullFileName)};
Parcelable[] parcelsSub = {Uri.parse(fullFileName)};
String[] names = {"Sottotitoli"};

intent.setDataAndType(Uri.parse(fileVideoPath), "video/mp4");

intent.setPackage("com.mxtech.videoplayer.ad");
intent.setClassName("com.mxtech.videoplayer.ad", "com.mxtech.videoplayer.ad.ActivityScreen");

intent.putExtra("subs", parcels);
intent.putExtra("subs.enable", parcelsSub);
intent.putExtra("subs.name", names);

startActivity(intent);


The subtitiles are shown in Subtitles > Panels, but i have to check if i want to show them. I want that this subtitles are automatically shown when i start mxplayer.



No comments:

Post a Comment