Package 

Class PlaybackNotificationImpl

  • 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 - If useRewindAction is true, 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 - If useFastForwardAction is true, 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 - If usePreviousAction is true, 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 - If useNextAction is true, 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() { &#64;Override public CharSequence getCurrentContentTitle(MediaPlayback playback) { return "Your custom title"; } &#64;Nullable &#64;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.

    • 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.
      • Methods inherited from class com.brightcove.playback.notification.PlaybackNotificationImpl

        getPlayback, setMediaSessionToken, setPlayback
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlaybackNotificationImpl

        PlaybackNotificationImpl()
    • 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

      • cancel

         abstract Unit cancel()

        Cancels the notification by setting the player to null.

        This should be called when the player is released.