A full fledge radio player plugin for android and ios

Overview

logo

likes popularity pub points

Flutter radio plugin handles a single streaming media preciously. This plugin was developed with maximum usage in mind. Flutter Radio player enables Streaming audio content on both Android and iOS natively, as an added feature this plugin supports background music play as well. This plugin also integrate deeply with both core media capabilities such as MediaSession on Android and RemoteControl capabilities (Control Center) on iOS. This plugin also support controlling the player via both wearOS and WatchOS.

Features

  • Supports both android and ios
  • Supports background music playing
  • Integrates well with watchOS and WearOS.
  • Handles network interruptions.
  • Reactive
  • Developer friendly (Logs are placed though out the codebase, so it's easy to trace a bug)

Reactivity ?

Unlike any other Music Playing plugin Flutter Radio Player is very reactive. It communicates with the native layer using Event and Streams, this making the plugin very reactive to both Application (Flutter) side and the native side.

Plugin events

This plugin utilises Android LocalBroadcaster and iOS Notification center for pushing out events. Names of the events are listed below.

  • flutter_radio_playing
  • flutter_radio_paused
  • flutter_radio_stopped
  • flutter_radio_error
  • flutter_radio_loading

Getting Started

  1. Add this to your package's pubspec.yaml file
dependencies:
  flutter_radio_player: ^1.X.X
  1. Install it
$ flutter pub get
  1. Import it
import 'package:flutter_radio_player/flutter_radio_player.dart';
  1. Configure it Creat a new instance of the player. An FlutterRadioPlayer instance can play a single audio stream at a time. To create it, simply call the constructor. However DO NOT make multiple instances of the service as FRP is using a FOREGROUND SERVICE to keep itself live when you minimize the application in Android.
FlutterRadioPlayer _flutterRadioPlayer = new FlutterRadioPlayer();

When you have an FRP instance you may simply call the init method to invoke the platform specific player preparation. For the API please reffer FRP API.

await _flutterRadioPlayer.init("Flutter Radio Example", "Live", "URL_HERE", "true");

After player preparation you may simply call playOrPause method to toggle audio stream.

await _flutterRadioPlayer.playOrPause();

FRP does allow you to change the URL after player initialized. You can simply change the stream url by calling setUrl on FRP object.

await _flutterRadioPlayer.setUrl('URL_HERE', "false");

calling above method will cause the existing URL to pause and play the newly set URL. Please refer the FRP API for api documentation.

Besides above mentioned method, below are the methods that FRP exposes.

  • stop() - Will stop all the streaming audio streams and detaches itself from FOREGROUND SERVICE. You need to reinitialize to use the plugin again,
await _flutterRadioPlayer.stop()
  • start() - Will start the audio stream using the initialized object.
await _flutterRadioPlayer.start()
  • pause() - Will pause the audio stream using the initialized object.
await _flutterRadioPlayer.pause()

Now that's not all. This plugin handles almost everything for you when it comes to playing a single stream of audio. From Player meta details to network interruptions, FRP handles it all with a sweat. Please refer the example to get an idea about what FRP can do.

iOS and Android Support

If the plugin is failing to initiate, kindly make sure your permission for background processes are given for your application

For your Android application you might want to add permissions in AndroidManifest.xml. This is already added for in the library level.

    <!--  Permissions for the plugin  -->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <!--  Services for the plugin  -->
    <application android:usesCleartextTraffic="true">
        <service android:name=".core.StreamingCore"/>
    </application>

For your iOS application you need to enable it like this

xcode image

Support

Please hit a like to plugin on pub if you used it and love it. put a ⭐️ my GitHub repo and show me some ♥️ so i can keep working on this.

Found a bug ?

Please feel free to throw in a pull request. Any support is warmly welcome.

You might also like...
Echo is a lightweight and minimal music player for Android, built with Android Studio and written in Kotlin
Echo is a lightweight and minimal music player for Android, built with Android Studio and written in Kotlin

Echo - Echo, A light-weight, minimal music player for Android, with shuffle, favorites and audio visualization

Simple and lightweight, yet polished and powerful Android video player based on ExoPlayer
Simple and lightweight, yet polished and powerful Android video player based on ExoPlayer

Just (Video) Player Android video player based on ExoPlayer It uses ExoPlayer's extension-ffmpeg with all its audio formats enabled (it can handle eve

Custom Android view with video player, loader and placeholder image
Custom Android view with video player, loader and placeholder image

VideoPlayerView Custom Android view with video player, loader and placeholder image. To stay up-to-date with news about the library Usage Here is an e

A elegant and light weight music player for android
A elegant and light weight music player for android

A elegant and light weight music player for android

 An offline music player android app, with modern UI and powerful features
An offline music player android app, with modern UI and powerful features

Pulse Music An offline music player android app, with modern UI and powerful features If you liked this repo, fork it and leave a STAR. Your support m

Xtra is a Twitch player and browser for Android.
Xtra is a Twitch player and browser for Android.

Xtra for Twitch Xtra is a Twitch player and browser for Android. Download APK You can find released APKs here. Project status The app was removed from

SocyMusic is an open-source Android music player written in Java with the aim of creating an easy-to-use app for exchanging and listening to top-quality music. Help us create it!

SocyMusic SocyMusic is an open-source Android music player written entirely in Java. It's objectives are to provide top-quality music to everyone for

Android SRT player powered by Exoplayer and srtdroid

SrtPlayer An Android SRT test player powered by ExoPayer. Most of this code comes from YoussefHenna reply in the SRT support ExoPayer issue. It demons

Blade is an open source music player for Android, allowing you to play music from multiple services : files on your phone, Spotify, and more.
Blade is an open source music player for Android, allowing you to play music from multiple services : files on your phone, Spotify, and more.

Blade Player Blade is an open source music player for Android, allowing you to play music from multiple services : files on your phone, Spotify, and m

Owner
null
Radio Player - A Flutter plugin to play streaming audio content with background support and lock screen controls.

A Flutter plugin to play streaming audio content with background support and lock screen controls. Installation To use this package, add

Ayotunde abdulsalam 1 Mar 14, 2022
iOS(iPhone & iPad) and Android Radio/Podcast Streaming Apps built in Kotlin Multiplatform Mobile (KMM) with SwiftUI & Jetpack Compose

iOS(iPhone & iPad) and Android Radio/Podcast Streaming Apps built in Kotlin Multiplatform Mobile (KMM) with SwiftUI & Jetpack Compose

MwaiBanda 1 May 31, 2022
Transistor - Simple Radio App for Android

Transistor is an app with a minimalistic approach for listening to radio programs over the internet, which may not be to everyone's liking

y20k 421 Dec 29, 2022
Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface.

Fermata Media Player About Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface. It is focused on

Andrey 227 Jan 6, 2023
Music Player - This is a basic music player built with Android Studio and Kotlin

Music Player Made by Jenny Cárdenas This is a basic music player built with Android Studio and Kotlin, it shows two views in the UI, the user can play

Jenny C 3 Oct 28, 2021
Odeon Music Player is a lightweight music player for Android.

Odeon ?? Odeon Music Player is a lightweight music player for Android. Get it on Google Play. We value your privacy, your battery life and your device

Thibault Seisel 63 Dec 20, 2022
Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer.

Yet Another Video Player Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer. Who Is YAVP For? First o

null 62 Dec 29, 2022
Compose-video-player - Video player for Android Compose powered by ExoPlayer

Compose Video Player Video player for Android Compose powered by ExoPlayer. Addi

Juan Pablo Herrera 22 Dec 13, 2022
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

ijkplayer Platform Build Status Android iOS Video player based on ffplay Download Android: Gradle # required allprojects { repositories {

bilibili 31k Jan 3, 2023
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

ijkplayer Platform Build Status Android iOS Video player based on ffplay Download Android: Gradle # required allprojects { repositories {

bilibili 29.8k Dec 22, 2021