I am using the following intent to play a video with the android default Video Player.
File file = new File(galleryList.get(getAbsoluteAdapterPosition()).getPath());
Intent i = new Intent(Intent.ACTION_VIEW);
if (GalleryMediaHelper.isVideoFile(galleryList.get(getAbsoluteAdapterPosition()).getPath())) {
i.setDataAndType(FileProvider.getUriForFile(context, AUTHORITY, file), "video/*");
}
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION);
if (i.resolveActivity(context.getPackageManager()) != null)
context.startActivity(i);
So far so good. The video player starts playing the video. The problem is that, when the video is played the video player is closed and the user returns to the my app. -> NOK
How can I force video player to not close and either play on repeat the video or just wait for user to press back to exit video player?