Using ExoPlayer
i'm trying to play two audio tracks simultaneously.
My idea was to create two MediaSource
, and to "combine" between them using MergingMediaSource
.
This is what I have done:
Uri uriAudio1 = Uri.parse(AUDIO_URL_1);
Uri uriAudio2 = Uri.parse(AUDIO_URL_2);
MediaSource audioSource1 = new ExtractorMediaSource(uriAudio1, dataSourceFactory, extractorsFactory, mainHandler, null);
MediaSource audioSource2 = new ExtractorMediaSource(uriAudio2, dataSourceFactory, extractorsFactory, mainHandler, null);
MergingMediaSource mergedAudioSource = new MergingMediaSource(audioSource1, audioSource2);
mPlayer.prepare(mergedAudioSource);
How ever instead of hearing both audio tracks in parallel, i hear only the first audioSource1
.
Any ideas? Thanks!
I ran into the same problem, solved it by using two different instances of Exoplayer, one for each audio asset, and playing them at the same time.