pub struct AudioSession { /* private fields */ }Expand description
The phone’s audio session state, shared between the app’s reports and the call’s audio
(one per app; clones share it). It keeps what the app said before a call’s audio started
(CallKit may activate the session before the join has a call) and hands it to the next
AudioBridge::start_with_session:
- Activated / Deactivated are kept across calls (they are the OS’s state). On iOS a
bridge starts deferred and opens its device when the session is (or becomes) active; on
Android it opens at once, and a later
Deactivatedcloses it. - Suspend / Resume are kept until the call’s audio ends: a
Suspendbefore the audio starts pauses it from the start; a bridge that ends clears it. - RouteChanged goes to the live bridge only (a new bridge reads the route anyway).
- A repeated event (a second
Activated,ResumewithoutSuspend) is passed on once.
On desktop the events change nothing (the system backend has no session); the state is still kept.
Implementations§
Source§impl AudioSession
impl AudioSession
Sourcepub fn new() -> AudioSession
pub fn new() -> AudioSession
A new session state (nothing reported yet).
Sourcepub fn event(&self, event: SessionEvent)
pub fn event(&self, event: SessionEvent)
The app’s report. Never blocks (kessel-audio acts on its control thread).
Sourcepub fn is_active(&self) -> Option<bool>
pub fn is_active(&self) -> Option<bool>
What the app last said: active (Some(true)), not active, or None if it never said.
Sourcepub fn is_suspended(&self) -> bool
pub fn is_suspended(&self) -> bool
An interruption is going on (SessionEvent::Suspend without a Resume yet).
Trait Implementations§
Source§impl Clone for AudioSession
impl Clone for AudioSession
Source§impl Debug for AudioSession
impl Debug for AudioSession
Auto Trait Implementations§
impl Forget for AudioSession
impl Freeze for AudioSession
impl Move for AudioSession
impl RefUnwindSafe for AudioSession
impl Send for AudioSession
impl Sync for AudioSession
impl Unpin for AudioSession
impl UnsafeUnpin for AudioSession
impl UnwindSafe for AudioSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CryptoSafe for T
impl<T> CryptoSafe for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more