Пример #1
0
        /// <summary>
        /// Configures the recorder with the specified parameters.
        /// Use this to change the recorder settings in a script.
        /// This can't be done while recording is in progress.
        /// </summary>
        /// <param name="autoHeight">If set to <c>true</c>, the height will be computed automatically.</param>
        /// <param name="width">Width.</param>
        /// <param name="height">Height, will be ignored if autoHeight is enable.</param>
        /// <param name="fps">Frame per second.</param>
        /// <param name="length">Length in seconds.</param>
        public void Setup(bool autoHeight, int width, int height, int fps, float length)
        {
            if (_state == RecorderState.Recording)
            {
                Debug.LogWarning("Attempting to init the recorder while a recording is in process.");
                return;
            }

            // Start fresh
            FlushMemory();

            // Validate and set values
            _autoHeight = autoHeight;
            reflectionUtils.ConstrainMin(x => x._width, width);
            if (!_autoHeight)
            {
                reflectionUtils.ConstrainMin(x => x._height, height);
            }
            reflectionUtils.ConstrainRange(x => x._framePerSecond, fps);
            reflectionUtils.ConstrainRange(x => x._length, length);

            // Recalculate stuff
            Init();
        }