Beispiel #1
0
    public void Initialize(string videoPath, KinectVideoPlayer.OnFrameUpdate frameUpdateCallback,
                           KinectVideoPlayer.OnFinishedPlaying finishedPlayingCallback, KinectVideoPlayer.OnSeeking seekingCallback)
    {
        if (initialized)
        {
            return;
        }

        if (!Directory.Exists(videoPath))
        {
            Directory.CreateDirectory(videoPath);
        }

        if (videoPlayer == null)
        {
            videoPlayer = KinectVideoPlayer.Create();
        }
        videoPlayer.Path = videoPath;
        videoPlayer.onFrameUpdateCallback = frameUpdateCallback;

        onFinishedPlaying = finishedPlayingCallback;
        onSeeking         = seekingCallback;

        videoPlayer.onFinishedPlayingCallback += OnFinishedPlaying;
        if (finishedPlayingCallback != null)
        {
            videoPlayer.onFinishedPlayingCallback += onFinishedPlaying;
        }
        if (onSeeking != null)
        {
            videoPlayer.onSeekingEvent += onSeeking;
        }

        if (videoRecorder == null)
        {
            videoRecorder = KinectVideoRecorder.Create();
        }
        videoRecorder.Path = videoPath;

        if (playbackSlider != null && videoPlayer != null)
        {
            playbackSlider.videoPlayer = videoPlayer;
        }

        buttonRecord.onClick.AddListener(OnRecord);
        buttonCompress.onClick.AddListener(OnCompress);
        buttonLoad.onClick.AddListener(OnLoad);

        initialized = true;
    }