MethodChannelFlutterMediaSession class

An implementation of FlutterMediaSessionPlatform that uses method channels.

Inheritance

Properties

eventChannel → EventChannel
The event channel used to receive media actions from the native platform.
final
hashCode → int
The hash code for this object.
no setterinherited
methodChannel → MethodChannel
The method channel used to interact with the native platform.
final
onMediaAction → Stream<MediaAction>
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

activate() → Future<void>
Activates the media session on the current platform.
override
deactivate() → Future<void>
Deactivates the media session on the current platform.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestNotificationPermission() → Future<bool>
Requests the POST_NOTIFICATIONS permission on Android (33+).
override
setActionLayout(ActionSlotLayout layout) → Future<void>
Sets the customizable action slot layout for system media controls.
override
setAppId(String id, {String? displayName, String? iconPath}) → Future<void>
Sets the application identity (App ID / AUMID / DesktopEntry) for the current process.
override
setAutoHandleInterruptions(bool enabled) → Future<void>
Opts the plugin into handling system audio interruptions (calls, navigation prompts, other apps grabbing audio).
override
setBackgroundKeepAlive(bool enabled) → Future<void>
Opts the session into a background keep-alive for off-device playback such as casting. Defaults to a no-op on platforms where not implemented.
override
setMediaLibrary(MediaLibraryChildrenProvider? getChildren) → Future<void>
Opts into a browsable media library (Android Auto and other Media3 browsers), whose items getChildren provides; null opts out. Has no effect on platforms without media browsers.
override
setPauseWhenDucked(bool enabled) → Future<void>
Pause instead of being ducked when another app speaks briefly (a navigation prompt), for spoken-word content. Has no effect where the platform doesn't duck.
override
setResumptionItem(MediaLibraryItem? item, Duration position) → Future<void>
A stream of media actions emitted by the current platform. Saves the library item to resume (or clears it with null), kept while the app is closed.
override
setSkipIntervals({int forwardSeconds = 10, int backwardSeconds = 10}) → Future<void>
Sets the preferred skip intervals for rewind (backward) and fast-forward (forward) commands.
override
setWindowsAppUserModelId(String id, {String? displayName, String? iconPath}) → Future<void>
Sets the AppUserModelID for the current process on Windows.
override
toString() → String
A string representation of this object.
inherited
updateAvailableActions(Set<MediaAction>? actions) → Future<void>
Updates the set of media actions available in system controls.
override
updateMetadata(MediaMetadata metadata) → Future<void>
Updates the media metadata on the current platform.
override
updatePlaybackState(PlaybackState state) → Future<void>
Updates the playback state on the current platform.
override
wasStartedInBackground() → Future<bool>
Whether the app was started in the background by a media browser (Android Auto) through the shared engine, rather than by the user opening it. False where that can't happen.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited