on_audio_edit
is a Flutter Plugin used to edit and read audios/songs 🎶 infos/tags [Mp3, OggVorbis, Wav, etc...].
This Plugin use AdrienPoupa:jaudiotagger as dependency to edit audios tags.
Any problem? Issues
Any suggestion? Pull request
NOTE: Feel free to help with readme translations
Add the following code to your pubspec.yaml
:
dependencies:
on_audio_edit: ^1.5.1
You will need add the following code to your AndroidManifest.xml
Note: This Plugin don't have a built-in request permission
<manifest> ...
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
If you are using/want to use Android 10
will need add the following code to your AndroidManifest.xml
<application> ...
android:requestLegacyExternalStorage="true"
</application>
- Read Audios/Songs tags.
- Edit Audios/Songs tags.
- Supports Android 10 and above.
- Add better performance for all plugin.
- Add
[deleteArtwork]
to Android 10 and above. - Add
[deleteArtworks]
to Android 10 and above. - Add
[deleteAudio]
to Android 10 and above. - Fix bugs.
OnAudioEdit() // The main method to start using the plugin.
All types of methods on this plugin:
Methods | Parameters | Return |
---|---|---|
readAudio |
(String) |
AudioModel |
readAudios |
(List<String>) |
List<AudioModel> |
readSingleAudioTag |
(String, TagsType) |
String |
readSpecificsAudioTags |
(String, List<TagsType>) |
AudioModel |
Methods | Parameters | Return |
---|---|---|
editAudio |
(String, Map<TagsType, dynamic>) |
bool |
editAudios |
(List<String>, List<Map<TagsType, dynamic>>) |
bool |
editArtwork |
(String, bool, String, ArtworkFormat, int, String) |
bool |
Methods | Parameters | Return |
---|---|---|
deleteArtwork |
[W](String) |
bool |
deleteArtworks |
[W](List<String>) |
bool |
deleteAudio |
[W](String) |
bool |
Methods | Parameters | Return |
---|---|---|
getImage |
ArtworkFormat, Quality |
ImageModel |
permissionsStatus |
bool |
|
resetComplexPermission |
[Q] | bool |
requestComplexPermission |
[Q] | bool |
requestComplexPermission |
[Q] | bool |
[Q] -> Only necessary on Android 10 or above.
[W] -> These methods are currently only implemented on Android 9 or below.
Types | Types | Types | Types | Types |
---|---|---|---|---|
ALBUM_ARTIST |
ORIGINAL_ARTIST |
ORIGINAL_ALBUM |
TRACK |
FORMAT |
ARTIST |
ORIGINAL_LYRICIST |
LYRICS |
TITLE |
SAMPLE_RATE |
ARTISTS |
ORIGINAL_YEAR |
LANGUAGE |
TEMPO |
CHANNELS |
BEATS_PER_MINUTE |
PRODUCER |
KEY |
TAGS |
COVER_ART |
COMPOSER |
QUALITY |
ISRC |
SUBTITLE |
TYPE |
COUNTRY |
RATING |
FIRST_ARTWORK |
LENGTH |
More |
GENRE |
RECORD_LABEL |
YEAR |
BITRATE |
final OnAudioEdit _audioEdit = OnAudioEdit();
// data: "/storage/1E65-6GH3/SomeMusic.mp3" or "/storage/someFolder/SomeMusic.mp3"
AudioModel song = await _audioEdit.readAudio(data);
String songTitle = song.title;
String songArtist = song.artist ?? '<No Artist>';
List<String> allData = [data0, data1, data2];
List<AudioModel> song = await _audioEdit.readAudios(allData);
...
String songTitle1 = song[0].title;
String songTitle2 = song[1].title;
String songTitle3 = song[2].title;
String title = await _audioEdit.readSingleAudioTag(data, TagsType.TITLE);
print(title); // Ex: Heavy, California
...
String artist = await _audioEdit.readSingleAudioTag(data, TagsType.ARTIST);
print(artist); // Ex: Jungle
List<TagsType> tags = [
TagsType.TITLE,
TagsType.ARTIST
];
AudioModel songSpecifics = await _audioEdit.readSpecificsAudioTags(data, tags);
...
String songTitle = songSpecifics.title;
String songArtist = songSpecifics ?? '<No Artist>';
Map<TagsType, dynamic> tags = {
TagsType.TITLE: "New Title",
TagsType.ARTIST: "New Artist"
};
bool song = await _audioEdit.editAudio(data, tags);
print(song); //True or False
⚠ Note: This method isn't implemented on Android 10 or above. Instead use: editAudio
// Tags
List<<Map<TagsType, dynamic>> tags = [];
Map<TagsType, dynamic> getTags = {
TagsType.TITLE: "New Title",
TagsType.ARTIST: "New Artist"
};
tags.add(getTags);
// Songs data
List<String> data;
data.add(song1);
data.add(song2);
data.add(song3);
bool result = await _audioEdit.editAudios(data, tags);
print(result); //True or False
⚠ Note: If openFilePicker is false, imagePath can't be null.
// Parameters: openFilePicker, imagePath, format, size, description
// DEFAULT: true, null, ArtworkFormat.JPEG, 24, "artwork"
bool song = await _audioEdit.editArtwork(data);
print(song); //True or False