示例#1
0
        private void videoRecordingDidSucceedEvent(string path)
        {
            Debug.Log("videoRecordingDidSucceedEvent: " + path);

            // save the video to the users photo album
            LiveTextureBinding.saveVideoToSavedPhotosAlbum(path);
        }
示例#2
0
 void OnApplicationPause(bool paused)
 {
     if (paused)
     {
         LiveTextureBinding.stopCameraCapture();
         texture = null;
     }
 }
示例#3
0
        void OnGUI()
        {
            beginColumn();


            if (GUILayout.Button("Request Access to Camera"))
            {
                LiveTextureBinding.requestAccessToCamera();
            }


            if (GUILayout.Button("Start Capture (low)"))
            {
                // start the camera capture and use the returned texture
                texture = LiveTextureBinding.startCameraCapture(false, LTCapturePreset.Size192x144);
                target.GetComponent <Renderer>().sharedMaterial.mainTexture = texture;
                LiveTextureBinding.updateMaterialUVScaleForTexture(target.GetComponent <Renderer>().sharedMaterial, texture);
                _isCameraCaptureStarted = true;
            }


            if (GUILayout.Button("Start Capture (high)"))
            {
                texture = LiveTextureBinding.startCameraCapture(false, LTCapturePreset.Size1280x720);
                target.GetComponent <Renderer>().sharedMaterial.mainTexture = texture;
                LiveTextureBinding.updateMaterialUVScaleForTexture(target.GetComponent <Renderer>().sharedMaterial, texture);
                _isCameraCaptureStarted = true;
            }


            if (GUILayout.Button("Start Capture (ultra high)"))
            {
                texture = LiveTextureBinding.startCameraCapture(false, LTCapturePreset.Size1920x1080);
                target.GetComponent <Renderer>().sharedMaterial.mainTexture = texture;
                LiveTextureBinding.updateMaterialUVScaleForTexture(target.GetComponent <Renderer>().sharedMaterial, texture);
                _isCameraCaptureStarted = true;
            }


            if (GUILayout.Button("Start Capture (front, low)"))
            {
                texture = LiveTextureBinding.startCameraCapture(true, LTCapturePreset.Size192x144);
                target.GetComponent <Renderer>().sharedMaterial.mainTexture = texture;
                LiveTextureBinding.updateMaterialUVScaleForTexture(target.GetComponent <Renderer>().sharedMaterial, texture);
                _isCameraCaptureStarted = true;
            }


            if (GUILayout.Button("Start Capture (front, high)"))
            {
                texture = LiveTextureBinding.startCameraCapture(true, LTCapturePreset.Size640x480);
                target.GetComponent <Renderer>().sharedMaterial.mainTexture = texture;
                LiveTextureBinding.updateMaterialUVScaleForTexture(target.GetComponent <Renderer>().sharedMaterial, texture);
                _isCameraCaptureStarted = true;
            }


            if (GUILayout.Button("Stop Capture"))
            {
                LiveTextureBinding.stopCameraCapture();
                texture = null;
                _isCameraCaptureStarted = false;
                target.GetComponent <Renderer>().sharedMaterial.mainTexture = _yellowTexture;
            }


            endColumn(true);


            if (GUILayout.Button("Start Recording Video"))
            {
                LiveTextureBinding.startRecordingCameraOutput("livetexture.mp4");
            }


            if (GUILayout.Button("Stop Recording Video"))
            {
                LiveTextureBinding.stopRecordingCameraOutput();
            }


            if (_isCameraCaptureStarted && GUILayout.Button("Set Exposure Mode"))
            {
                LiveTextureBinding.setExposureMode(LTExposureMode.ContinuousAutoExposure);
            }


            if (_isCameraCaptureStarted && GUILayout.Button("Set Focus Mode"))
            {
                LiveTextureBinding.setFocusMode(LTFocusMode.ContinuousAutoFocus);
            }


            endColumn();



            if (bottomRightButton("Next"))
            {
                LiveTextureBinding.stopCameraCapture();
                texture = null;

                Application.LoadLevel("VideoTestScene");
            }
        }
示例#4
0
 void OnApplicationQuit()
 {
     LiveTextureBinding.stopCameraCapture();
     texture = null;
 }
示例#5
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");
            }
        }