     
     // MARK: funcs
         
-    override public func avcaptureDictionary() -> [String: Any]? {
+    public func avcaptureDictionary() -> [String: Any]? {
         if let options = self.options {
             return options
         } else {

            return config
        }
    }
    
}

// MARK: - PhotoConfiguration


public class NextLevelVideoConfiguration: NextLevelConfiguration {

    public var bitRate: UInt64                      // AVVideoAverageBitRateKey
    
    public var dimensions: CGSize?                  // AVVideoWidthKey, AVVideoHeightKey
    
    public var affineTransform: CGAffineTransform?
    
    public var codec: String                        // AVVideoCodecKey
    
    public var profileLevel: String?                // AVVideoProfileLevelKey (H.264 codec only)
    
    public var scalingMode: String?                 // AVVideoScalingModeKey
    
    public var maxFrameRate: CMTimeScale?           // AVVideoMaxKeyFrameIntervalKey
    
    public var timeScale: CGFloat?
    
    public var maximumCaptureDuration: CMTime?
    
    // TODO provide video sizing presets, ie. Square/Widescreen/etc
    
    // MARK: - object lifecycle
    
    override init() {
        self.bitRate = 2000000
        self.affineTransform = CGAffineTransform.identity
        self.codec = AVVideoCodecH264
        self.scalingMode = AVVideoScalingModeResizeAspectFill
        super.init()
    }
    
    // MARK: - func
    
    override public func avcaptureDictionary(withSampleBuffer sampleBuffer: CMSampleBuffer?) -> [String : Any]? {
        if let options = self.options {
            return options
        } else {
            var config: [String: Any] = [AVVideoAverageBitRateKey:self.bitRate]
            
            if let dimensions = self.dimensions {
                config[AVVideoWidthKey] = dimensions.width
                config[AVVideoHeightKey] = dimensions.height
            } else if let buffer = sampleBuffer {
                if let formatDescription: CMFormatDescription = CMSampleBufferGetFormatDescription(buffer) {
                    let videoDimensions = CMVideoFormatDescriptionGetDimensions(formatDescription)
                    config[AVVideoWidthKey] = videoDimensions.width
                    config[AVVideoHeightKey] = videoDimensions.height
                }
            }

            config[AVVideoCodecKey] = self.codec
            
            if let scalingMode = self.scalingMode {
                config[AVVideoScalingModeKey] = scalingMode
            }
            
            var compressionDict: [String:Any] = [:]
            compressionDict[AVVideoAllowFrameReorderingKey] = false
            compressionDict[AVVideoExpectedSourceFrameRateKey] = 30
            if let profileLevel = self.profileLevel {
                compressionDict[AVVideoProfileLevelKey] = profileLevel
            }
            if let maxFrameRate = self.maxFrameRate {
                compressionDict[AVVideoMaxKeyFrameIntervalKey] = maxFrameRate
            }
            config[AVVideoCompressionPropertiesKey] = compressionDict

            return config
        }
    }
