Class MediaQueue


  • public class MediaQueue
    extends java.lang.Object
    The MediaQueue class allows developers to manipulate the media queue in the seatback monitor.

    For example, modify the queue by adding, removing, loading or clearing items and change the queue status by playing, pausing or stopping the item. In addition, the APIs get the queue status and set listener for queue updates.
    • Method Detail

      • loadMediaQueue

        public boolean loadMediaQueue​(java.util.List<MediaQueueRequestItem> items,
                                      int startIndex,
                                      MediaQueue.RepeatModeType repeatMode,
                                      boolean autoPlay,
                                      MediaQueue.MediaQueueItemsAddedListener listener)
        Clears existing items and loads new items to the media queue.
        Parameters:
        items - List of items added to the media queue.
        startIndex - Starts the index of items for playback.
        repeatMode - MediaQueue.RepeatModeType Repeats the playback of the media queue. By default, the repeat mode is off.
        autoPlay - Starts the playback of an item at launch media. A boolean value. If true, media automatically plays at media launch. If false, media does not play automatically and passenger must select the Play button.
        listener - MediaQueue.MediaQueueItemsAddedListener Invoked when items are added to the media queue.
        Returns:
        True, if message sent successfully. False, if message is not successfully sent.
      • insertItems

        public boolean insertItems​(java.util.List<MediaQueueRequestItem> mediaItems,
                                   int position,
                                   MediaQueue.MediaQueueItemsAddedListener listener)
                            throws java.lang.IndexOutOfBoundsException
        Adds items to the specified position.

        Shifts the items currently at that position and any subsequent items to the right.
        Parameters:
        mediaItems - List of items to be added to media queue.
        position - Index where the items are to be inserted
        listener - MediaQueue.MediaQueueItemsAddedListener Invoked when items are added to the media queue.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
        Throws:
        java.lang.IndexOutOfBoundsException
      • play

        public boolean play()
        Starts or continues playback of the current item in the media queue.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • play

        public boolean play​(java.lang.String contentType)
        Plays the media item with the specified content type.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • pause

        public boolean pause()
        Pauses the playing of the media item in the queue.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • stop

        public boolean stop()
        Stops the playing of the media item in the queue.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • jumpTo

        public boolean jumpTo​(java.lang.String queueId)
        Jumps to media item with the specified ID in the queue.
        Parameters:
        queueId - Unique identifier of the item in the queue.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • jumpToNext

        public boolean jumpToNext()
        Jumps to next item in the media queue.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • jumpToPrev

        public boolean jumpToPrev()
        Jumps to previous item in the media queue.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • setDefaultSubtitleCode

        public boolean setDefaultSubtitleCode​(java.lang.String code)
        Deprecated.
        Sets the default ISO 639-2 language code for the subtitles in the media queue.
        Parameters:
        code - Default ISO 639-2 language code for the subtitles.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • setDefaultSubtitle

        public boolean setDefaultSubtitle​(java.lang.String code,
                                          java.lang.String type)
        Sets the default ISO 639-2 language code for the subtitles in the media queue.
        Parameters:
        code - Default ISO 639-2 language code for the subtitles.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • setDefaultSoundtrackCode

        public boolean setDefaultSoundtrackCode​(java.lang.String code)
        Deprecated.
        Sets the default ISO 639-2 language code for the soundtracks in the media queue.
        Parameters:
        code - Default ISO 639-2 language code for the soundtrack.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • setDefaultSoundtrack

        public boolean setDefaultSoundtrack​(java.lang.String code,
                                            java.lang.String type)
        Sets the default ISO 639-2 language code and type for the soundtrack in the media queue.
        Parameters:
        code - Default ISO 639-2 language code for the soundtrack.
        type - set soundtrack type
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • setRepeatMode

        public boolean setRepeatMode​(MediaQueue.RepeatModeType mode)
        Sets the media queue to play the items multiple times.

        Values are All to repeat all the items, None to not repeat the media queue, One to repeat only the current item or Unknown.
        Parameters:
        mode - Repeat mode allows the items to play multiple times.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • setShuffleMode

        public boolean setShuffleMode​(boolean shuffle)
        Sets the media queue to play the media items in random order.
        Parameters:
        shuffle - Random order for playing the media items.
        Returns:
        True, if message is successfully sent. False, if message cannot be sent.
      • getQueueItemCount

        public int getQueueItemCount()
        Gets the count for the number of media items in the queue.
      • getCurrentQueueItemIndex

        public int getCurrentQueueItemIndex()
        Gets the index position for the current media item.
        Returns:
        Index for the current media item.
      • getPlaybackState

        public MediaQueue.PlaybackState getPlaybackState()
        Gets the playback state of the queue. Playback states include paused, playing, stopped and unknown.
      • getSubtitleCode

        public java.lang.String getSubtitleCode()
        Gets the default ISO 639-2 language code for the subtitles in the media queue.
      • getSubtitleType

        public java.lang.String getSubtitleType()
        Gets the defaults subtitle type of the media queue.
      • getSoundtrackCode

        public java.lang.String getSoundtrackCode()
        Gets the default ISO 639-2 language code for the soundtracks in the media queue.
      • getSoundtrackType

        public java.lang.String getSoundtrackType()
        Gets the default soundtrack type of the media queue.
      • getRepeatMode

        public MediaQueue.RepeatModeType getRepeatMode()
        Gets the repeat mode for the media queue.

        Values are All to repeat all the items, None to not repeat the media queue, One to repeat only the current item or Unknown.
        Returns:
        RepeatModeType
      • getLastUpdated

        public long getLastUpdated()
        Gets the last timestamp for the media queue.
      • hasNext

        public boolean hasNext()
        Gets whether the media queue has a next item.
        Returns:
        True if the current playlist item has a next media item.
      • hasPrev

        public boolean hasPrev()
        Gets whether the media queue has a previous item.
        Returns:
        True if the current playlist item has a previous media item.
      • getShuffleMode

        public boolean getShuffleMode()
        Returns the shuffle mode.
      • setMediaQueueChangeListener

        public void setMediaQueueChangeListener​(MediaQueue.MediaQueueChangeListener listener)
        Sets the Media Queue change listener.
        Parameters:
        listener - Invoked when the media queue changes.
      • setMediaQueuePlaybackStateChangeListener

        public void setMediaQueuePlaybackStateChangeListener​(MediaQueue.MediaQueuePlaybackStateChangeListener listener)
        Sets the Media Queue Playback state change listener.
        Parameters:
        listener - Invoked when the playback state changes.