-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify/allow selection of multiple renderers of the same type in DefaultTrackSelector. #6589
Comments
Multiple streams with the same type of media require multiple renderers to play them at the same time. By default, ExoPlayer's You could in theory provide multiple |
If your app is doing nothing else with ExoPlayer and all the files are local, you can also consider using |
Thanks |
I want play a video with 6 audio files |
The way I described above seems to work with the added complication of needing a custom Please note that the renderers are not actively synchronized to each other, so depending on your alignment requirements between these streams, this may be a problem. You will also need to select the video track in the track selector if you want to enable it. Code I used for testing:
|
Thank you
In above code ".Builder" is red and show this message: " Cannot resolve symbol 'Builder' " In my MediaSources: what should I do? |
The builder is only available in the latest ExoPlayer version. You can use |
Thank you for your sample code and your help with your code i can play multiple audio files but dont show video. My code in media source dection:
what should I do for play video with this audio files in same time? |
Yes, sorry, this will only be part of 2.11.0 (once released). Your alternative is correct.
As pointed out above, you also need to select the video track in the Note that writing you own
This turned out to be quite complicated and I'll use this issue to track an enhancement for |
DefaultTrackSelector
.
DefaultTrackSelector
.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Can I switch between the video track and the audio track? |
I had the same code suggested here in order to play multiple tracks at the same time. But now after updating to ExoPlayer 2.17, it stopped working. The following is the error I can see:
Any suggestions on what can be causing this and if there's a quick fix? |
Thanks
ในวันที่ พฤ. 10 มี.ค. 2022 10:54 น. ziad-halabi9 ***@***.***>
เขียนว่า:
… I had the same code suggested here in order to play multiple tracks at the
same time. But now after updating to ExoPlayer 2.17, it stopped working.
The following is the error I can see:
E/ExoPlayerImplInternal: Playback error
com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:624)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:237)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalStateException
at com.google.android.exoplayer2.util.Assertions.checkState(Assertions.java:84)
at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.selectTracks(ProgressiveMediaPeriod.java:283)
at com.google.android.exoplayer2.source.MergingMediaPeriod.selectTracks(MergingMediaPeriod.java:153)
at com.google.android.exoplayer2.source.MaskingMediaPeriod.selectTracks(MaskingMediaPeriod.java:186)
at com.google.android.exoplayer2.MediaPeriodHolder.applyTrackSelection(MediaPeriodHolder.java:296)
at com.google.android.exoplayer2.MediaPeriodHolder.applyTrackSelection(MediaPeriodHolder.java:259)
at com.google.android.exoplayer2.MediaPeriodHolder.handlePrepared(MediaPeriodHolder.java:193)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handlePeriodPrepared(ExoPlayerImplInternal.java:2247)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:517)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:237)
at android.os.HandlerThread.run(HandlerThread.java:67)
Any suggestions on what can be causing this and if there's a quick fix?
—
Reply to this email directly, view it on GitHub
<#6589 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWY6HDK3XGTR67ZSANJGR33U7ILMNANCNFSM4JFSEOEA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
E/ExoPlayerImplInternal: Playback error |
ขอคำชี้แจง |
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 google#6589 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 3, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 google#6589 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 3, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 google#6589 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 2, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 google#6589 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 2, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 google#6589 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 2, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 google#6589 (comment) 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 2, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 http$://github.com/google/issues/6589#issuecomment-549864783 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 2, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 google#6589 (comment) 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 2, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
多音轨支持的一般思路: 1. 自定义 AudioRenderer 和 RendererFactory,创建多个 audio renderer 2. 自定义 TrackSelector,建立 track 和 renderer 之间的映射关系 3. build ExoPlayer 时设置自定义的 RendererFactory 和 TrackSelector 参考 google#6589 (comment) 此外,ExoPlayer 音频播放使用系统 media 的 AudioTrack,在版本 2.13.0 时, ExoPlayer 变更了 audioSessionId 的生成方式和时机,导致多个音轨 renderer 对应了同一个 audioSessionId 的 AudioTrack,从而播放异常。 所以,此版本 ExoPlayer 的多音轨支持基于上述思路又额外重构了 audioSessionId 的生成方式。 ExoPlayer audioSessionId 相关变动参考: google@a95b2eb note for dev: ```kotlin val renderersFactory = MultiAudioRenderersFactory( context, audioRenderersCount = 2, mediaClockRendererIndex = 0 ) val exoPlayer = ExoPlayer.Builder(context) .setRenderersFactory(renderersFactory) .build() ```
I want play multi sound in same time(simultaneously) in exoplayer but it only play mediaSource1 and mediaSource2. I want play all mediaSources at the same time(simultaneously)
My code with exoplayer is:
please help me
thanks
The text was updated successfully, but these errors were encountered: