Giter Site home page Giter Site logo

ruchit-7span / on_audio_query Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lucjosin/on_audio_query

0.0 0.0 0.0 808 KB

Flutter Plugin used to query audios/songs infos [title, artist, album, etc..] from device storage.

Home Page: https://pub.dev/packages/on_audio_query

Ruby 0.64% C++ 5.21% C 0.34% Objective-C 0.19% Kotlin 24.13% Dart 46.91% Swift 18.96% HTML 0.95% CMake 2.67%

on_audio_query's Introduction

on_audio_query

Pub.dev Languages Platforms

on_audio_query is a Flutter Plugin used to query audios/songs ๐ŸŽถ infos [title, artist, album, etc..] from device storage.

Help:

Topics:

Platforms:

Query methods

Methods Android IOS
queryAudios โœ”๏ธ โœ”๏ธ
queryAlbums โœ”๏ธ โœ”๏ธ
queryArtists โœ”๏ธ โœ”๏ธ
queryPlaylists โœ”๏ธ โœ”๏ธ
queryGenres โœ”๏ธ โœ”๏ธ
queryArtwork โœ”๏ธ โœ”๏ธ
queryDeviceInfo โœ”๏ธ โœ”๏ธ

Observer methods

Methods Android IOS
observeAudios โœ”๏ธ โœ”๏ธ
observeAlbums โœ”๏ธ โœ”๏ธ
observeArtists โœ”๏ธ โœ”๏ธ
observePlaylists โœ”๏ธ โœ”๏ธ
observeGenres โœ”๏ธ โœ”๏ธ

โœ”๏ธ -> Supported
โŒ -> Not Supported

See all platforms methods support

How to Install:

Add the following code to your pubspec.yaml:

dependencies:
  on_audio_query: 3.0.0-beta.0

Request Permission:

Android:

To use this plugin add the following code to your AndroidManifest.xml

<manifest> ...

  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

</manifest>

IOS:

To use this plugin add the following code to your Info.plist

	<key>NSAppleMusicUsageDescription</key>
	<string>..Add a reason..</string>

Some Features:

  • Optional and Built-in storage READ and WRITE permission request
  • Get all audios/songs.
  • Get all albums and album-specific audios.
  • Get all artists and artist-specific audios.
  • Get all playlists and playlists-specific audios.
  • Get all genres and genres-specific audios.
  • Get all query methods with specific keys [Search].
  • Create/Delete/Rename playlists.
  • Add/Remove/Move specific audios to playlists.
  • Specific sort types for all query methods.

Overview:

All types of methods on this plugin:

Query methods

Methods Parameters Return
queryAudios (MediaFilter, isAsset) List<AudioModel>
queryAlbums (MediaFilter, isAsset) List<AlbumModel>
queryArtists (MediaFilter, isAsset) List<ArtistModel>
queryPlaylists (MediaFilter, isAsset) List<PlaylistModel>
queryGenres (MediaFilter, isAsset) List<GenreModel>
queryArtwork (id, type, format, size) Uint8List?

Observer methods

Methods Parameters Return
observeAudios (MediaFilter) List<AudioModel>
observeAlbums (MediaFilter) List<AlbumModel>
observeArtists (MediaFilter) List<ArtistModel>
observePlaylists (MediaFilter) List<PlaylistModel>
observeGenres (MediaFilter) List<GenreModel>

Playlist methods

Methods Parameters Return
createPlaylist (playlistName) int
removePlaylist (playlistId) bool
addToPlaylist (playlistId, audioId) bool
removeFromPlaylist (playlistId, audioId) bool
renamePlaylist (playlistId, newName) bool
moveItemTo (playlistId, from, to) bool

Permissions/Device methods

Methods Parameters Return
permissionsRequest (retryRequest) bool
permissionsStatus bool
queryDeviceInfo DeviceModel

Others methods

Methods Parameters Return
scanMedia (path) bool
observersStatus ObserversModel

Artwork Widget

  Widget someOtherName() async {
    return QueryArtworkWidget(
      id: <audioId>,
      type: ArtworkType.AUDIO,
    );
  }

See more: QueryArtworkWidget

Examples:

OnAudioQuery

final OnAudioQuery _audioQuery = OnAudioQuery();

Query methods:

  • queryAudios();
  • queryAlbums();
  • queryArtists();
  • queryPlaylists();
  • queryGenres().
  someName() async {
    // Query Audios
    List<AudioModel> audios = await _audioQuery.queryAudios();

    // Query Albums
    List<AlbumModel> albums = await _audioQuery.queryAlbums();
  }

scanMedia

You'll use this method when updating a media from storage. This method will update the media 'state' and Android MediaStore will be able to know this 'state'.

  someName() async {
    OnAudioQuery _audioQuery = OnAudioQuery();
    File file = File('path');
    try {
      if (file.existsSync()) {
        file.deleteSync();
        _audioQuery.scanMedia(file.path); // Scan the media 'path'
      }
    } catch (e) {
      debugPrint('$e');
    }
  }

queryArtwork

  someName() async {
    // DEFAULT: ArtworkFormat.JPEG, 200 and false
    Uint8List something = await _audioQuery.queryArtwork(
        <audioId>,
        ArtworkType.AUDIO,
        ...,
      );
  }

Or you can use a basic and custom Widget. See example QueryArtworkWidget

Gif Examples:

Audios Albums Playlists Artists

LICENSE:

on_audio_query's People

Contributors

lucjosin avatar mvanbeusekom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.