I am investigating how to make an Android Exoplayer play a single content stream to multiple surfaces. For example, if the content stream is online, it would only be downloaded once, yet still be played on both surfaces.
I have investigated this topic, and can share what I have learned so far. Typically, it is not necessary to actually use multiple surfaces, since an OpenGL shader can be used to make a "split screen effect" where a single surface appears to play multiple videos. I actually am using OpenGL shaders for both of the surfaces already (they are in GLSurfaceViews
), but using a single surface does not seem to be an option, since one of the surfaces is forced to a low resolution using .setFixedSize()
and the other is not.
In a more low-level approach, I investigated whether it is possible to set multiple surfaces for the MediaCodec
wrapped in DemoPlayer
's MediaCodecVideoTrackRenderer
class. However, it seems that a MediaCodec
has been designed to only be configured with one surface, so this approach does not seem effective.
Another approach I have considered is to somehow share the output buffer of one player's MediaCodec
with the other players, though I am not sure whether this is practical or feasible.
Any ideas or guidance on how to play a single stream on multiple surfaces would be greatly appreciated. Thank you.