ColibrioMediaService

This is the entry point for the Colibrio background audio playback services.

To be able to use the ColibrioMediaService, you need to modify your AndroidManifest.xml file: Add the following permission:

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

Inside the <application> tag add the following:

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

<service
android:name="com.colibrio.readingsystem.audio.service.ColibrioMediaBrowserService"
android:exported="true"
android:foregroundServiceType="mediaPlayback">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>

You must call ColibrioMediaService.initialize before using the service to create your audio player. We recommend that you call it in onCreate in your application class or your main activity.

Functions

Link copied to clipboard

Creates a new ColibrioAudioPlayer using the provided load configuration. If there is an existing ColibrioAudioPlayer, it will be destroyed.

Link copied to clipboard

Destroys the active ColibrioAudioPlayer instance, which results in ignoring all subsequent calls to its methods. This method does nothing if there is no active audio player.

Link copied to clipboard
fun initialize(context: Context)

Initializes ColibrioMediaService with the passed application context of the given context.

Properties

Link copied to clipboard

The currently active ColibrioAudioPlayer instance if one has been created.

Link copied to clipboard

True while ColibrioMediaService is trying to create a new ColibrioAudioPlayer but have not yet finished.

Link copied to clipboard
var initialized: Boolean = false

If the ColibrioMediaService has been initialized using ColibrioMediaService.initialize.