Package 

Class MediaService

  • All Implemented Interfaces:
    android.content.ComponentCallbacks , android.content.ComponentCallbacks2 , kotlinx.coroutines.CoroutineScope

    @Deprecated(message = Use the new AudioNavigator from the readium-navigator-media-audio module. This class will be removed in a future 3.x release.) 
    public class MediaService
    extends MediaBrowserServiceCompat implements CoroutineScope
                        

    MediaBrowserServiceCompat implementation holding the current MediaSessionNavigator for background playback.

    You should override this service in your app and declare it in your AndroidManifest.xml.

    See https://developer.android.com/guide/topics/media-apps/audio-app/building-a-mediabrowserservice

    • Constructor Summary

      Constructors 
      Constructor Description
      MediaService()
    • Method Summary

      Modifier and Type Method Description
      CoroutineContext getCoroutineContext()
      MediaPlayer onCreatePlayer(MediaSessionCompat mediaSession, PendingMedia media) Creates the instance of MediaPlayer which will be used for playing the given media.
      Unit onPlayerStopped() Called when the underlying MediaPlayer was stopped.
      PendingIntent ,Publication)>onCreateNotificationIntent(<ERROR CLASS> publicationId, Publication publication) Creates the PendingIntent which will be used to start the media activity when the user activates the media notification.
      MediaPlayer.NotificationMetadata ,Publication,Link)>onCreateNotificationMetadata(<ERROR CLASS> publicationId, Publication publication, Link link) Creates the MediaPlayer.NotificationMetadata for the given resource ,Publication,Link)>link.
      Bitmap ,Publication)>coverOfPublication(<ERROR CLASS> publicationId, Publication publication) Returns the cover for the given ,Publication)>publication which should be used in media notifications.
      Boolean onCommand(String command, Bundle args, ResultReceiver cb) Handles a custom command delivered by MediaSessionCompat.Callback.onCommand.
      Unit onResourceLoadFailed(Link link, ReadError error) Called when a resource failed to be loaded, for example because the Internet connection is offline and the resource is streamed.
      Boolean isClientAuthorized(String packageName, Integer uid) Override to control which app can access the MediaSession through the MediaBrowserService.
      Unit onCreate()
      Unit onDestroy()
      MediaBrowserServiceCompat.BrowserRoot onGetRoot(String clientPackageName, Integer clientUid, Bundle rootHints)
      Unit onLoadChildren(String parentId, MediaBrowserServiceCompat.Result<List<MediaBrowserCompat.MediaItem>> result)
      • Methods inherited from class org.readium.r2.navigator.media.MediaService

        addSubscription, applyOptions, attachToBaseContext, dump, getBrowserRootHints, getCurrentBrowserInfo, getSessionToken, handleMessageInternal, isValidPackage, notifyChildrenChanged, notifyChildrenChanged, notifyChildrenChanged, onBind, onCustomAction, onLoadChildren, onLoadItem, onSearch, onSubscribe, onUnsubscribe, performCustomAction, performLoadChildren, performLoadItem, performSearch, removeSubscription, setSessionToken
      • Methods inherited from class android.app.Service

        bindIsolatedService, bindService, bindService, bindService, bindService, bindServiceAsUser, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDeviceId, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerComponentCallbacks, registerDeviceIdChangeListener, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterComponentCallbacks, unregisterDeviceIdChangeListener, unregisterReceiver, updateServiceGroup
      • Methods inherited from class android.content.ContextWrapper

        bindIsolatedService, getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissions
      • Methods inherited from class androidx.media.MediaBrowserServiceCompat

        attachBaseContext, getApplication, getForegroundServiceType, onConfigurationChanged, onLowMemory, onRebind, onStart, onStartCommand, onTaskRemoved, onTimeout, onTrimMemory, onUnbind, startForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait