native_audio 0.0.2 copy "native_audio: ^0.0.2" to clipboard
native_audio: ^0.0.2 copied to clipboard

outdated

An audio plugin for Flutter which makes use of the native Android and iOS audio players, handling playback, notifications and external controls.

Native Audio #

An audio plugin for Flutter which makes use of the native Android and iOS audio players, handling playback, notifications and external controls (such as bluetooth).

Getting Started #

This plugin works on both Android and iOS, however the following setup is required for each platform.

Android #

1. Application

Create or modify the Application class as follows:

class Application : FlutterApplication(), PluginRegistry.PluginRegistrantCallback {

    override fun onCreate() {
        super.onCreate()
        NativeAudioPlugin.setPluginRegistrantCallback(this)
    }

    override fun registerWith(registry: PluginRegistry) {
        GeneratedPluginRegistrant.registerWith(registry)
    }
}

This must be reflected in the application's AndroidManifest.xml. E.g.:

    <application
        android:name=".Application"
        ...

Note: Not calling NativeAudioPlugin.setPluginRegistrant will result in an exception being thrown when audio is played.

2. Service & Permissions

Add the following lines to your AndroidManifest.xml to register the background service for geofencing:

<receiver android:name="androidx.media.session.MediaButtonReceiver">
    <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
    </intent-filter>
</receiver>

<service android:name="studio.darngood.native_audio.AudioService">
    <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
        <action android:name="android.media.browse.MediaBrowserService" />
    </intent-filter>
</service>

As well as the following lines to setup the permissions required:

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

iOS #

Coming very soon 🍏

9
likes
0
pub points
48%
popularity

Publisher

verified publisherdanielgauci.com

An audio plugin for Flutter which makes use of the native Android and iOS audio players, handling playback, notifications and external controls.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on native_audio