hello guys as of today video player 10.8 doesnt have support for included srt files in .mkv container. English is not my native language and i use a lot of .mkv with .srt inside of it. Exoplayer which video player is based on android has support out of the box via SubtitleView.
So i decided to modify video player source and added exoplayer-ui to android/build.gradle
dependencies {
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.6'
}
and then modified video_player-0.10.8+1/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java and added
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.ui.SubtitleView;
added my global variables...
private PlayerView simpleExoPlayerView;
private SubtitleView subs;
private SimpleExoPlayer exoPlayer;
then later on created them...
exoPlayer = ExoPlayerFactory.newSimpleInstance(context, trackSelector);
simpleExoPlayerView = new PlayerView(context);
and finally set my player to exoplayer like i would on exoplayer native android development
surface = new Surface(textureEntry.surfaceTexture());
exoPlayer.setVideoSurface(surface);
simpleExoPlayerView.setPlayer(exoPlayer);
subs = simpleExoPlayerView.getSubtitleView();
subs.setVisibility(View.VISIBLE);
My code compiles but i get audio of the movie im playing with a BLACKSCREEN so the file is actually playing. I know my problem relies on the surface im creating and I tried a couple of things that have not work. Any ideas how i could use SubtitleView to use my srt file inside the .mkv container?
Thank you!