Struct medea_jason::platform::MediaDevices
source · pub struct MediaDevices;
Expand description
Media devices controller.
Implementations§
source§impl MediaDevices
impl MediaDevices
sourcepub async fn enumerate_devices(
&self
) -> Result<Vec<MediaDeviceInfo>, Traced<Error>>
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.
sourcepub async fn enumerate_displays(
&self
) -> Result<Vec<MediaDisplayInfo>, Traced<Error>>
pub async fn enumerate_displays( &self ) -> Result<Vec<MediaDisplayInfo>, Traced<Error>>
sourcepub async fn get_user_media(
&self,
caps: MediaStreamConstraints
) -> Result<Vec<MediaStreamTrack>, Traced<GetUserMediaError>>
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
MediaStreamTrack
s containing the requested types of media.
Adapter for the MediaDevices.getUserMedia() function.
Errors
If MediaDevices.getUserMedia() errors itself or unable to get MediaDevices.
sourcepub async fn get_display_media(
&self,
caps: DisplayMediaStreamConstraints
) -> Result<Vec<MediaStreamTrack>, Traced<Error>>
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
MediaStreamTrack
s containing the requested types of media.
Adapter for a MediaDevices.getDisplayMedia() function.
Errors
If MediaDevices.getDisplayMedia() errors itself or unable to get MediaDevices.
sourcepub async fn set_output_audio_id(
&self,
device_id: String
) -> Result<(), Traced<Error>>
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.
sourcepub async fn microphone_volume_is_available(&self) -> bool
pub async fn microphone_volume_is_available(&self) -> bool
Indicates whether it’s possible to access microphone volume settings.
sourcepub async fn microphone_volume(&self) -> Result<i64, Traced<Error>>
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.
sourcepub async fn set_microphone_volume(
&self,
level: i64
) -> Result<(), Traced<Error>>
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.
sourcepub fn on_device_change<F>(&self, handler: Option<F>)where
F: 'static + FnMut(),
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
impl Clone for MediaDevices
source§fn clone(&self) -> MediaDevices
fn clone(&self) -> MediaDevices
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more