Send onInitialized
event only if device changed
This commit is contained in:
parent
de0d6cda5d
commit
0bc3ee12bf
@ -142,6 +142,11 @@ class CameraSession(private val context: Context, private val cameraManager: Cam
|
|||||||
|
|
||||||
Log.i(TAG, "Successfully updated CameraSession Configuration! isActive: ${config.isActive}")
|
Log.i(TAG, "Successfully updated CameraSession Configuration! isActive: ${config.isActive}")
|
||||||
this.configuration = config
|
this.configuration = config
|
||||||
|
|
||||||
|
// Notify about Camera initialization
|
||||||
|
if (diff.deviceChanged) {
|
||||||
|
callback.onInitialized()
|
||||||
|
}
|
||||||
} catch (error: Throwable) {
|
} catch (error: Throwable) {
|
||||||
Log.e(TAG, "Failed to configure CameraSession! Error: ${error.message}, Config-Diff: $diff", error)
|
Log.e(TAG, "Failed to configure CameraSession! Error: ${error.message}, Config-Diff: $diff", error)
|
||||||
callback.onError(error)
|
callback.onError(error)
|
||||||
@ -351,7 +356,6 @@ class CameraSession(private val context: Context, private val cameraManager: Cam
|
|||||||
}, CameraQueues.cameraQueue)
|
}, CameraQueues.cameraQueue)
|
||||||
|
|
||||||
Log.i(TAG, "Successfully configured Session with ${outputs.size} outputs for Camera #${cameraDevice.id}!")
|
Log.i(TAG, "Successfully configured Session with ${outputs.size} outputs for Camera #${cameraDevice.id}!")
|
||||||
callback.onInitialized()
|
|
||||||
|
|
||||||
// Update Frame Processor and RecordingSession for newly changed output
|
// Update Frame Processor and RecordingSession for newly changed output
|
||||||
updateVideoOutputs()
|
updateVideoOutputs()
|
||||||
|
@ -153,7 +153,6 @@ extension CameraSession {
|
|||||||
|
|
||||||
// Done!
|
// Done!
|
||||||
ReactLogger.log(level: .info, message: "Successfully configured all outputs!")
|
ReactLogger.log(level: .info, message: "Successfully configured all outputs!")
|
||||||
delegate?.onSessionInitialized()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pragma MARK: Orientation
|
// pragma MARK: Orientation
|
||||||
|
@ -160,6 +160,11 @@ class CameraSession: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate, AVC
|
|||||||
|
|
||||||
// Update successful, set the new configuration!
|
// Update successful, set the new configuration!
|
||||||
self.configuration = config
|
self.configuration = config
|
||||||
|
|
||||||
|
// Notify about Camera initialization
|
||||||
|
if difference.inputChanged {
|
||||||
|
delegate?.onSessionInitialized()
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
self.onConfigureError(error)
|
self.onConfigureError(error)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user