PillarboxMediaLibraryService
PillarboxMediaLibraryService
implementation of MediaLibraryService. It is the recommended way to make background playback for Android and sharing content with Android Auto.
It handles only one MediaSession with one PillarboxExoPlayer.
Usage: Add these permissions inside your manifest:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
Content copied to clipboard
And add your PillarboxMediaLibraryService
to the application manifest as follow:
<meta-data android:name="com.google.android.gms.car.application" android:resource="@xml/automotive_app_desc" />
<service
android:name=".service.DemoMediaLibraryService"
android:enabled="true"
android:exported="true"
android:foregroundServiceType="mediaPlayback">
<intent-filter>
<action android:name="androidx.media3.session.MediaLibraryService" />
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
Content copied to clipboard
Use PillarboxMediaBrowser.Builder to connect this Service to a PillarboxMediaBrowser:
coroutineScope.launch() {
val mediaBrowser = PillarboxMediaBrowser.Builder(application, DemoMediaLibraryService::class.java)
doSomethingWith(mediaBrowser)
}
...
mediaBrowser.release() // when the MediaBrowser is no longer needed.
Content copied to clipboard
Functions
Link copied to clipboard
Link copied to clipboard
open fun bindIsolatedService(p0: Intent, p1: Context.BindServiceFlags, p2: String, p3: Executor, p4: ServiceConnection): Boolean
open override fun bindIsolatedService(p0: Intent, p1: Int, p2: String, p3: Executor, p4: ServiceConnection): Boolean
Link copied to clipboard
open override fun bindService(p0: Intent, p1: ServiceConnection, p2: Context.BindServiceFlags): Boolean
open override fun bindService(p0: Intent, p1: Context.BindServiceFlags, p2: Executor, p3: ServiceConnection): Boolean
Link copied to clipboard
open override fun bindServiceAsUser(p0: Intent, p1: ServiceConnection, p2: Context.BindServiceFlags, p3: UserHandle): Boolean
open override fun bindServiceAsUser(p0: Intent, p1: ServiceConnection, p2: Int, p3: UserHandle): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaLibraryService.MediaLibrarySession?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
We choose to stop playback when user remove application from the tasks
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun openOrCreateDatabase(p0: String, p1: Int, p2: SQLiteDatabase.CursorFactory): SQLiteDatabase
open override fun openOrCreateDatabase(p0: String, p1: Int, p2: SQLiteDatabase.CursorFactory, p3: DatabaseErrorHandler?): SQLiteDatabase
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun registerReceiver(p0: BroadcastReceiver?, p1: IntentFilter, p2: String?, p3: Handler?): Intent?
open override fun registerReceiver(p0: BroadcastReceiver?, p1: IntentFilter, p2: String?, p3: Handler?, p4: Int): Intent?
Link copied to clipboard
Release the player and the MediaSession. The mediaSession is set to null after this call
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun sendOrderedBroadcast(p0: Intent, p1: String?, p2: BroadcastReceiver?, p3: Handler?, p4: Int, p5: String?, p6: Bundle?)
open override fun sendOrderedBroadcast(p0: Intent, p1: String?, p2: Bundle?, p3: BroadcastReceiver?, p4: Handler?, p5: Int, p6: String?, p7: Bundle?)
open override fun sendOrderedBroadcast(p0: Intent, p1: String?, p2: String?, p3: BroadcastReceiver?, p4: Handler?, p5: Int, p6: String?, p7: Bundle?)
open fun sendOrderedBroadcast(p0: Intent, p1: Int, p2: String?, p3: String?, p4: BroadcastReceiver?, p5: Handler?, p6: String?, p7: Bundle?, p8: Bundle?)
Link copied to clipboard
open override fun sendOrderedBroadcastAsUser(p0: Intent, p1: UserHandle, p2: String?, p3: BroadcastReceiver?, p4: Handler?, p5: Int, p6: String?, p7: Bundle?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun sendStickyOrderedBroadcast(p0: Intent, p1: BroadcastReceiver?, p2: Handler?, p3: Int, p4: String?, p5: Bundle?)
Link copied to clipboard
open override fun sendStickyOrderedBroadcastAsUser(p0: Intent, p1: UserHandle, p2: BroadcastReceiver?, p3: Handler?, p4: Int, p5: String?, p6: Bundle?)
Link copied to clipboard
Session activity use with mediaSession called when setPlayer
Link copied to clipboard
Link copied to clipboard
fun setPlayer(player: PillarboxExoPlayer, callback: PillarboxMediaLibrarySession.Callback, sessionId: String? = null)
Set player to use with this Service.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun startIntentSender(p0: IntentSender, p1: Intent?, p2: Int, p3: Int, p4: Int, p5: Bundle?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard