easy_audio_player 0.0.1 icon indicating copy to clipboard operation
easy_audio_player: ^0.0.1 copied to clipboard

an easy widgets to have audio player that can play remote or local audio files across all platforms without having to implement it from scratch.

Flutter Audio Player #

flutter audio player package

audio player flutter package that provides an easy widgets to have audio player that can play remote or local audio files across all platforms #

#

Secreenshots #

## Features * easy to use audio players with background service using widgets: - MinimalAudioPlayer: just an audio player to play audio with no controles of on play & pause button . - BasicAudioPlayer: audio player with seekbar and controle buttons - FullAudioPlayer: audio player with all features seek bar , controles , playlist , and art image .

Getting started #

#

1. depend on it #

dependencies:
  flutter:
    sdk: flutter
    # add this line 👇
  easy_audio_player: {latest_version}

2. platform setup #

android setup #

after the 'manifest' tag and before the 'application' tag add these permissions .

    <!-- Just audio background PERMISSIONS -->
  <uses-permission android:name="android.permission.WAKE_LOCK"/>
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
  

then change the 'activity' tag

change this:

  android:name=".MainActivity"

to this

android:name="com.ryanheise.audioservice.AudioServiceActivity"

then after 'activity' tag and before the end of 'application tag ' add this :

  <!--  ADD THIS "SERVICE" element -->
    <service android:name="com.ryanheise.audioservice.AudioService">
      <intent-filter>
        <action android:name="android.media.browse.MediaBrowserService" />
      </intent-filter>
    </service>

    <!-- ADD THIS "RECEIVER" element -->
    <receiver android:name="com.ryanheise.audioservice.MediaButtonReceiver" >
      <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
      </intent-filter>
    </receiver> 

IOS setup #

Insert this in your Info.plist file:

	<key>UIBackgroundModes</key>
	<array>
		<string>audio</string>
	</array>

Usage #

#

  1. call initJustAudioBackground as early as possible
void main() async {
  // init the background service to display notifications while playing
  await initJustAudioBackground(NotificationSettings(androidNotificationChannelId: 'com.example.example'));
  runApp(MaterialApp(
    home: HomeScreen(),
  ));
}
  1. load your audios in a ConcatenatingAudioSource playlist containing an AudioSource or one of it's inherted classes .

  final ConcatenatingAudioSource _playlist = ConcatenatingAudioSource(children: [
    AudioSource.uri(Uri.parse('https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3'),
        tag: MediaItem(
            id: '1',
            artUri: Uri.parse('https://picsum.photos/300/300'),
            title: 'Audio Title ',
            album: 'amazing album'))
  ]);
  1. call one of the players widgets with your playlist and options
return Scaffold(
        body: SafeArea(
            child: Padding(
                padding: const EdgeInsets.all(20.0),
                child: Center(
                  child: FullAudioPlayer(autoPlay: false, playlist: _playlist),
                ))));
7
likes
120
pub points
62%
popularity

Publisher

unverified uploader

an easy widgets to have audio player that can play remote or local audio files across all platforms without having to implement it from scratch.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

audio_session, audio_video_progress_bar, flutter, just_audio, just_audio_background

More

Packages that depend on easy_audio_player