Skip to main content

MicrophoneHost

Trait MicrophoneHost 

Source
pub trait MicrophoneHost:
    Send
    + Sync
    + 'static {
    // Required methods
    fn availability(&self) -> Result<MicrophoneAvailability, MicrophoneError>;
    fn request_permission(
        &self,
        request: MicrophonePermissionRequest,
    ) -> Result<MicrophonePermission, MicrophoneError>;
    fn capture_audio(
        &self,
        request: MicrophoneCaptureRequest,
    ) -> Result<MicrophoneCapture, MicrophoneError>;
    fn cancel_capture(&self) -> Result<(), MicrophoneError>;
}
Expand description

Host-side microphone provider.

Required Methods§

Source

fn availability(&self) -> Result<MicrophoneAvailability, MicrophoneError>

Returns microphone permission state and available input devices.

Source

fn request_permission( &self, request: MicrophonePermissionRequest, ) -> Result<MicrophonePermission, MicrophoneError>

Requests microphone permission and returns the resulting state.

Source

fn capture_audio( &self, request: MicrophoneCaptureRequest, ) -> Result<MicrophoneCapture, MicrophoneError>

Captures bounded audio using the requested device and audio format preferences.

Source

fn cancel_capture(&self) -> Result<(), MicrophoneError>

Cancels an active microphone capture flow.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§