From 689a92c9aeedea89e5ab35f663d819d41441cd5d Mon Sep 17 00:00:00 2001 From: ibaker Date: Thu, 28 Oct 2021 18:01:01 +0100 Subject: [PATCH] Update the UI Components dev guide page to use MediaItem API #minor-release PiperOrigin-RevId: 406163529 --- docs/ui-components.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/ui-components.md b/docs/ui-components.md index 79078b1731..c56107eae7 100644 --- a/docs/ui-components.md +++ b/docs/ui-components.md @@ -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(); // Attach player to the view. playerView.setPlayer(player); -// Set the media source to be played. -player.setMediaSource(createMediaSource()); +// Set the media item to be played. +player.setMediaItem(mediaItem); // Prepare the player. player.prepare(); ~~~ @@ -160,8 +160,10 @@ private void initializePlayer() { player = new ExoPlayer.Builder(context).build(); // Attach player to the view. playerControlView.setPlayer(player); - // Prepare the player with the dash media source. - player.prepare(createMediaSource()); + // Set the media item to be played. + player.setMediaItem(mediaItem); + // Prepare the player. + player.prepare(); } ~~~ {: .language-java}