ExoPlayer play multiple videos simultaneously
Asked Answered
C

1

6

I am building a video player android application where I need to play 2(maybe 4) live streams at the same time in the same view. Sample UI

Is it possible using a single exoplayer instance? If yes, please suggest how, also how to handle audio as I only need to play audio from a single stream. If no, then how should I proceed with it?

Thank you

Caerleon answered 4/6, 2021 at 10:20 Comment(3)
This seems like a pretty advanced use-case if you need to achieve it. Simpler solution would be to use multiple PlayerViews which although might end up being resource heavy. You can take a look at this and thisAudacious
AS @Audacious says it sounds like it would be easier to have separate ExoPlayer instances, and I am not sure if would really be that much more overhead as each stream has to be decoded and displayed either way. Maybe there is some reason you need it combined into a single video?Rosewood
Anything else you may suggest me? Any possibility working with renders?Caerleon
P
0

You can use merging media source with a custom renderers factory that creates multiple renderers and loads them with the specific video tracks using a custom track selector logic. By this method, you can have multiple video renderers rendering to a specific surface views and Exoplayer takes care of the synchronisation.

Puissance answered 22/10 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.