Skip to main content

## RemoteVolumeControl

# Trait RemoteVolumeControl

Source

    pub trait RemoteVolumeControl: Send + Sync {
        // Required methods
        fn enable(&self, initial_volume: i32);
        fn disable(&self);
    }

Expand description

Platform hook for attaching/detaching the OS remote-volume control.

On Android, entering remote mode hands the `MediaSession` a `VolumeProviderCompat` so hardware volume buttons and the system slider drive the remote session; leaving remote mode must hand it back to the local media stream. Behind a trait so the routing rule (see `PlaybackModeManager::set_mode`) is unit-testable off-device — the real implementation is JNI and only exists on Android.

## Required Methods§

Source

#### fn enable(&self, initial_volume: i32)

Attach remote-volume control (and, on Android, start the playback service).

Source

#### fn disable(&self)

Return volume control to the local device speaker.

## Implementors§

Source §

### impl RemoteVolumeControl for PlatformRemoteVolumeControl