pub struct VideoBridge { /* private fields */ }Expand description
The video bridge: a kessel-video backend’s cameras, screens and encoders into a call, with the in-call self-view. The video bridge: a kessel-video backend’s cameras, screens and encoders into a call, with the in-call self-view. The video bridge: a kessel-video backend’s cameras, screens and encoders into a call, with the in-call self-view. The video bridge of one app: a kessel-video backend into the current call.
Implementations§
Source§impl VideoBridge
impl VideoBridge
Sourcepub fn new(backend: Arc<dyn VideoBackend>) -> VideoBridge
pub fn new(backend: Arc<dyn VideoBackend>) -> VideoBridge
A bridge over backend (one per app).
Sourcepub fn with_capture(capture: VideoCapture) -> VideoBridge
pub fn with_capture(capture: VideoCapture) -> VideoBridge
A bridge over the app’s capture (its clones share the camera with the bridge: a
preview opened through one of them hands the camera over to the camera publish).
Sourcepub fn capture(&self) -> &VideoCapture
pub fn capture(&self) -> &VideoCapture
The capture the bridge opens its cameras through.
Sourcepub fn backend(&self) -> &Arc<dyn VideoBackend> ⓘ
pub fn backend(&self) -> &Arc<dyn VideoBackend> ⓘ
The backend.
Sourcepub fn events(&self) -> Receiver<SourceNote>
pub fn events(&self) -> Receiver<SourceNote>
The published sources’ events (pauses, resumes, ends), from now on.
Sourcepub fn self_view(&self) -> SelfViewFrames
pub fn self_view(&self) -> SelfViewFrames
The self-view from now on: each publication’s self-view layer (see the module docs), until the receiver is dropped or a newer one is asked for. While one is open the source never pauses, even with no layer wanted by anyone.
Sourcepub fn self_view_keyframe(&self, source: VideoSource)
pub fn self_view_keyframe(&self, source: VideoSource)
The self-view of source needs a keyframe (a sink opened, became visible or failed).
Never blocks.
Sourcepub async fn camera_state(&self) -> CameraState
pub async fn camera_state(&self) -> CameraState
The camera now: CameraState::On while VideoBridge::set_camera publishes it.
Sourcepub async fn camera_device(&self) -> Option<String>
pub async fn camera_device(&self) -> Option<String>
The camera device VideoBridge::set_camera publishes (None: the default, or off).
Sourcepub async fn publish_source(
&self,
call: &Call,
kind: VideoSource,
feed: SourceFeed,
temporal_layers: Option<u8>,
) -> Result<CameraState, VideoError>
pub async fn publish_source( &self, call: &Call, kind: VideoSource, feed: SourceFeed, temporal_layers: Option<u8>, ) -> Result<CameraState, VideoError>
Publishes kind from a source the host opened (see SourceFeed): the policy (video
on, the source allowed), the lease (self_video or self_stream), the codec and one
encoder per layer of the policy’s hints for that source, the publication and the
pipeline. The bridge owns the source from here; VideoBridge::stop_source ends it,
and so does the source’s own end.
Sourcepub async fn publish_capture(
&self,
call: &Call,
kind: VideoSource,
capture: Capture,
temporal_layers: Option<u8>,
) -> Result<CameraState, VideoError>
pub async fn publish_capture( &self, call: &Call, kind: VideoSource, capture: Capture, temporal_layers: Option<u8>, ) -> Result<CameraState, VideoError>
Publishes kind from a camera or screen opened through VideoCapture (a
crate::ScreenSource with crate::ScreenSource::into_capture): its size from its
first Started (at most its constraints), then as VideoBridge::publish_source.
Sourcepub async fn stop_source(
&self,
call: &Call,
kind: VideoSource,
) -> Result<(), VideoError>
pub async fn stop_source( &self, call: &Call, kind: VideoSource, ) -> Result<(), VideoError>
Ends a VideoBridge::publish_source or VideoBridge::publish_capture publication:
the track unpublished, the source dropped (closed), the lease released.
Sourcepub async fn set_camera(
&self,
call: &Call,
req: CameraRequest,
) -> Result<CameraState, VideoError>
pub async fn set_camera( &self, call: &Call, req: CameraRequest, ) -> Result<CameraState, VideoError>
Turns the camera on (see the module docs), switches it to another device, or turns it off (the track unpublished, the camera closed, the lease released).
Sourcepub async fn switch_camera(
&self,
call: &Call,
device: Option<String>,
) -> Result<CameraState, VideoError>
pub async fn switch_camera( &self, call: &Call, device: Option<String>, ) -> Result<CameraState, VideoError>
Switches the published camera to device (None: the default) when the camera is on;
CameraState::Off and nothing opened when it is off (a host’s camera choice between
set_camera calls).
Sourcepub async fn pause_camera(&self, paused: bool) -> bool
pub async fn pause_camera(&self, paused: bool) -> bool
Pauses (true) or resumes the camera’s pipeline, keeping its publication and lease (a
phone app in the background): no frame is captured (the source is paused) or encoded
while paused, and on the return every encoder is asked for a keyframe before the first
frame is encoded. crate::Call::set_video_muted tells subscribers. false: no camera
runs.
Sourcepub async fn reopen_held_camera(&self, call: &Call) -> bool
pub async fn reopen_held_camera(&self, call: &Call) -> bool
Opens the camera again (the same device; the publication and the lease kept, a
keyframe first) when the app is in front yet the camera is still paused by a background
pause that the OS never ended and no frame came since. false: nothing to do (no
camera, not held), or it did not open again; then the camera stays paused as it was
(published, the lease kept, no frames) and a later call may try again. It never turns
the camera off.
Sourcepub async fn close_call(&self, call: u64)
pub async fn close_call(&self, call: u64)
Stops the pipelines of one call (its Call::local_id) without touching the call (it
ended): a later call’s keep running. Each stop waits a short while at most; a pipeline
whose source closes slowly finishes on its own.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for VideoBridge
impl !RefUnwindSafe for VideoBridge
impl !UnwindSafe for VideoBridge
impl Forget for VideoBridge
impl Move for VideoBridge
impl Send for VideoBridge
impl Sync for VideoBridge
impl Unpin for VideoBridge
impl UnsafeUnpin for VideoBridge
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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