I want to load the first frame of a video and display it as a background.
videoPlayer.prepare()
is slow and i just want the first frame, not the whole video. Later in the game when needed I want to load and play the video. I’ve tried using videoPlayer.StepForward()
, but that requires the video to already be fully prepared.
Is there a way to load just the first frame of a videoClip
in VideoPlayer
?
I dont think that there its a way to do that, but try a snipping the first frame into a picture. (Forgive me if im wrong, im not the expert.)
same quesiton here, any solution ?
public void DoPrepare()
{
Task task = new Task(waitforprepare(), true);
task.Finished += (wait) => {
AfterLoadFirstFrame?.Invoke();
};
mVideoPlayer.Prepare();
}
public IEnumerator waitforprepare()
{
while (!mVideoPlayer.isPrepared)
yield return null;
mVideoPlayer.StepForward();
while (mVideoPlayer.frame < 0)
{
yield return null;
mVideoPlayer.StepForward();
}
}