Struct medea_jason::RoomHandle [−][src]
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:
- Media server initiates media request.
disable_audio
/enable_video
is called.MediaStreamSettings
updated viaset_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 seton_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]
&self,
settings: &MediaStreamSettings,
stop_first: bool,
rollback_on_fail: bool
) -> Promise
Updates this Room
s MediaStreamSettings
. This affects all
PeerConnection
s 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::Track
s 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]
fn from(value: RoomHandle) -> Self
[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
unsafe fn from_abi(js: u32) -> Self
[src]
impl IntoWasmAbi for RoomHandle
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
fn into_abi(self) -> u32
[src]
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
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]
impl RefMutFromWasmAbi for RoomHandle
[src]
type Abi = u32
Same as RefFromWasmAbi::Abi
type Anchor = RefMut<'static, RoomHandle>
Same as RefFromWasmAbi::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]
impl WasmDescribe for RoomHandle
[src]
Auto Trait Implementations
impl !RefUnwindSafe for RoomHandle
impl !Send for RoomHandle
impl !Sync for RoomHandle
impl Unpin for RoomHandle
impl !UnwindSafe for RoomHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
[src]
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
pub fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.