Friday, March 29, 2024

Flutter plugin for making music App

Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library.

Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library. Playify was built using iOS’s Media Player Framework to fetch and play music from iOS’s Music Library. Currently supports only iOS, but Android support is being developed. PR’s are welcomed. Checkout the documentation.

Requirements:

Usage

import 'package:playify/playify.dart';

//Create an instance
Playify myplayer = Playify();

//Play from the latest queue.
await myplayer.play();

//Fetch all songs from iOS's Apple Music.
var artists = await myplayer.getAllSongs(sort: true);

//Fetch song information about the currently playing song in the queue.
var songInfo = await myplayer.nowPlaying();

//Set the queue using songIDs for iOS.
await myplayer.setQueue(songIDs: songIDs);

//Skip to the next song in the queue.
await myplayer.next();

//Skip to the previous song in the queue.
await myplayer.previous();

//Set the playback time of the song.
await myplayer.setPlaybackTime(time);

//Set the shuffle mode.
await myplayer.setShuffleMode(mode);

iOS

  • For iOS, Playify uses iOS’s Media Player framework. This makes Playify available only on iOS >= 10.3. Make sure to specify the minimum version of the supported iOS version of your app from Xcode.
  • Getting All Songs: For geting all songs from the Apple Music library of the iPhone, you can specify whether to sort the artists. The songs are sorted by their track number, and the albums are sorted alphabetically. The cover art of each album is fetched individually, and you can specify the size of the cover art. The larger the cover art, the more amount of RAM it consumes and longer it takes to fetch. In my case, the default value takes about 1-2 seconds with 800+ songs.

Screenshots

Screenshot
Screenshot
Screenshot
Screenshot