-
- All Implemented Interfaces:
-
com.brightcove.player.playback.PlaybackNotification
public abstract class PlaybackNotificationImpl implements PlaybackNotification
Base class for creating and updating a media-style notification.
<h2>Action customization</h2>
Playback actions can be included or omitted as follows:
usePlayPauseActions
- Sets whether the play and pause actions are used.Corresponding setter: PlaybackNotificationConfig.setUsePlayPauseActions
Default:
true
useRewindAction
- Sets whether the rewind action is used.Corresponding setter: PlaybackNotificationConfig.setUseRewindAction
Default:
true
useRewindActionInCompactView
- IfuseRewindAction
istrue
, sets whether the rewind action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseRewindActionInCompactView
Default:
false
useFastForwardAction
- Sets whether the fast forward action is used.Corresponding setter: PlaybackNotificationConfig.setUseFastForwardAction
Default:
true
useFastForwardActionInCompactView
- IfuseFastForwardAction
istrue
, sets whether the fast forward action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseFastForwardActionInCompactView
Default:
false
usePreviousAction
- Whether the previous action is used.Corresponding setter: PlaybackNotificationConfig.setUsePreviousAction
Default:
true
usePreviousActionInCompactView
- IfusePreviousAction
istrue
, sets whether the previous action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUsePreviousActionInCompactView
Default:
false
useNextAction
- Whether the next action is used.Corresponding setter: PlaybackNotificationConfig.setUseNextAction
Default:
true
useNextActionInCompactView
- IfuseNextAction
istrue
, sets whether the next action is also used in compact view (including the lock screen notification). Else does nothing.Corresponding setter: PlaybackNotificationConfig.setUseNextActionInCompactView
Default:
false
<h2>Overriding drawables</h2>
The action icons can be set programatically by using the PlaybackNotificationConfig. The large icon (i.e. the icon passed to Notification.Builder.setLargeIcon is obtained from the MediaDescriptionAdapter passed to PlaybackNotificationConfig.setAdapter
<pre> notification.setConfig(new MediaPlaybackNotification.Config(this) .setSmallIcon(R.mipmap.ic_launcher) .setUseNextAction(false) .setPriority(NotificationCompat.PRIORITY_MAX) . setAdapter(new MediaPlaybackNotification.MediaDescriptionAdapter() { @Override public CharSequence getCurrentContentTitle(MediaPlayback playback) { return "Your custom title"; } @Nullable @Override public Bitmap getCurrentLargeIcon(MediaPlayback playback, BitmapCallback callback) { // TODO: return your bitmap } }) ); </pre> *
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
PlaybackNotificationImpl.Extras
Extras set on the PendingIntent in the default implementation of the MediaDescriptionAdapter.createCurrentContentIntent.
-
Constructor Summary
Constructors Constructor Description PlaybackNotificationImpl()
-
Method Summary
Modifier and Type Method Description abstract Unit
setConfig(PlaybackNotificationConfig config)
Configure and customize the notification shown for playback. Unit
setStreamTypes(PlaybackNotification.StreamType types)
Set the stream types to show notifications for. Array<PlaybackNotification.StreamType>
getStreamTypes()
Get the supported stream types for showing this notification. abstract Boolean
isVisible()
Check is the notification is showing. abstract Boolean
show()
Starts a notification immediately unless the player is in an idle state, in which case the notification is started as soon as the player transitions away from being idle. abstract Unit
cancel()
Cancels the notification by setting the player to null
.-
-
Method Detail
-
setConfig
abstract Unit setConfig(PlaybackNotificationConfig config)
Configure and customize the notification shown for playback.
- Parameters:
config
- The configuration to build the notification.
-
setStreamTypes
Unit setStreamTypes(PlaybackNotification.StreamType types)
Set the stream types to show notifications for.
- Parameters:
types
- The types of media for notification playback.
-
getStreamTypes
Array<PlaybackNotification.StreamType> getStreamTypes()
Get the supported stream types for showing this notification.
-
show
abstract Boolean show()
Starts a notification immediately unless the player is in an idle state, in which case the notification is started as soon as the player transitions away from being idle.
The notification shows if the currently playing StreamType is one of this.getStreamTypes
-
-
-
-