如何使用exoplayer同时播放单独的音频和视频?

How to play separate audio and video together using exoplayer?

所以我有两个网址,一个用于音频,一个用于视频。我想一起玩,但真的找不到任何关于这个的文档。

我刚刚找到答案,只需像下面那样在 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)