radio_player 1.7.1 copy "radio_player: ^1.7.1" to clipboard
radio_player: ^1.7.1 copied to clipboard

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

Radio Player #

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

flutter platform pub package

Installation #

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

dependencies:
  radio_player: ^1.7.1
copied to clipboard

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>
copied to clipboard

If necessary, add permissions to play in the background:

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
    <string>processing</string>
</array>
copied to clipboard

Usage #

To create RadioPlayer instance, simply call the constructor.

RadioPlayer radioPlayer = RadioPlayer();
copied to clipboard

Configure it with your data.

radioPlayer.setChannel(title: TITLE, url: URL, imagePath: IMAGEPATH?);
copied to clipboard

Player Controls #

radioPlayer.play();
radioPlayer.pause();
copied to clipboard

State Event #

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

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

Metadata Event #

This Event returns the current metadata.

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

Image from metadata can be retrieved using getArtworkImage()

Requirements #

  • iOS: SDK 10.0 or later
  • Android: API Level 23 or later

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.

84
likes
140
points
646
downloads

Publisher

verified publisheryar.net

Weekly Downloads

2024.09.25 - 2025.04.09

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

Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on radio_player