pub struct AudioFrameSubscriber { /* private fields */ }
Expand description
Subscriber for receiving audio frames from a session
This is a handle that allows receiving decoded audio frames from a specific session. Use this to get audio data that should be played on speakers.
Implementations§
Source§impl AudioFrameSubscriber
impl AudioFrameSubscriber
Sourcepub fn new(
session_id: SessionId,
receiver: Receiver<AudioFrame>,
) -> AudioFrameSubscriber
pub fn new( session_id: SessionId, receiver: Receiver<AudioFrame>, ) -> AudioFrameSubscriber
Create a new audio frame subscriber
Sourcepub fn session_id(&self) -> &SessionId
pub fn session_id(&self) -> &SessionId
Get the session ID this subscriber is associated with
Sourcepub async fn recv(&mut self) -> Option<AudioFrame>
pub async fn recv(&mut self) -> Option<AudioFrame>
Receive the next audio frame (async)
§Returns
Some(audio_frame)
- Audio frame ready for playbackNone
- Channel is closed or session ended
Sourcepub fn try_recv(&mut self) -> Result<AudioFrame, TryRecvError>
pub fn try_recv(&mut self) -> Result<AudioFrame, TryRecvError>
Try to receive an audio frame (non-blocking)
§Returns
Ok(audio_frame)
- Audio frame ready for playbackErr(TryRecvError::Empty)
- No frame available right nowErr(TryRecvError::Disconnected)
- Channel is closed or session ended
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if the subscriber is still connected to the session
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AudioFrameSubscriber
impl RefUnwindSafe for AudioFrameSubscriber
impl Send for AudioFrameSubscriber
impl Sync for AudioFrameSubscriber
impl Unpin for AudioFrameSubscriber
impl UnwindSafe for AudioFrameSubscriber
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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