Пример #1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (eventData.button == PointerEventData.InputButton.Left)
        {
            if (!videoPlayer.IsPlaying)
            {
                videoPlayer.Play();
                videoPlayer.Pause();
            }

            videoPlayer.UseExtendedSeeking = true;
            videoPlayer.Seek = Mathf.Clamp01(Value) * videoPlayer.Duration;
        }
    }
Пример #2
0
    public void OnRecord()
    {
        if (!initialized)
        {
            return;
        }

        if (videoPlayer.IsPlaying || KinectVideoCompressor.IsCompressing)
        {
            return;
        }

        if (!videoRecorder.IsRecording)
        {
#if UNITY_EDITOR || !UNITY_WINRT
            if (Directory.Exists(videoRecorder.Path))
            {
                Directory.Delete(videoRecorder.Path, true);
                Directory.CreateDirectory(videoRecorder.Path);
            }
#endif
            videoRecorder.StartRecorder();

            buttonCompress.gameObject.SetActive(false);
            buttonRecord.GetComponentInChildren <Text>().text       = "Stop Recording";
            buttonRecord.GetComponentsInChildren <Image>()[1].color = GREEN_COLOR;

            playbackSlider.gameObject.SetActive(false);
        }
        else
        {
            videoRecorder.Stop(out videoDuration);

            videoPlayer.Play(videoDuration, videoCompressed);

            if (videoPlayer.IsPlaying)
            {
                playbackSlider.gameObject.SetActive(true);
            }

            buttonCompress.gameObject.SetActive(true);
            buttonRecord.GetComponentInChildren <Text>().text       = "Start Recording";
            buttonRecord.GetComponentsInChildren <Image>()[1].color = RED_COLOR;
        }
    }