pub unsafe trait ARSessionObserver: NSObjectProtocol {
// Provided methods
unsafe fn session_didFailWithError(
&self,
session: &ARSession,
error: &NSError,
)
where Self: Sized + Message { ... }
unsafe fn session_cameraDidChangeTrackingState(
&self,
session: &ARSession,
camera: &ARCamera,
)
where Self: Sized + Message { ... }
unsafe fn sessionWasInterrupted(&self, session: &ARSession)
where Self: Sized + Message { ... }
unsafe fn sessionInterruptionEnded(&self, session: &ARSession)
where Self: Sized + Message { ... }
unsafe fn sessionShouldAttemptRelocalization(
&self,
session: &ARSession,
) -> bool
where Self: Sized + Message { ... }
unsafe fn session_didOutputAudioSampleBuffer(
&self,
session: &ARSession,
audio_sample_buffer: &CMSampleBuffer,
)
where Self: Sized + Message { ... }
unsafe fn session_didOutputCollaborationData(
&self,
session: &ARSession,
data: &ARCollaborationData,
)
where Self: Sized + Message { ... }
unsafe fn session_didChangeGeoTrackingStatus(
&self,
session: &ARSession,
geo_tracking_status: &ARGeoTrackingStatus,
)
where Self: Sized + Message { ... }
}ARSession and objc2 only.Expand description
Provided Methods§
Sourceunsafe fn session_didFailWithError(&self, session: &ARSession, error: &NSError)
Available on crate feature objc2-foundation only.
unsafe fn session_didFailWithError(&self, session: &ARSession, error: &NSError)
objc2-foundation only.This is called when a session fails.
On failure the session will be paused.
Parameter session: The session that failed.
Parameter error: The error being reported (see ARError.h).
Sourceunsafe fn session_cameraDidChangeTrackingState(
&self,
session: &ARSession,
camera: &ARCamera,
)
Available on crate feature ARCamera only.
unsafe fn session_cameraDidChangeTrackingState( &self, session: &ARSession, camera: &ARCamera, )
ARCamera only.This is called when the camera’s tracking state has changed.
Parameter session: The session being run.
Parameter camera: The camera that changed tracking states.
Sourceunsafe fn sessionWasInterrupted(&self, session: &ARSession)
unsafe fn sessionWasInterrupted(&self, session: &ARSession)
This is called when a session is interrupted.
A session will be interrupted and no longer able to track when it fails to receive required sensor data. This happens when video capture is interrupted, for example when the application is sent to the background or when there are multiple foreground applications (see AVCaptureSessionInterruptionReason). No additional frame updates will be delivered until the interruption has ended.
Parameter session: The session that was interrupted.
Sourceunsafe fn sessionInterruptionEnded(&self, session: &ARSession)
unsafe fn sessionInterruptionEnded(&self, session: &ARSession)
This is called when a session interruption has ended.
A session will continue running from the last known state once
the interruption has ended. If the device has moved, anchors will be misaligned.
To avoid this, some applications may want to reset tracking (see ARSessionRunOptions)
or attempt to relocalize (see -[ARSessionObserver sessionShouldAttemptRelocalization:]).
Parameter session: The session that was interrupted.
Sourceunsafe fn sessionShouldAttemptRelocalization(&self, session: &ARSession) -> bool
unsafe fn sessionShouldAttemptRelocalization(&self, session: &ARSession) -> bool
This is called after a session resumes from a pause or interruption to determine whether or not the session should attempt to relocalize.
To avoid misaligned anchors, apps may wish to attempt a relocalization after
a session pause or interruption. If YES is returned: the session will begin relocalizing
and tracking state will switch to limited with reason relocalizing. If successful, the
session’s tracking state will return to normal. Because relocalization depends on
the user’s location, it can run indefinitely. Apps that wish to give up on relocalization
may call run with ARSessionRunOptionResetTracking at any time.
Parameter session: The session to relocalize.
Returns: Return YES to begin relocalizing.
Sourceunsafe fn session_didOutputAudioSampleBuffer(
&self,
session: &ARSession,
audio_sample_buffer: &CMSampleBuffer,
)
Available on crate feature objc2-core-media only.
unsafe fn session_didOutputAudioSampleBuffer( &self, session: &ARSession, audio_sample_buffer: &CMSampleBuffer, )
objc2-core-media only.This is called when the session outputs a new audio sample buffer.
Parameter session: The session being run.
Parameter audioSampleBuffer: The captured audio sample buffer.
Sourceunsafe fn session_didOutputCollaborationData(
&self,
session: &ARSession,
data: &ARCollaborationData,
)
Available on crate feature ARCollaborationData only.
unsafe fn session_didOutputCollaborationData( &self, session: &ARSession, data: &ARCollaborationData, )
ARCollaborationData only.This is called when the session generated new collaboration data.
This data should be sent to all participants.
Parameter session: The session that produced world tracking collaboration data.
Parameter data: Collaboration data to be sent to participants.
See: ARCollaborationData
Sourceunsafe fn session_didChangeGeoTrackingStatus(
&self,
session: &ARSession,
geo_tracking_status: &ARGeoTrackingStatus,
)
Available on crate feature ARGeoTrackingTypes only.
unsafe fn session_didChangeGeoTrackingStatus( &self, session: &ARSession, geo_tracking_status: &ARGeoTrackingStatus, )
ARGeoTrackingTypes only.This is called when geo tracking status changes.
Parameter session: The session being run.
Parameter geoTrackingStatus: Latest geo tracking status.