Skip to content

A Flutter plugin to play streaming audio content with background support and lock screen controls.

License

Notifications You must be signed in to change notification settings

cblims/radio_player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Radio Player

A Flutter plugin to play streaming audio content with background support and lock screen controls.

flutter platform pub package License: MIT

Installation

To use this package, add radio_player as a dependency in your pubspec.yaml file.

dependencies:
  radio_player: ^0.0.1

By default iOS forbids loading from non-https url. To cancel this restriction edit your .plist and add:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

If necessary, add permissions to play in the background:

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

Only for debug mode in iOS 14+, you will also need the following:

<key>NSBonjourServices</key>
<array>
<string>_dartobservatory._tcp</string>
</array>

Usage

To create RadioPlayer instance, simply call the constructor.

RadioPlayer radioPlayer = RadioPlayer();

Initialize it with your data.

radioPlayer.init(STREAM_TITLE, STREAM_URL);

Player Controls

radioPlayer.play();
radioPlayer.pause();

State Event

You can use it to show if player playing or paused.

bool isPlaying = false;
//...
radioPlayer.stateStream.listen((value) {
    setState(() { isPlaying = value; });
});

Metadata Event

This Event returns the current metadata.

List<String>? metadata;
//...
radioPlayer.metadataStream.listen((value) {
    setState(() { metadata = value; });
});

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

About

A Flutter plugin to play streaming audio content with background support and lock screen controls.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published