To seek you should use the PlayPosition
property of VideoPlayer
(http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.videoplayer.playposition%28v=xnagamestudio.31%29.aspx)To seek you should use the PlayPosition
property of VideoPlayer
(http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.videoplayer.playposition%28v=xnagamestudio.31%29.aspx)
I think the best way to do this, if you want quick turnaround time, it to cache the VideoPlayer
instances.
Another idea would be just to cache the textures for x seconds, while the VideoPlayer
reloads the new file, then switch over to take the textures from the loaded one. To expand on this idea: you can make a new class CachedVideo
which will be a "lightweight" wrapper over Video
and VideoPlayer
. Here, you will implement the Update
and Draw
loops in a 'producer-consumer' pattern, using a circular buffer:
Update
takes a texture and puts it into the bufferDraw
takes one texture and draws it.
To allow a period of pre-buffering, you could specify a certain time amount to execute just the Update
loop before actually executing the Draw
call. This way, even if you need to loop the video, you'll already have something like 3-5 seconds of pre-buffering.
One problem still arises here is that the initial pre-buffering still takes a while. You could mitigate it by letting some sort of load screen to be shown in the meantime.