pub struct BufferManager { /* private fields */ }Expand description
Buffer manager for video playback
Implementations§
Source§impl BufferManager
impl BufferManager
Sourcepub fn new(config: BufferConfig) -> Self
pub fn new(config: BufferConfig) -> Self
Create a new buffer manager
Sourcepub async fn add_segment(&self, segment: Segment, data: Bytes) -> Result<()>
pub async fn add_segment(&self, segment: Segment, data: Bytes) -> Result<()>
Add a segment to the buffer
Sourcepub async fn get_next_segment(&self) -> Option<BufferedSegment>
pub async fn get_next_segment(&self) -> Option<BufferedSegment>
Get the next segment to play
Sourcepub async fn get_segment_at(&self, time: f64) -> Option<BufferedSegment>
pub async fn get_segment_at(&self, time: f64) -> Option<BufferedSegment>
Get segment at specific time
Sourcepub async fn consume_segment(&self, sequence: u64)
pub async fn consume_segment(&self, sequence: u64)
Mark segment as consumed
Sourcepub async fn update_position(&self, position: f64)
pub async fn update_position(&self, position: f64)
Update playback position
Sourcepub async fn buffer_level(&self) -> f64
pub async fn buffer_level(&self) -> f64
Get current buffer level in seconds
Sourcepub async fn is_buffer_healthy(&self) -> bool
pub async fn is_buffer_healthy(&self) -> bool
Check if buffer is healthy for playback
Sourcepub async fn needs_data(&self) -> bool
pub async fn needs_data(&self) -> bool
Check if we need more data
Sourcepub async fn can_start_playback(&self) -> bool
pub async fn can_start_playback(&self) -> bool
Can start playback
Sourcepub async fn buffered_ranges(&self) -> Vec<(f64, f64)>
pub async fn buffered_ranges(&self) -> Vec<(f64, f64)>
Get buffered time ranges
Sourcepub async fn seek(&self, position: f64) -> Result<bool>
pub async fn seek(&self, position: f64) -> Result<bool>
Seek to position - returns true if position is buffered
Sourcepub async fn stats(&self) -> BufferStats
pub async fn stats(&self) -> BufferStats
Get buffer statistics
Sourcepub async fn queue_fetch(&self, segments: Vec<Segment>)
pub async fn queue_fetch(&self, segments: Vec<Segment>)
Queue segments for fetching
Sourcepub async fn next_fetch(&self) -> Option<Segment>
pub async fn next_fetch(&self) -> Option<Segment>
Get next segment to fetch
Auto Trait Implementations§
impl !Freeze for BufferManager
impl !RefUnwindSafe for BufferManager
impl Send for BufferManager
impl Sync for BufferManager
impl Unpin for BufferManager
impl UnsafeUnpin for BufferManager
impl !UnwindSafe for BufferManager
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