Package com.jwplayer.pub.api.background
Class MediaService
java.lang.Object
Service
com.jwplayer.pub.api.background.MediaService
public class MediaService
extends Service
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoStartForeground(MediaSessionHelper mediaSessionHelper, NotificationHelper notificationHelper, ServiceMediaApi serviceMediaApi) Starts the Service in foreground modebooleanIBinderonBind(Intent intent) voidbooleanonUnbind(Intent intent) voidupdateForegroundNotification(MediaSessionHelper mediaSessionHelper, NotificationHelper notificationHelper, ServiceMediaApi serviceMediaApi) Updates the notification and media session for an already-running foreground service without calling startForeground() again.
-
Field Details
-
mBinder
protected final IBinder mBinder -
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 sessionnotificationHelper- Helps manage the notificationserviceMediaApi- 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()
-