Hi, My camera access method is like this
func processCameraUpdates() async {
print("Process camera called")
let formats = CameraVideoFormat.supportedVideoFormats(for: .main, cameraPositions:[.left])
guard let cameraFrameUpdates =
cameraFrameProvider.cameraFrameUpdates(for: formats[0]) else {
return
}
for await cameraFrame in cameraFrameUpdates {
guard let mainCameraSample = cameraFrame.sample(for: .left) else {
continue
}
pixelBuffer = mainCameraSample.pixelBuffer
print("Pixel buffer updated)")
}
}
In my ImmersiveSpace
I am calling that method in this way
task {
// Main camera access
await placeManager.processCameraUpdates()
}
This works fine as long as app is in active / opened / foreground. Once I close the app and re-open, I cannot capture any image. What am I missing here? Do I need to do something when scene
become active
?