mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Update the UI Components dev guide page to use MediaItem API
#minor-release PiperOrigin-RevId: 406163529
This commit is contained in:
parent
dcdcb919f4
commit
689a92c9ae
1 changed files with 6 additions and 4 deletions
|
|
@ -73,8 +73,8 @@ When a player has been initialized, it can be attached to the view by calling
|
||||||
player = new ExoPlayer.Builder(context).build();
|
player = new ExoPlayer.Builder(context).build();
|
||||||
// Attach player to the view.
|
// Attach player to the view.
|
||||||
playerView.setPlayer(player);
|
playerView.setPlayer(player);
|
||||||
// Set the media source to be played.
|
// Set the media item to be played.
|
||||||
player.setMediaSource(createMediaSource());
|
player.setMediaItem(mediaItem);
|
||||||
// Prepare the player.
|
// Prepare the player.
|
||||||
player.prepare();
|
player.prepare();
|
||||||
~~~
|
~~~
|
||||||
|
|
@ -160,8 +160,10 @@ private void initializePlayer() {
|
||||||
player = new ExoPlayer.Builder(context).build();
|
player = new ExoPlayer.Builder(context).build();
|
||||||
// Attach player to the view.
|
// Attach player to the view.
|
||||||
playerControlView.setPlayer(player);
|
playerControlView.setPlayer(player);
|
||||||
// Prepare the player with the dash media source.
|
// Set the media item to be played.
|
||||||
player.prepare(createMediaSource());
|
player.setMediaItem(mediaItem);
|
||||||
|
// Prepare the player.
|
||||||
|
player.prepare();
|
||||||
}
|
}
|
||||||
~~~
|
~~~
|
||||||
{: .language-java}
|
{: .language-java}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue