I have a simple Android multimedia player that can play multiple videos simultaneously on one screen. Thus, basically one screen of the media player is divided into 4 parts, with a copy of 4 glued together mediaPlayer, and each part plays this video.
It works almost normally when my video files are stored locally on the device. There are synchronization problems, but minor ones. But when I entered the URL for HTTP streaming, there are significant synchronization issues. What is the problem? How can I remove synchronization problems?
The only thing I could do was create media planners and prepare()them first, then call them start()one by one, so that at least the start time would be close to eachother. This does not have much effect.
Here I have a method that returns each of the instances mediaPlayer:
MediaPlayer mediaPreparation(String filename, boolean setMute) {
String url = "myURL";
MediaPlayer mediaPlayer = new MediaPlayer();
if (setMute) {
mediaPlayer.setVolume(0, 0);
}
try {
mediaPlayer.setDataSource(url);
mediaPlayer.prepare();
} catch (IOException e) {
}
mediaPlayer.setLooping(true);
return mediaPlayer;
}
And then I start them one by one:
mp[0].start();
mp[1].start();
mp[2].start();
mp[3].start();

source
share