Commit 89dd1050 by tonihei Committed by Toni

Update window/period doc in Timeline.

Most users are likely to be only interested in the playlist items. So put the
Window definition first and explicitly mention that this is a playlist
item.

PiperOrigin-RevId: 263764515
parent 9dd04bae
...@@ -26,96 +26,92 @@ import com.google.android.exoplayer2.util.Assertions; ...@@ -26,96 +26,92 @@ import com.google.android.exoplayer2.util.Assertions;
* complex compositions of media such as playlists and streams with inserted ads. Instances are * complex compositions of media such as playlists and streams with inserted ads. Instances are
* immutable. For cases where media is changing dynamically (e.g. live streams), a timeline provides * immutable. For cases where media is changing dynamically (e.g. live streams), a timeline provides
* a snapshot of the current state. * a snapshot of the current state.
* <p> *
* A timeline consists of related {@link Period}s and {@link Window}s. A period defines a single * <p>A timeline consists of {@link Window Windows} and {@link Period Periods}.
* logical piece of media, for example a media file. It may also define groups of ads inserted into *
* the media, along with information about whether those ads have been loaded and played. A window * <ul>
* spans one or more periods, defining the region within those periods that's currently available * <li>A {@link Window} usually corresponds to one playlist item. It may span one or more periods
* for playback along with additional information such as whether seeking is supported within the * and it defines the region within those periods that's currently available for playback. The
* window. Each window defines a default position, which is the position from which playback will * window also provides additional information such as whether seeking is supported within the
* start when the player starts playing the window. The following examples illustrate timelines for * window and the default position, which is the position from which playback will start when
* various use cases. * the player starts playing the window.
* <li>A {@link Period} defines a single logical piece of media, for example a media file. It may
* also define groups of ads inserted into the media, along with information about whether
* those ads have been loaded and played.
* </ul>
*
* <p>The following examples illustrate timelines for various use cases.
* *
* <h3 id="single-file">Single media file or on-demand stream</h3> * <h3 id="single-file">Single media file or on-demand stream</h3>
* <p align="center"> *
* <img src="doc-files/timeline-single-file.svg" alt="Example timeline for a single file"> * <p align="center"><img src="doc-files/timeline-single-file.svg" alt="Example timeline for a
* </p> * single file"> A timeline for a single media file or on-demand stream consists of a single period
* A timeline for a single media file or on-demand stream consists of a single period and window. * and window. The window spans the whole period, indicating that all parts of the media are
* The window spans the whole period, indicating that all parts of the media are available for * available for playback. The window's default position is typically at the start of the period
* playback. The window's default position is typically at the start of the period (indicated by the * (indicated by the black dot in the figure above).
* black dot in the figure above).
* *
* <h3>Playlist of media files or on-demand streams</h3> * <h3>Playlist of media files or on-demand streams</h3>
* <p align="center"> *
* <img src="doc-files/timeline-playlist.svg" alt="Example timeline for a playlist of files"> * <p align="center"><img src="doc-files/timeline-playlist.svg" alt="Example timeline for a playlist
* </p> * of files"> A timeline for a playlist of media files or on-demand streams consists of multiple
* A timeline for a playlist of media files or on-demand streams consists of multiple periods, each * periods, each with its own window. Each window spans the whole of the corresponding period, and
* with its own window. Each window spans the whole of the corresponding period, and typically has a * typically has a default position at the start of the period. The properties of the periods and
* default position at the start of the period. The properties of the periods and windows (e.g. * windows (e.g. their durations and whether the window is seekable) will often only become known
* their durations and whether the window is seekable) will often only become known when the player * when the player starts buffering the corresponding file or stream.
* starts buffering the corresponding file or stream.
* *
* <h3 id="live-limited">Live stream with limited availability</h3> * <h3 id="live-limited">Live stream with limited availability</h3>
* <p align="center"> *
* <img src="doc-files/timeline-live-limited.svg" alt="Example timeline for a live stream with * <p align="center"><img src="doc-files/timeline-live-limited.svg" alt="Example timeline for a live
* limited availability"> * stream with limited availability"> A timeline for a live stream consists of a period whose
* </p> * duration is unknown, since it's continually extending as more content is broadcast. If content
* A timeline for a live stream consists of a period whose duration is unknown, since it's * only remains available for a limited period of time then the window may start at a non-zero
* continually extending as more content is broadcast. If content only remains available for a * position, defining the region of content that can still be played. The window will have {@link
* limited period of time then the window may start at a non-zero position, defining the region of * Window#isDynamic} set to true if the stream is still live. Its default position is typically near
* content that can still be played. The window will have {@link Window#isDynamic} set to true if * to the live edge (indicated by the black dot in the figure above).
* the stream is still live. Its default position is typically near to the live edge (indicated by
* the black dot in the figure above).
* *
* <h3>Live stream with indefinite availability</h3> * <h3>Live stream with indefinite availability</h3>
* <p align="center"> *
* <img src="doc-files/timeline-live-indefinite.svg" alt="Example timeline for a live stream with * <p align="center"><img src="doc-files/timeline-live-indefinite.svg" alt="Example timeline for a
* indefinite availability"> * live stream with indefinite availability"> A timeline for a live stream with indefinite
* </p> * availability is similar to the <a href="#live-limited">Live stream with limited availability</a>
* A timeline for a live stream with indefinite availability is similar to the * case, except that the window starts at the beginning of the period to indicate that all of the
* <a href="#live-limited">Live stream with limited availability</a> case, except that the window * previously broadcast content can still be played.
* starts at the beginning of the period to indicate that all of the previously broadcast content
* can still be played.
* *
* <h3 id="live-multi-period">Live stream with multiple periods</h3> * <h3 id="live-multi-period">Live stream with multiple periods</h3>
* <p align="center"> *
* <img src="doc-files/timeline-live-multi-period.svg" alt="Example timeline for a live stream * <p align="center"><img src="doc-files/timeline-live-multi-period.svg" alt="Example timeline for a
* with multiple periods"> * live stream with multiple periods"> This case arises when a live stream is explicitly divided
* </p> * into separate periods, for example at content boundaries. This case is similar to the <a
* This case arises when a live stream is explicitly divided into separate periods, for example at * href="#live-limited">Live stream with limited availability</a> case, except that the window may
* content boundaries. This case is similar to the <a href="#live-limited">Live stream with limited * span more than one period. Multiple periods are also possible in the indefinite availability
* availability</a> case, except that the window may span more than one period. Multiple periods are * case.
* also possible in the indefinite availability case.
* *
* <h3>On-demand stream followed by live stream</h3> * <h3>On-demand stream followed by live stream</h3>
* <p align="center"> *
* <img src="doc-files/timeline-advanced.svg" alt="Example timeline for an on-demand stream * <p align="center"><img src="doc-files/timeline-advanced.svg" alt="Example timeline for an
* followed by a live stream"> * on-demand stream followed by a live stream"> This case is the concatenation of the <a
* </p> * href="#single-file">Single media file or on-demand stream</a> and <a href="#multi-period">Live
* This case is the concatenation of the <a href="#single-file">Single media file or on-demand * stream with multiple periods</a> cases. When playback of the on-demand stream ends, playback of
* stream</a> and <a href="#multi-period">Live stream with multiple periods</a> cases. When playback * the live stream will start from its default position near the live edge.
* of the on-demand stream ends, playback of the live stream will start from its default position
* near the live edge.
* *
* <h3 id="single-file-midrolls">On-demand stream with mid-roll ads</h3> * <h3 id="single-file-midrolls">On-demand stream with mid-roll ads</h3>
* <p align="center"> *
* <img src="doc-files/timeline-single-file-midrolls.svg" alt="Example timeline for an on-demand * <p align="center"><img src="doc-files/timeline-single-file-midrolls.svg" alt="Example timeline
* stream with mid-roll ad groups"> * for an on-demand stream with mid-roll ad groups"> This case includes mid-roll ad groups, which
* </p> * are defined as part of the timeline's single period. The period can be queried for information
* This case includes mid-roll ad groups, which are defined as part of the timeline's single period. * about the ad groups and the ads they contain.
* The period can be queried for information about the ad groups and the ads they contain.
*/ */
public abstract class Timeline { public abstract class Timeline {
/** /**
* Holds information about a window in a {@link Timeline}. A window defines a region of media * Holds information about a window in a {@link Timeline}. A window usually corresponds to one
* currently available for playback along with additional information such as whether seeking is * playlist item and defines a region of media currently available for playback along with
* supported within the window. The figure below shows some of the information defined by a * additional information such as whether seeking is supported within the window. The figure below
* window, as well as how this information relates to corresponding {@link Period}s in the * shows some of the information defined by a window, as well as how this information relates to
* timeline. * corresponding {@link Period Periods} in the timeline.
* <p align="center"> *
* <img src="doc-files/timeline-window.svg" alt="Information defined by a timeline window"> * <p align="center"><img src="doc-files/timeline-window.svg" alt="Information defined by a
* </p> * timeline window">
*/ */
public static final class Window { public static final class Window {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment