I want to play (render on the surface) two or more mp4 sequential video sequences (each of which is stored in a separate file on my device and may not be present at startup) on my Android device, in a smooth one (without kiosks, flicker, etc. .).) way. Thus, the viewer can get an idea of watching only one continuous video. At the first stage, this would be enough to achieve only my Nexus 7 tablet. To display only one video, I used the MediaCodec API similarly to http://dpsm.wordpress.com/2012/07/28/android-mediacodec-decoded/and it works great. Only by creating (and tuning) a second decoder after the completion of the first sequence (decoder.stop and decoder. Release of the first is called up), one can see a mixture. For smooth fading between two different video sequences, I thought about having an init function, where the second video is already initialized using decoder.configure (format, surface, null, 0) while playing the first. In addition, the first frame is also queued through decoder.queueInputBuffer. But this raises the following error:
01-13 16:20:37.182: E/BufferQueue(183): [SurfaceView] connect: already connected (cur=3, req=3)
01-13 16:20:37.182: E/MediaCodec(9148): native_window_api_connect returned an error: Invalid argument (-22)
01-13 16:20:37.182: E/Decoder Init(9148): Exception decoder.configure: java.lang.IllegalStateException
It seems to me that one surface can be used by only one decoder at a time. So is there any other possibility for this? Perhaps using OpenGL?
Best, Alex.
source
share