I’m trying to use the GoogleVR SDK in Unity to control the playback of videos which are loaded on to 4 GameObjects.
Here is some working code for this in Unity (maybe useful for someone else) GitHub - cyrusclarke/googleVR_Unity_CinemaScene
If you deploy this with a working package, the repticle or pointer enables video playback after 3s of “gaze”. If the gaze is broken, the video is paused. There is also a counter to measure the time spent gazing at any given GameObject.
The problem is that MovieTexture is not supported for builds to mobile and I need to get this working for mobile. So I have got a plugin which anyone using video on Unity probably knows - EasyMovieTexture.
I have tried to follow the same process as before, calling a function from the source code of the package but this did not work. The new plugin has a script called MediaPlayerCtrl So I am trying to create an object based on that class and this gives me some ability to manipulate the video playback (play/pause etc.) however I still cannot link this back to the GoogleVR Repticle.
I have posted this code in another repository here. GitHub - cyrusclarke/newRepo
The approach I am thinking is to use GvrReticleNew.cs script to call a function in the mCtrls.cs script via the TimedInputHandler.cs. I have tried passing the HandleTimeInput function to the Update function and then letting the TimedInputHandler connect to the GvrReticle however this approach has not worked.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class mCtrl : MonoBehaviour {
public MediaPlayerCtrl mCtrl1;
//Load some file to the MediaPlayer Controller for the GameObject and play
private void Awake () {
Debug.Log ("alive");
mCtrl1.Load ("IXDAParody.mp4");
mCtrl1.Play();
}
void Update () {
HandleTimeInput ();
}
public void HandleTimeInput () {
///Basic Controls for Playback
if (Input.GetKeyDown ("p")){
mCtrl1.Pause ();
}
if(Input.GetKeyDown ("s")){
mCtrl1.Play();
}
//Check Gaze (not working)
Debug.Log("IM GAZING");
}
}
Well and truly stuck on this so any advice or help would be massively appreciated!