1*30877f79SAndroid Build Coastguard Worker--- 2*30877f79SAndroid Build Coastguard Workertitle: Progressive 3*30877f79SAndroid Build Coastguard Worker--- 4*30877f79SAndroid Build Coastguard Worker 5*30877f79SAndroid Build Coastguard Worker{% include_relative _page_fragments/supported-formats-progressive.md %} 6*30877f79SAndroid Build Coastguard Worker 7*30877f79SAndroid Build Coastguard Worker## Using MediaItem ## 8*30877f79SAndroid Build Coastguard Worker 9*30877f79SAndroid Build Coastguard WorkerTo play a progressive stream, create a `MediaItem` with the media URI and pass 10*30877f79SAndroid Build Coastguard Workerit to the player. 11*30877f79SAndroid Build Coastguard Worker 12*30877f79SAndroid Build Coastguard Worker~~~ 13*30877f79SAndroid Build Coastguard Worker// Create a player instance. 14*30877f79SAndroid Build Coastguard WorkerExoPlayer player = new ExoPlayer.Builder(context).build(); 15*30877f79SAndroid Build Coastguard Worker// Set the media item to be played. 16*30877f79SAndroid Build Coastguard Workerplayer.setMediaItem(MediaItem.fromUri(progressiveUri)); 17*30877f79SAndroid Build Coastguard Worker// Prepare the player. 18*30877f79SAndroid Build Coastguard Workerplayer.prepare(); 19*30877f79SAndroid Build Coastguard Worker~~~ 20*30877f79SAndroid Build Coastguard Worker{: .language-java} 21*30877f79SAndroid Build Coastguard Worker 22*30877f79SAndroid Build Coastguard Worker## Using ProgressiveMediaSource ## 23*30877f79SAndroid Build Coastguard Worker 24*30877f79SAndroid Build Coastguard WorkerFor more customization options, you can create a `ProgressiveMediaSource` and 25*30877f79SAndroid Build Coastguard Workerdirectly to the player instead of a `MediaItem`. 26*30877f79SAndroid Build Coastguard Worker 27*30877f79SAndroid Build Coastguard Worker~~~ 28*30877f79SAndroid Build Coastguard Worker// Create a data source factory. 29*30877f79SAndroid Build Coastguard WorkerDataSource.Factory dataSourceFactory = new DefaultHttpDataSource.Factory(); 30*30877f79SAndroid Build Coastguard Worker// Create a progressive media source pointing to a stream uri. 31*30877f79SAndroid Build Coastguard WorkerMediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory) 32*30877f79SAndroid Build Coastguard Worker .createMediaSource(MediaItem.fromUri(progressiveUri)); 33*30877f79SAndroid Build Coastguard Worker// Create a player instance. 34*30877f79SAndroid Build Coastguard WorkerExoPlayer player = new ExoPlayer.Builder(context).build(); 35*30877f79SAndroid Build Coastguard Worker// Set the media source to be played. 36*30877f79SAndroid Build Coastguard Workerplayer.setMediaSource(mediaSource); 37*30877f79SAndroid Build Coastguard Worker// Prepare the player. 38*30877f79SAndroid Build Coastguard Workerplayer.prepare(); 39*30877f79SAndroid Build Coastguard Worker~~~ 40*30877f79SAndroid Build Coastguard Worker{: .language-java} 41*30877f79SAndroid Build Coastguard Worker 42*30877f79SAndroid Build Coastguard Worker## Customizing playback ## 43*30877f79SAndroid Build Coastguard Worker 44*30877f79SAndroid Build Coastguard WorkerExoPlayer provides multiple ways for you to tailor playback experience to your 45*30877f79SAndroid Build Coastguard Workerapp's needs. See the [Customization page][] for examples. 46*30877f79SAndroid Build Coastguard Worker 47*30877f79SAndroid Build Coastguard Worker[Customization page]: {{ site.baseurl }}/customization.html 48