So I have two urls one for audio and one for video. I want to play them together but really couldn't find any documentation about this.
I just found the answer just build it like below in kotlin:
val dataSourceFactory: DataSource.Factory =
DefaultHttpDataSource.Factory()
val videoSource: MediaSource = ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(fromUri(videoInPlayer.videoStreams[0].url))
val audioSource: MediaSource = ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(fromUri(videoInPlayer.audioStreams[0].url))
val mergeSource: MediaSource = MergingMediaSource(videoSource,audioSource)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With