Instant switching between multiple videos upon user request

Hi,

is there a way to instantly switch between multiple videos (with audio) upon user request, e.g. when user presses a button? By instantly, I mean that there should be as little delay as possible when switching. The video currently playing should stop immediately. Also, the video that we switch to should start immediately and at a specific position which cannot be calculated before the user requests the switch.

My first approach was to create separate pipelines which have their own videosinks linked to their own SurfaceView. I found that switching between SurfaceViews is not that trivial as I expected, as their ZOrder cannot be changed dynamically. Hiding them temporarily would require to reconstruct the pipeline (as shown in the android tutorials) or at least switching the videosink of the existing pipeline to a new window handle.
I wonder if we could use TextureView instead of SurfaceView? If I understood this post correctly, the user “pedjaman” managed to get that working, but unfortunately, he did not provide the code.

Next approach: Using separate pipelines to decode the video to an intervideosink. Another pipeline with a intervideosrc and a glvideosink. Unfortunately, with this approach, we cannot transfer video memory, so I had to add a gldownload element. On the receiving side, I got an error “gluploadelement0: Failed to upload buffer”. Later, I found the following bug, so I did not look into the reasons for this error:
Bug 722877 - intervideosrc/intervideosink: cannot change channel while in playing state

Maybe I could try the improved instant url switching feature of playbin3?
I’d then have to find a way to seek to the desired position before any frames are output.
But I suspect that it would be much slower than using a separate pipeline with a flushing seek.

Are there any better approaches to accomplish this?

Using playbin3 or uridecodebin3 would be better option in my opinion.