AudioHandler class abstract

An AudioHandler plays audio, provides state updates and query results to clients. It implements standard protocols that allow it to be remotely controlled by the lock screen, media notifications, the iOS control center, headsets, smart watches, car audio systems, and other compatible agents.

This class cannot be subclassed directly. Implementations should subclass BaseAudioHandler, and composite behaviours should be defined as subclasses of CompositeAudioHandler.

Implementers

Properties

androidPlaybackInfo → ValueStream<AndroidPlaybackInfo>
A value stream of the current AndroidPlaybackInfo.
no setter
customEvent Stream
A stream of custom events.
no setter
customState → ValueStream
A stream of custom states.
no setter
hashCode int
The hash code for this object.
no setterinherited
mediaItem → ValueStream<MediaItem?>
A value stream of the current media item.
no setter
playbackState → ValueStream<PlaybackState>
A value stream of playback states.
no setter
queue → ValueStream<List<MediaItem>>
A value stream of the current queue.
no setter
queueTitle → ValueStream<String>
A value stream of the current queueTitle.
no setter
ratingStyle → ValueStream<RatingStyle>
A value stream of the current rating style.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addQueueItem(MediaItem mediaItem) Future<void>
Add mediaItem to the queue.
addQueueItems(List<MediaItem> mediaItems) Future<void>
Add mediaItems to the queue.
androidAdjustRemoteVolume(AndroidVolumeDirection direction) Future<void>
Adjust the remote volume on Android. This works only when using RemoteAndroidPlaybackInfo.
androidSetRemoteVolume(int volumeIndex) Future<void>
Set the remote volume on Android. This works only when using RemoteAndroidPlaybackInfo.
click([MediaButton button = MediaButton.media]) Future<void>
Process a headset button click, where button defaults to MediaButton.media.
customAction(String name, [Map<String, dynamic>? extras]) Future
A mechanism to support app-specific actions.
fastForward() Future<void>
Jump forward by AudioServiceConfig.fastForwardInterval.
getChildren(String parentMediaId, [Map<String, dynamic>? options]) Future<List<MediaItem>>
Get the children of a parent media item.
getMediaItem(String mediaId) Future<MediaItem?>
Get a particular media item.
insertQueueItem(int index, MediaItem mediaItem) Future<void>
Insert mediaItem into the queue at position index.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onNotificationDeleted() Future<void>
Handle the notification being swiped away (Android).
onTaskRemoved() Future<void>
Handle the task being swiped away in the task manager (Android).
pause() Future<void>
Pause playback.
play() Future<void>
Start or resume playback.
playFromMediaId(String mediaId, [Map<String, dynamic>? extras]) Future<void>
Play a specific media item.
playFromSearch(String query, [Map<String, dynamic>? extras]) Future<void>
Begin playback from a search query.
playFromUri(Uri uri, [Map<String, dynamic>? extras]) Future<void>
Play a media item represented by a Uri.
playMediaItem(MediaItem mediaItem) Future<void>
Play a specific media item.
prepare() Future<void>
Prepare media items for playback.
prepareFromMediaId(String mediaId, [Map<String, dynamic>? extras]) Future<void>
Prepare a specific media item for playback.
prepareFromSearch(String query, [Map<String, dynamic>? extras]) Future<void>
Prepare playback from a search query.
prepareFromUri(Uri uri, [Map<String, dynamic>? extras]) Future<void>
Prepare a media item represented by a Uri for playback.
removeQueueItem(MediaItem mediaItem) Future<void>
Remove mediaItem from the queue.
removeQueueItemAt(int index) Future<void>
Remove media item from the queue at the specified index.
rewind() Future<void>
Jump backward by AudioServiceConfig.rewindInterval. Note: this value must be positive.
Search for media items.
seek(Duration position) Future<void>
Seek to position.
seekBackward(bool begin) Future<void>
Begin or end seeking backward continuously.
seekForward(bool begin) Future<void>
Begin or end seeking forward continuously.
setCaptioningEnabled(bool enabled) Future<void>
Set whether captioning is enabled.
setRating(Rating rating, [Map<String, dynamic>? extras]) Future<void>
Set the rating.
setRepeatMode(AudioServiceRepeatMode repeatMode) Future<void>
Set the repeat mode.
setShuffleMode(AudioServiceShuffleMode shuffleMode) Future<void>
Set the shuffle mode.
setSpeed(double speed) Future<void>
Set the playback speed.
skipToNext() Future<void>
Skip to the next item in the queue.
skipToPrevious() Future<void>
Skip to the previous item in the queue.
skipToQueueItem(int index) Future<void>
Skip to a queue item.
stop() Future<void>
Stop playback and release resources.
subscribeToChildren(String parentMediaId) → ValueStream<Map<String, dynamic>>
Get a value stream that emits service-specific options to send to the client whenever the children under the specified parent change. The emitted options may contain information about what changed. A client that is subscribed to this stream should call getChildren to obtain the changed children.
toString() String
A string representation of this object.
inherited
updateMediaItem(MediaItem mediaItem) Future<void>
Update the properties of mediaItem.
updateQueue(List<MediaItem> queue) Future<void>
Update to the queue to queue.

Operators

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