     renderer.scene = self.sceneView.scene
 
     initialTime = kCMTimeInvalid
+    isAudioSetup = false
 
     self.options.videoSize = options.videoSize
 

  private var isAudioSetup: Bool = false

  private var useAudio: Bool {
    return self.options.useMicrophone && AVAudioSession.sharedInstance().recordPermission() == .granted && isAudioSetup
  }
  private var videoFramesWritten: Bool = false
  private var waitingForPermissions: Bool = false

    do {
      try recordingSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
      try recordingSession.setActive(true)
      recordingSession.requestRecordPermission() { allowed in
        DispatchQueue.main.async {
          if allowed {
            self.options.useMicrophone = true
          } else {
            self.options.useMicrophone = false
          }
        }
      }
      isAudioSetup = true
    } catch {
      self.options.useMicrophone = false
    }

  }
