MergingMediaSource causes the video to loop until the audio is finished
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I have two files, a video file and an audio file, and I play them mixed in the following way
``` java
MediaSource audioSource = new ProgressiveMediaSource.Factory(new FileDataSource.Factory())
.createMediaSource(MediaItem.fromUri("/sdcard/Download/3006-v.mp3"));
MediaSource videoSource = new ProgressiveMediaSource.Factory(new FileDataSource.Factory())
.createMediaSource(MediaItem.fromUri("/sdcard/Download/3006.mp4"));
MergingMediaSource mergingMediaSource =
new MergingMediaSource(audioSource, videoSource);
multiTrackSelector = new MultiTrackSelector();
mVideoPlayer = new SimpleExoPlayer.Builder(this, new MultiTrackRenderersFactory(2, this))
.setTrackSelector(new DefaultTrackSelector())
.build();
playerView.setPlayer(mVideoPlayer);
mVideoPlayer.setMediaSource(mergingMediaSource);
mVideoPlayer.prepare();
mVideoPlayer.setPlayWhenReady(true);
```
The duration of the video file is 15 s, and the duration of the audio file is 47 s. Now, through the above method, the picture will stop after the video is played, while the audio can continue to play. I hope that the video can be played in a loop until the audio is played.I would like to ask the exoplayer developer team how such a function can be achieved? thanks!
Contributor guide
Assessment
This issue has not been assessed yet.