Class Timeline.Window

  • All Implemented Interfaces:
    Bundleable
    Enclosing class:
    Timeline

    public static final class Timeline.Window
    extends Object
    implements Bundleable
    Holds information about a window in a Timeline. A window usually corresponds to one playlist item and defines a region of media currently available for playback along with additional information such as whether seeking is supported within the window. The figure below shows some of the information defined by a window, as well as how this information relates to corresponding Periods in the timeline.

    Information defined by a
 timeline window

    • Field Detail

      • SINGLE_WINDOW_UID

        public static final Object SINGLE_WINDOW_UID
        A uid for a window that must be used for single-window Timelines.
      • mediaItem

        public MediaItem mediaItem
        The MediaItem associated to the window. Not necessarily unique.
      • manifest

        @Nullable
        public Object manifest
        The manifest of the window. May be null.
      • presentationStartTimeMs

        public long presentationStartTimeMs
        The start time of the presentation to which this window belongs in milliseconds since the Unix epoch, or C.TIME_UNSET if unknown or not applicable. For informational purposes only.
      • windowStartTimeMs

        public long windowStartTimeMs
        The window's start time in milliseconds since the Unix epoch, or C.TIME_UNSET if unknown or not applicable.
      • elapsedRealtimeEpochOffsetMs

        public long elapsedRealtimeEpochOffsetMs
        The offset between SystemClock.elapsedRealtime() and the time since the Unix epoch according to the clock of the media origin server, or C.TIME_UNSET if unknown or not applicable.

        Note that the current Unix time can be retrieved using getCurrentUnixTimeMs() and is calculated as SystemClock.elapsedRealtime() + elapsedRealtimeEpochOffsetMs.

      • isSeekable

        public boolean isSeekable
        Whether it's possible to seek within this window.
      • isDynamic

        public boolean isDynamic
        Whether this window may change when the timeline is updated.
      • isPlaceholder

        public boolean isPlaceholder
        Whether this window contains placeholder information because the real information has yet to be loaded.
      • defaultPositionUs

        public long defaultPositionUs
        The default position relative to the start of the window at which to begin playback, in microseconds. May be C.TIME_UNSET if and only if the window was populated with a non-zero default position projection, and if the specified projection cannot be performed whilst remaining within the bounds of the window.
      • durationUs

        public long durationUs
        The duration of this window in microseconds, or C.TIME_UNSET if unknown.
      • firstPeriodIndex

        public int firstPeriodIndex
        The index of the first period that belongs to this window.
      • lastPeriodIndex

        public int lastPeriodIndex
        The index of the last period that belongs to this window.
      • positionInFirstPeriodUs

        public long positionInFirstPeriodUs
        The position of the start of this window relative to the start of the first period belonging to it, in microseconds.
    • Constructor Detail

      • Window

        public Window()
        Creates window.
    • Method Detail

      • set

        public Timeline.Window set​(Object uid,
                                   @Nullable
                                   MediaItem mediaItem,
                                   @Nullable
                                   Object manifest,
                                   long presentationStartTimeMs,
                                   long windowStartTimeMs,
                                   long elapsedRealtimeEpochOffsetMs,
                                   boolean isSeekable,
                                   boolean isDynamic,
                                   @Nullable
                                   MediaItem.LiveConfiguration liveConfiguration,
                                   long defaultPositionUs,
                                   long durationUs,
                                   int firstPeriodIndex,
                                   int lastPeriodIndex,
                                   long positionInFirstPeriodUs)
        Sets the data held by this window.
      • getDefaultPositionMs

        public long getDefaultPositionMs()
        Returns the default position relative to the start of the window at which to begin playback, in milliseconds. May be C.TIME_UNSET if and only if the window was populated with a non-zero default position projection, and if the specified projection cannot be performed whilst remaining within the bounds of the window.
      • getDefaultPositionUs

        public long getDefaultPositionUs()
        Returns the default position relative to the start of the window at which to begin playback, in microseconds. May be C.TIME_UNSET if and only if the window was populated with a non-zero default position projection, and if the specified projection cannot be performed whilst remaining within the bounds of the window.
      • getDurationMs

        public long getDurationMs()
        Returns the duration of the window in milliseconds, or C.TIME_UNSET if unknown.
      • getDurationUs

        public long getDurationUs()
        Returns the duration of this window in microseconds, or C.TIME_UNSET if unknown.
      • getPositionInFirstPeriodMs

        public long getPositionInFirstPeriodMs()
        Returns the position of the start of this window relative to the start of the first period belonging to it, in milliseconds.
      • getPositionInFirstPeriodUs

        public long getPositionInFirstPeriodUs()
        Returns the position of the start of this window relative to the start of the first period belonging to it, in microseconds.
      • getCurrentUnixTimeMs

        public long getCurrentUnixTimeMs()
        Returns the current time in milliseconds since the Unix epoch.

        This method applies known corrections made available by the media such that this time corresponds to the clock of the media origin server.

      • isLive

        public boolean isLive()
        Returns whether this is a live stream.
      • equals

        public boolean equals​(@Nullable
                              Object obj)
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object