Class MediaService

java.lang.Object
Service
com.jwplayer.pub.api.background.MediaService

public class MediaService extends Service
  • Field Details

    • mBinder

      protected final IBinder mBinder
    • mMediaSessionHelper

      protected MediaSessionHelper mMediaSessionHelper
  • Constructor Details

    • MediaService

      public MediaService()
  • Method Details

    • doStartForeground

      public void doStartForeground(MediaSessionHelper mediaSessionHelper, NotificationHelper notificationHelper, ServiceMediaApi serviceMediaApi)
      Starts the Service in foreground mode
      Parameters:
      mediaSessionHelper - Helps manage the media session
      notificationHelper - Helps manage the notification
      serviceMediaApi - Defines the player capabilities of the notification and media session
    • updateForegroundNotification

      public void updateForegroundNotification(MediaSessionHelper mediaSessionHelper, NotificationHelper notificationHelper, ServiceMediaApi serviceMediaApi)
      Updates the notification and media session for an already-running foreground service without calling startForeground() again. Use this when the service is already in the foreground (e.g. during playlist item transitions) to avoid ForegroundServiceStartNotAllowedException on API 31+.
    • isInForeground

      public boolean isInForeground()
    • onBind

      public IBinder onBind(Intent intent)
    • onUnbind

      public boolean onUnbind(Intent intent)
    • onDestroy

      public void onDestroy()