Files
rk35xx-android14/external/exoplayer/tree_8e57d3715f9092d5ec54ebe2e538f34bfcc34479/docs/progressive.md
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

1.4 KiB

title
title
Progressive

{% include_relative _page_fragments/supported-formats-progressive.md %}

Using MediaItem

To play a progressive stream, create a MediaItem with the media URI and pass it to the player.

// Create a player instance.
ExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media item to be played.
player.setMediaItem(MediaItem.fromUri(progressiveUri));
// Prepare the player.
player.prepare();

{: .language-java}

Using ProgressiveMediaSource

For more customization options, you can create a ProgressiveMediaSource and directly to the player instead of a MediaItem.

// Create a data source factory.
DataSource.Factory dataSourceFactory = new DefaultHttpDataSource.Factory();
// Create a progressive media source pointing to a stream uri.
MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
    .createMediaSource(MediaItem.fromUri(progressiveUri));
// Create a player instance.
ExoPlayer player = new ExoPlayer.Builder(context).build();
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.
player.prepare();

{: .language-java}

Customizing playback

ExoPlayer provides multiple ways for you to tailor playback experience to your app's needs. See the [Customization page][] for examples.

[Customization page]: {{ site.baseurl }}/customization.html