radio_player 2.0.0
radio_player: ^2.0.0 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.
Installation #
To use this package, add radio_player as a dependency in your pubspec.yaml file.
dependencies:
radio_player: ^2.0.0
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>
Usage #
To create RadioPlayer instance, simply call the constructor.
RadioPlayer radioPlayer = RadioPlayer();
Configure it with your data.
radioPlayer.setChannel(title: TITLE, url: URL, imagePath: IMAGEPATH?);
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; });
});
Image from metadata can be retrieved using getArtworkImage()
Requirements #
- iOS: 15.0 or later
- Android: API Level 23 or later
Reporting Issues #
Before submitting an issue, please:
- Check the example application: Verify if the problem you're experiencing also occurs in the
exampleapp provided with this plugin. This helps determine if the issue is with the plugin itself or your specific implementation. - Provide a minimal reproducible example: If the issue persists or is not reproducible in the example, please include a small, self-contained code snippet that demonstrates the problem.
This information will greatly help in diagnosing and resolving your issue efficiently.
License #
This project is licensed under the CC BY-NC-SA 4.0.