pub struct MediaDevices;
Expand description

Media devices controller.

Implementations§

source§

impl MediaDevices

source

pub async fn enumerate_devices( &self ) -> Result<Vec<MediaDeviceInfo>, Traced<Error>>

Collects information about available media input devices.

Adapter for the MediaDevices.enumerateDevices() function.

Errors

If MediaDevices.enumerateDevices() errors itself or unable to get MediaDevices.

source

pub async fn enumerate_displays( &self ) -> Result<Vec<MediaDisplayInfo>, Traced<Error>>

Collects information about available displays.

Errors

If platform call returns error.

source

pub async fn get_user_media( &self, caps: MediaStreamConstraints ) -> Result<Vec<MediaStreamTrack>, Traced<GetUserMediaError>>

Prompts a user for permissions to use a media input device, producing MediaStreamTracks containing the requested types of media.

Adapter for the MediaDevices.getUserMedia() function.

Errors

If MediaDevices.getUserMedia() errors itself or unable to get MediaDevices.

source

pub async fn get_display_media( &self, caps: DisplayMediaStreamConstraints ) -> Result<Vec<MediaStreamTrack>, Traced<Error>>

Prompts a user to select and grant permissions to capture contents of a display or portion thereof (such as a single window), producing MediaStreamTracks containing the requested types of media.

Adapter for a MediaDevices.getDisplayMedia() function.

Errors

If MediaDevices.getDisplayMedia() errors itself or unable to get MediaDevices.

source

pub async fn set_output_audio_id( &self, device_id: String ) -> Result<(), Traced<Error>>

Switches the current output audio device to the device with the provided device_id.

Errors

If output audio device with the provided device_id is not available.

source

pub async fn microphone_volume_is_available(&self) -> bool

Indicates whether it’s possible to access microphone volume settings.

source

pub async fn microphone_volume(&self) -> Result<i64, Traced<Error>>

Returns the current microphone volume level in percents.

Errors

If it the “Audio Device Module” is not initialized or there is no connected audio input devices.

source

pub async fn set_microphone_volume( &self, level: i64 ) -> Result<(), Traced<Error>>

Sets the microphone volume level in percents.

Errors

If it the “Audio Device Module” is not initialized or there is no connected audio input devices.

source

pub fn on_device_change<F>(&self, handler: Option<F>)where F: 'static + FnMut(),

Subscribes onto the MediaDevices’s devicechange event.

Trait Implementations§

source§

impl Clone for MediaDevices

source§

fn clone(&self) -> MediaDevices

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MediaDevices

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for MediaDevices

source§

fn default() -> MediaDevices

Returns the “default value” for a type. Read more
source§

impl Copy for MediaDevices

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<E> WrapTraced<E> for E

source§

fn wrap_traced(self, f: Frame) -> Traced<E>

Wraps this error into a Traced wrapper, storing the given Frame of a Trace inside.
source§

impl<T> DartSafe for Twhere T: UnwindSafe + RefUnwindSafe,