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. The recommended modern workflow is to bind an player adapter using bind.
Constructors
- FlutterMediaSession()
-
Factory constructor to return the singleton instance.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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.
-
bind(
MediaSessionAdapter adapter) → void - Binds a MediaSessionAdapter to this media session instance.
-
clearActionHandler(
) → void - Clears the active action handler, if any.
-
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
-
setActionHandler(
{VoidCallback? onPlay, VoidCallback? onPause, VoidCallback? onSkipToNext, VoidCallback? onSkipToPrevious, VoidCallback? onStop, void onSeekTo(Duration)?, VoidCallback? onRewind, VoidCallback? onFastForward, VoidCallback? onShuffle, VoidCallback? onRepeat}) → void - Sets high-level callbacks to handle system media actions without manually listening to streams.
-
setAutoHandleInterruptions(
bool enabled) → Future< void> - Opts the plugin into handling system audio interruptions (calls, navigation prompts, other apps grabbing audio).
-
setSkipIntervals(
{int forwardSeconds = 10, int backwardSeconds = 10}) → Future< void> - Sets the preferred skip intervals for rewind (backward) and fast-forward (forward) commands.
-
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
-
unbind(
) → void - Unbinds the currently active adapter, if any, and releases its resources.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited