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.
@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.