Starting Video and Audio at a specific time

In my scene I have several game objects that have a video player and audio source. All the game objects are playing the same looping video and audio content.

How can I start each video and audio clip at a different time?

Example:
Screen01 starts at the beginning,
Screen02 starts 30 seconds into the video,
Screen03 starts at 60 seconds into the video,
and so on.

1 Like

Forgive me if it's uncouth to bump a thread in this forum... but I'm still stuck on this. I've tried everything I can think of.

Does anyone have any insight into how one can start a video playing on a frame other than frame 0?

Did you ever find a solution to this problem? I am stuck on this as well. I feel as if it should be simple but nothing has worked.

@lritterhh , no I haven’t.
Here’s my current code:

using UnityEngine;

public class MyPlayVideo : MonoBehaviour {
    private float t;
    private GvrVideoPlayerTexture player;

    public float delay = 2f;
    public long startFrame;

    void Start() {
        t = 0;
        player = GetComponent<GvrVideoPlayerTexture>();
        player.Init();
        player.Pause ();
        player.CurrentPosition = startFrame;  // I've also tried this code in update
    }

    void Update() {
        if (player.PlayerState == GvrVideoPlayerTexture.VideoPlayerState.Ended)
        {
            player.Pause ();
            player.CurrentPosition = 0;
            t = 0f;
            return;
        }
        
      t += Time.deltaTime;
      if (t >= delay)
        {
//        player.CurrentPosition = startFrame;  // it doesn't work here
            player.Play ();
//        player.CurrentPosition = startFrame;  // or here
          }
    }
}

This code successfully gets the video to play, after a delay. But it always starts on frame 0.

I’m just about to give up on Daydream. If this isn’t possible, I might have to consider a different platform/device.

You need some kind of SetFrame() function in your VideoPlayer:

public void SetFrame(long nFrame){
        nFrame = (long) Mathf.Clamp (nFrame, 0, video.clip.frameCount-1);
        video.frame = nFrame;
}

So you can replace the
player.CurrentPosition = startFrame;
by
player.SetFrame( startFrame );

I've haven't tested setting a frame in the video in months, so I can't confirm if it works in Unity v2017.3.1 (It didn't work fine a year ago).