Class TimelineQueueNavigator

    • Field Detail

    • Constructor Detail

      • TimelineQueueNavigator

        public TimelineQueueNavigator​(android.support.v4.media.session.MediaSessionCompat mediaSession)
        Creates an instance for a given MediaSessionCompat.

        Equivalent to TimelineQueueNavigator(mediaSession, DEFAULT_MAX_QUEUE_SIZE).

        Parameters:
        mediaSession - The MediaSessionCompat.
      • TimelineQueueNavigator

        public TimelineQueueNavigator​(android.support.v4.media.session.MediaSessionCompat mediaSession,
                                      int maxQueueSize)
        Creates an instance for a given MediaSessionCompat and maximum queue size.

        If the number of windows in the Player's Timeline exceeds maxQueueSize, the media session queue will correspond to maxQueueSize windows centered on the one currently being played.

        Parameters:
        mediaSession - The MediaSessionCompat.
        maxQueueSize - The maximum queue size.
    • Method Detail

      • getMediaDescription

        public abstract android.support.v4.media.MediaDescriptionCompat getMediaDescription​(Player player,
                                                                                            int windowIndex)
        Gets the MediaDescriptionCompat for a given timeline window index.

        Often artworks and icons need to be loaded asynchronously. In such a case, return a MediaDescriptionCompat without the images, load your images asynchronously off the main thread and then call MediaSessionConnector.invalidateMediaSessionQueue() to make the connector update the queue by calling this method again.

        Parameters:
        player - The current player.
        windowIndex - The timeline window index for which to provide a description.
        Returns:
        A MediaDescriptionCompat.
      • getSupportedQueueNavigatorActions

        public long getSupportedQueueNavigatorActions​(Player player)
        Description copied from interface: MediaSessionConnector.QueueNavigator
        Returns the actions which are supported by the navigator. The supported actions must be a bitmask combined out of PlaybackStateCompat.ACTION_SKIP_TO_QUEUE_ITEM, PlaybackStateCompat.ACTION_SKIP_TO_NEXT, PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS.
        Specified by:
        getSupportedQueueNavigatorActions in interface MediaSessionConnector.QueueNavigator
        Parameters:
        player - The player connected to the media session.
        Returns:
        The bitmask of the supported media actions.
      • getActiveQueueItemId

        public final long getActiveQueueItemId​(@Nullable
                                               Player player)
        Description copied from interface: MediaSessionConnector.QueueNavigator
        Gets the id of the currently active queue item, or MediaSessionCompat.QueueItem.UNKNOWN_ID if the active item is unknown.

        To let the connector publish metadata for the active queue item, the queue item with the returned id must be available in the list of items returned by MediaControllerCompat.getQueue().

        Specified by:
        getActiveQueueItemId in interface MediaSessionConnector.QueueNavigator
        Parameters:
        player - The player connected to the media session.
        Returns:
        The id of the active queue item.
      • onCommand

        public boolean onCommand​(Player player,
                                 String command,
                                 @Nullable
                                 Bundle extras,
                                 @Nullable
                                 ResultReceiver cb)
        Description copied from interface: MediaSessionConnector.CommandReceiver
        See MediaSessionCompat.Callback.onCommand(String, Bundle, ResultReceiver). The receiver may handle the command, but is not required to do so.
        Specified by:
        onCommand in interface MediaSessionConnector.CommandReceiver
        Parameters:
        player - The player connected to the media session.
        command - The command name.
        extras - Optional parameters for the command, may be null.
        cb - A result receiver to which a result may be sent by the command, may be null.
        Returns:
        Whether the receiver handled the command.