IEnumerator RecordFromVideo()
        {
            Logger.Info("Recording, DurationFrames=" + Movie.DurationFrames);
#if UNITY_EDITOR_OSX
            Movie.Pause();
            Movie.Rewind();              //plugin seems to skip movie ahead a few frames at startup. this reverses that.
            int currentFrameCount = Movie.DisplayFrame;
            while (Movie.SeekToNextFrame())
            {
                if (state == CaptureState.None ||
                    state == CaptureState.BakingAnimation)
                {
                    yield break;                                                           // exit early if interrupted
                }
                currentFrameCount = Movie.DisplayFrame;
                int frame = currentFrameCount;
                CurrentVideoFrame = currentFrameCount;
                UpdateFrameTexture();
                if (UpdateFrameBuffer())
                {
                    UpdateChannels();
                }
                Debug.Log("Capturing frame... " + currentFrameCount);
                CaptureFrame((frame - 1) * (1f / Movie.FrameRate));

                yield return(StartCoroutine(SeekNextFrame(Movie, currentFrameCount)));
            }
#else
            yield return(StartCoroutine(Seek(Movie, 1)));

            for (uint frame = 1; frame < Movie.DurationFrames; frame++)
            {
                Debug.Log("on frame " + frame + " of " + Movie.DurationFrames);
                if (state == CaptureState.None ||
                    state == CaptureState.BakingAnimation)
                {
                    yield break;                                                   // exit early if interrupted
                }
                CurrentVideoFrame = (int)frame;

                yield return(StartCoroutine(Seek(Movie, frame)));

                UpdateFrameTexture();
                if (UpdateFrameBuffer())
                {
                    UpdateChannels();
                }
                Debug.Log("Capturing frame... " + (frame - 1) * (1f / Movie.FrameRate));
                CaptureFrame((frame - 1) * (1f / Movie.FrameRate));
            }
#endif
            videoFinished = true;
            //StopRecordingFromVideo(null);
        }