I wish to display 2 video views side by side. I do not wish to implement custom MediaController because the default is very good, but, no matter what I did I could not control 2 videos simultaneously.
val mediaController = MediaController(requireContext())
mediaController.setAnchorView(videoViewF)
videoViewF.setMediaController(mediaController)
videoViewR.setMediaController(mediaController)
How can I achieve this? Can I get callback from MediaController or the first VideoView when progress is changed/paused/played? Or some other way?
Dual VideoView Playing 3gp Videos In Android
This example will explain how to include 2 Video View in layout to play different 3gp from at the same time.
Algorithm:
1.) Create a new project by File-> New -> Android Project name it DualVideoViewExample.
2.) Write following into main.xml:
3.) Put two 3gp video files in res/raw folder. 4.) Run for output.
Steps:
1.) Create a project named DualVideoViewExample and set the information as stated in the image.
Build Target: Android 4.4 Application Name: DualVideoViewExample Package Name: com.example.DualVideoViewExample Activity Name: DualVideoViewExampleActivity
2.) Open DualVideoViewExampleActivity.java file and write following code there:
3.) Compile and build the project.
NOTE : You can stream and play your 3gp direct from internet also instead of getting it from raw folder as shown in example.
Output