Dart plugin to live stream audio URLs. The package will accept both HTTP and HTTPs URLs for streaming. Specifics will be discussed below for native designs, limitations, and implementations. Any help would be greatly appreciated if possible!
Add the dependency
Import the package into your dart file
Functions and usage
AudioStream stream = new AudioStream("https://your_url_goes_here.com"); stream.start(); stream.pause(); stream.resume(); stream.stop();
The Android MediaPlayer was used for audio streaming over HTTP/HTTPS. Refer to the Android for information about the MediaPlayer. The player uses setAudioAttributes method for setting up the MediaPlayer for API levels over 26. Anything under that API level will use setAudioStreamType method, which was deprecated in API level 26. Due to this adaption, the flutter compiler will give a message that the plugin is using a deprecated method.
HTTP Streams #
Android requires an edit to your android manifest to allow connection to non-HTTP sources, follow this link to edit the manifest for clear text traffic.
The Swift AVPlayer was used for the implementation over HTTP/HTTPS. Refer to the Apple site for information about the AVPlayer. The player was designed in Swift 5 and requires a change in the Info.plist if you need to HTTP stream. According to the Apple article, iOS SDK 4.0+ is required for streaming.
HTTP Streams #
For the clear text traffic, a change will need to be done in XCode on the Runner.xcworkspace file. The NSAppTransportSecurity flag will need to be changed. It is recommended that you add an exception to the site you are streaming, rather than allowing all HTTP traffic. You can follow this StackOverflow link for changing or adding domains for streaming.
- Added an ability to stream on all APIs that Flutter can run on
- iOS can stream in the background
- Changed the homepage reference
- API comments for iOS and Android
- A detailed description was added to pubspec.yaml
- Flutter formatting was applied to the url_audio_stream.dart file
Demonstrates how to use the url_audio_stream plugin.
Getting Started #
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: url_audio_stream: ^1.0.0+3
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Jan 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.0
- pana: 0.13.4
- Flutter: 1.12.13+hotfix.5
Health issues and suggestions
Document public APIs. (-1 points)
7 out of 7 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.