             self.executeClosureAsyncOnSessionQueueIfNecessary {
                 if self.captureMode == .arKit {
                     self.configureSession()
+                    self.setupContextIfNecessary()
                 } else {
                     self.configureSession()
                     self.configureSessionDevices()

extension NextLevel {
   
    public func arSession(_ session: ARSession, didUpdate frame: ARFrame) {
        let pixelBuffer = frame.capturedImage
        let timestamp = frame.timestamp
        
        self.videoDelegate?.nextLevel(self, willProcessFrame: frame, pixelBuffer: pixelBuffer, timestamp: timestamp, onQueue: self._sessionQueue)
        self._lastARFrame = pixelBuffer
        
        if let session = self._recordingSession {
            self.handleVideoOutput(pixelBuffer: pixelBuffer, timestamp: timestamp, session: session)
        }
    }
    

            
            // create a render context
            
            self.setupContextIfNecessary()
            
            var photoDict: [String: Any]? = nil
            if let customFrame = self._sessionVideoCustomContextImageBuffer {
