Native audio/video players on all 6 platforms (ExoPlayer, AVPlayer, Media Foundation, GStreamer, HTML5), plus subtitles, tags, HLS/DASH parsing, music library and playlists. final c = await UMedia.playUrl(url);
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
albums
→ List<
String> -
Every album name.
no setter
-
artists
→ List<
String> -
Every artist name.
no setter
-
favoriteTracks
→ List<
UTrackRecord> -
Favourite tracks.
no setter
- library → UMediaLibrary
-
The on-device music library object (listeners, advanced use).
no setter
-
mostPlayed
→ List<
UTrackRecord> -
Most played tracks.
no setter
- nowPlaying → UMediaController?
-
The player that currently has audio focus, or null.
no setter
-
players
→ List<
UMediaController> -
Every live player.
no setter
-
playlists
→ List<
UPlaylist> -
Every saved playlist.
no setter
- playlistStore → UPlaylistStore
-
Saved playlists object (listeners, advanced use).
no setter
-
tracks
→ List<
UTrackRecord> -
Every indexed track.
no setter
Static Methods
-
addToPlaylist(
String id, List< String> paths) → Future<void> - Adds tracks (file paths) to a playlist.
-
asset(
String assetPath, {String? id, UMediaMetadata? metadata, Duration? startPosition, Duration? endPosition}) → UMediaSource -
A source from a Flutter asset.
UMedia.asset("assets/intro.mp4") -
audio(
{UMediaConfig config = const UMediaConfig()}) → UMediaController -
New audio-only player (no video surface).
final c = UMedia.audio(); -
bytes(
Uint8List data, {String? id, String? mimeType, UMediaMetadata? metadata}) → UMediaSource - A source from bytes in memory (written to a temp file on native).
-
clearResumePosition(
String id) → void -
Forgets the saved position of
id. -
content(
String uri, {String? id, UMediaMetadata? metadata, Duration? startPosition}) → UMediaSource - A source from an Android content:// URI (e.g. from the file picker).
-
createPlaylist(
String name, {List< String> paths = const <String>[]}) → Future<UPlaylist> -
Creates a playlist, optionally with tracks.
await UMedia.createPlaylist("Road trip") -
decodeText(
Uint8List bytes, {String? forced}) → UDecodedText - Decodes text bytes, detecting the encoding (handles old Persian Windows-1256 files).
-
deletePlaylist(
String id) → Future< void> - Deletes a playlist.
-
exportPlaylist(
UPlaylist playlist, String directoryPath) → Future< File?> -
Writes a playlist as .m3u into
directoryPath. -
file(
String path, {String? id, UMediaMetadata? metadata, Duration? startPosition, Duration? endPosition, List< UExternalSubtitle> externalSubtitles = const <UExternalSubtitle>[]}) → UMediaSource - A source from a file path.
-
fullscreen(
BuildContext context, UMediaController controller, {String? title, bool forceLandscape = true}) → Future< void> -
Shows
controllerfull screen (landscape by default).UMedia.fullscreen(context, controller) -
importPlaylist(
String path) → Future< UPlaylist?> - Imports an .m3u file as a playlist.
-
isAvailable(
) → Future< bool> - True when the native player works on this platform (Linux needs GStreamer installed).
-
isFavorite(
String path) → bool - True when a track is a favourite.
-
isHls(
String content) → bool -
True when
contentis an HLS (.m3u8) playlist. -
isRtl(
String text) → bool -
True when
textis mostly right-to-left (Persian, Arabic, Hebrew). -
loadLibrary(
) → Future< void> - Loads the saved library index from disk.
-
network(
String url, {String? id, UMediaMetadata? metadata, Map< String, String> headers = const <String, String>{}, String? userAgent, UStreamProtocol? protocol, Duration? startPosition, Duration? endPosition, List<UExternalSubtitle> externalSubtitles = const <UExternalSubtitle>[], UDrmConfig? drm}) → UMediaSource -
A source from a URL with optional headers, DRM (Widevine/FairPlay) and subtitles.
UMedia.network(url, headers: {"Authorization": token}) -
parseDash(
String content, {String? baseUrl}) → UDashManifest? - Parses a DASH manifest (.mpd).
-
parseHls(
String content, {String? baseUrl}) → UHlsPlaylist - Parses an HLS playlist: qualities, audio/subtitle tracks, segments, keys.
-
parsePlaylist(
String content, {String? baseUri}) → List< UPlaylistEntry> - Parses M3U / PLS / XSPF playlist text.
-
parseSubtitleBytes(
Uint8List bytes, {USubtitleFormat? format, String? encoding, String? language, String? label, double fps = 23.976}) → USubtitleData -
Parses subtitle bytes and fixes the encoding (UTF-8/16, Windows-1256 Persian…).
UMedia.parseSubtitleBytes(bytes) -
parseSubtitles(
String content, {USubtitleFormat? format, String? language, String? label, double fps = 23.976}) → USubtitleData -
Parses subtitle text (SRT, VTT, ASS/SSA, LRC, MicroDVD; auto-detected).
UMedia.parseSubtitles(srtText) -
pauseAll(
) → Future< void> - Pauses every player (e.g. when a call starts).
-
playFile(
String path, {UMediaKind kind = UMediaKind.video, UMediaConfig config = const UMediaConfig()}) → Future< UMediaController> -
New player that starts a local file right away (not on web).
await UMedia.playFile("/path/song.mp3") -
playUrl(
String url, {UMediaKind kind = UMediaKind.video, Map< String, String> headers = const <String, String>{}, UMediaConfig config = const UMediaConfig()}) → Future<UMediaController> -
New player that starts
urlright away (HLS, DASH, MP4, MP3…).final c = await UMedia.playUrl("https://x.com/a.m3u8") -
readTags(
String path) → Future< UMediaMetadata> -
Title, artist, album, artwork and duration from an audio file (MP3, FLAC, OGG, M4A, WAV); not on web.
(await UMedia.readTags(path)).title -
removeFromPlaylist(
String id, String path) → Future< void> - Removes one track from a playlist.
-
renamePlaylist(
String id, String name) → Future< void> - Renames a playlist.
-
resumePosition(
String id) → Duration? -
Saved "continue watching" position for
id, or null.c.seek(UMedia.resumePosition(videoId) ?? Duration.zero) -
saveResumePosition(
String id, Duration position, Duration duration) → void -
Saves the playback position for
id(cleared near the end). -
scanLibrary(
List< String> folders, {bool replace = true, void onProgress(int scanned, int total)?}) → Future<void> -
Scans
foldersfor audio and indexes their tags (not on web). Android:permission add music.await UMedia.scanLibrary(["/storage/emulated/0/Music"]) -
searchTracks(
String query) → List< UTrackRecord> -
Tracks whose title, artist or album match
query.UMedia.searchTracks("shajarian") -
showVideo(
{String? url, String? base64, Uint8List? bytes, String? filePath, String? assetPath, String? title, bool autoPlay = true}) → Future< void> -
Plays a video in a tall bottom sheet with full controls; give one of url/bytes/base64/filePath/assetPath.
UMedia.showVideo(url: url, title: "Intro") -
subtitleFormat(
String content) → USubtitleFormat -
Guesses the subtitle format of
content. -
toggleFavorite(
String path) → void - Adds/removes a track from favourites.
-
tracksOfAlbum(
String album) → List< UTrackRecord> - Tracks of one album.
-
tracksOfArtist(
String artist) → List< UTrackRecord> - Tracks of one artist.
-
video(
{UMediaConfig config = const UMediaConfig()}) → UMediaController -
New video player; call open(), show it with UVideoView, dispose() when done.
final c = UMedia.video(); await c.open(UMedia.network(url)); -
writePlaylist(
List< UPlaylistEntry> entries) → String - Writes entries as M3U text.