FlutterMediaSession class

The main entry point for the Flutter Media Session plugin.

This class provides a singleton interface to interact with the system media session, allowing you to update metadata, sync playback state, and listen for media actions.

Constructors

FlutterMediaSession()
Factory constructor to return the singleton instance.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
onMediaAction Stream<MediaAction>
A stream of media actions triggered from the system media controls.
no setter
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.
deactivate() Future<void>
Deactivates the media session and releases platform resources.
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+).
setHandlesInterruptions(bool enabled) Future<void>
Opts the plugin into handling system audio interruptions (calls, navigation prompts, other apps grabbing audio).
setWindowsAppUserModelId(String id, {String? displayName, String? iconPath}) Future<void>
Sets the AppUserModelID for the current process on Windows.
toString() String
A string representation of this object.
inherited
updateAvailableActions(Set<MediaAction>? actions) Future<void>
Updates which media actions are available in system controls.
updateMetadata(MediaMetadata metadata) Future<void>
Updates the media metadata (title, artist, album, etc.) displayed in system controls.
updatePlaybackState(PlaybackState state) Future<void>
Updates the playback state (status, position, speed) synchronized with system controls.

Operators

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