Ejemplo n.º 1
0
 void OnApplicationQuit()
 {
     // if the video texture is still playing kill it
     if (_videoTexture != null)
     {
         _videoTexture.stop();
         _videoTexture = null;
     }
 }
Ejemplo n.º 2
0
 void OnApplicationPause(bool paused)
 {
     if (paused)
     {
         // if the video texture is still playing kill it
         if (_videoTexture != null)
         {
             _videoTexture.stop();
             _videoTexture = null;
         }
     }
 }
Ejemplo n.º 3
0
 public static void registerInstance(int instanceId, VideoTexture instance)
 {
     videoTextureInstances[instanceId] = instance;
 }
Ejemplo n.º 4
0
        void OnGUI()
        {
            beginColumn();

            if (GUILayout.Button("Start Video Texture"))
            {
                // create the video texture. this video texture also illustrates how you can sync an AudioSource with the video
                _videoTexture = new VideoTexture("crazy-time.mp4", 320, 240);
                _videoTexture.syncAudioSource(GetComponent <AudioSource>());

                // apply the texture to a material and set the UVs
                targetOne.GetComponent <Renderer>().material.mainTexture = _videoTexture.texture;
                LiveTextureBinding.updateMaterialUVScaleForTexture(targetOne.GetComponent <Renderer>().sharedMaterial, _videoTexture.texture);

                // add some event handlers
                _videoTexture.videoDidStartEvent = () =>
                {
                    Debug.Log("Video one started");
                };
                _videoTexture.videoDidFinishEvent = () =>
                {
                    // when the video finishes if we are not set to loop this instance is no longer valid
                    Debug.Log("Video one finished");
                    targetOne.GetComponent <Renderer>().sharedMaterial.mainTexture = _yellowTexture;
                };
            }


            if (GUILayout.Button("Pause"))
            {
                // null check in case Stop was pressed which will kill the VideoTexture
                if (_videoTexture != null)
                {
                    _videoTexture.pause();
                }
            }


            if (GUILayout.Button("Unpause"))
            {
                // null check in case Stop was pressed which will kill the VideoTexture
                if (_videoTexture != null)
                {
                    _videoTexture.unpause();
                }
            }


            if (GUILayout.Button("Stop"))
            {
                // null check in case Stop was pressed which will kill the VideoTexture
                if (_videoTexture != null)
                {
                    _videoTexture.stop();
                    _videoTexture = null;
                }
            }

            endColumn();


            if (bottomLeftButton("Back"))
            {
                // if the video texture is still playing kill it
                OnApplicationQuit();

                Application.LoadLevel("CameraTestScene");
            }
        }