Struct medea_jason::RoomHandle[][src]

pub struct RoomHandle(_);

JS side handle to Room where all the media happens.

Actually, represents a Weak-based handle to InnerRoom.

For using RoomHandle on Rust side, consider the Room.

Implementations

impl RoomHandle[src]

pub async fn inner_join(&self, url: String) -> Result<(), JasonError>[src]

Implements externally visible RoomHandle::join.

Errors

With RoomError::CallbackNotSet if on_failed_local_media or on_connection_loss callbacks are not set.

With RoomError::SessionError if cannot connect to media server.

impl RoomHandle[src]

pub fn on_new_connection(&self, f: Function) -> Result<(), JsValue>[src]

Sets callback, which will be invoked when new Connection with some remote Peer is established.

pub fn on_close(&mut self, f: Function) -> Result<(), JsValue>[src]

Sets on_close callback, which will be invoked on Room close, providing RoomCloseReason.

pub fn on_local_track(&self, f: Function) -> Result<(), JsValue>[src]

Sets callback, which will be invoked when new local::Track will be added to this Room. This might happen in such cases:

  1. Media server initiates media request.
  2. disable_audio/enable_video is called.
  3. MediaStreamSettings updated via set_local_media_settings.

pub fn on_failed_local_media(&self, f: Function) -> Result<(), JsValue>[src]

Sets on_failed_local_media callback, which will be invoked on local media acquisition failures.

pub fn on_connection_loss(&self, f: Function) -> Result<(), JsValue>[src]

Sets on_connection_loss callback, which will be invoked on connection with server loss.

pub fn join(&self, token: String) -> Promise[src]

Connects media server and enters Room with provided authorization token.

Authorization token has fixed format: {{ Host URL }}/{{ Room ID }}/{{ Member ID }}?token={{ Auth Token }} (e.g. wss://medea.com/MyConf1/Alice?token=777).

Establishes connection with media server (if it doesn’t already exist). Fails if:

  • on_failed_local_media callback is not set
  • on_connection_loss callback is not set
  • unable to connect to media server.

Effectively returns Result<(), JasonError>.

pub fn set_local_media_settings(
    &self,
    settings: &MediaStreamSettings,
    stop_first: bool,
    rollback_on_fail: bool
) -> Promise
[src]

Updates this Rooms MediaStreamSettings. This affects all PeerConnections in this Room. If MediaStreamSettings is configured for some Room, then this Room can only send media tracks that correspond to this settings. MediaStreamSettings update will change media tracks in all sending peers, so that might cause new getUserMedia() request.

Media obtaining/injection errors are additionally fired to on_failed_local_media callback.

If stop_first set to true then affected local::Tracks will be dropped before new MediaStreamSettings is applied. This is usually required when changing video source device due to hardware limitations, e.g. having an active track sourced from device A may hinder getUserMedia() requests to device B.

rollback_on_fail option configures MediaStreamSettings update request to automatically rollback to previous settings if new settings cannot be applied.

If recovering from fail state isn’t possible then affected media types will be disabled.

pub fn mute_audio(&self) -> Promise[src]

Mutes outbound audio in this Room.

pub fn unmute_audio(&self) -> Promise[src]

Unmutes outbound audio in this Room.

pub fn mute_video(&self, source_kind: Option<JsMediaSourceKind>) -> Promise[src]

Mutes outbound video in this Room.

pub fn unmute_video(&self, source_kind: Option<JsMediaSourceKind>) -> Promise[src]

Unmutes outbound video in this Room.

pub fn disable_audio(&self) -> Promise[src]

Disables outbound audio in this Room.

pub fn enable_audio(&self) -> Promise[src]

Enables outbound audio in this Room.

pub fn disable_video(&self, source_kind: Option<JsMediaSourceKind>) -> Promise[src]

Disables outbound video.

Affects only video with specific JsMediaSourceKind if specified.

pub fn enable_video(&self, source_kind: Option<JsMediaSourceKind>) -> Promise[src]

Enables outbound video.

Affects only video with specific JsMediaSourceKind if specified.

pub fn disable_remote_audio(&self) -> Promise[src]

Disables inbound audio in this Room.

pub fn disable_remote_video(&self) -> Promise[src]

Disables inbound video in this Room.

pub fn enable_remote_audio(&self) -> Promise[src]

Enables inbound audio in this Room.

pub fn enable_remote_video(&self) -> Promise[src]

Enables inbound video in this Room.

Trait Implementations

impl From<RoomHandle> for JsValue[src]

impl FromWasmAbi for RoomHandle[src]

type Abi = u32

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

impl IntoWasmAbi for RoomHandle[src]

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

impl OptionFromWasmAbi for RoomHandle[src]

impl OptionIntoWasmAbi for RoomHandle[src]

impl RefFromWasmAbi for RoomHandle[src]

type Abi = u32

The wasm ABI type references to Self are recovered from.

type Anchor = Ref<'static, RoomHandle>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more

impl RefMutFromWasmAbi for RoomHandle[src]

type Abi = u32

Same as RefFromWasmAbi::Abi

type Anchor = RefMut<'static, RoomHandle>

Same as RefFromWasmAbi::Anchor

impl WasmDescribe for RoomHandle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ReturnWasmAbi for T where
    T: IntoWasmAbi
[src]

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<E> WrapTraced<E> for E[src]