Video Playback on Mobile Device using GoogleVR Gaze
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) https://github.com/cyrusclarke/googleVR_Unity_CinemaScene/tree/master
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. https://github.com/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!
Answer by cyrusclarke · Nov 27, 2016 at 08:17 AM
I managed to solve this so contact me if you ever need help getting movie textures deployed for VR on mobile devices!
Your answer
Follow this Question
Related Questions
How exactly does one get a video file on an android device? 0 Answers
I can't upload some quind of movies 0 Answers
Pick up Objects using Google Daydream Controller 2 Answers
Google VR SDK for Unity,Google VR SDK not setting to main camera 0 Answers
How do I move forward & raycast based on the MainCamera direction (in UFPS) 0 Answers