From acb567d5a723102a82afff2eb36f953f203deddf Mon Sep 17 00:00:00 2001 From: tonihei Date: Wed, 24 May 2023 15:42:33 +0100 Subject: [PATCH] Add clarifiying note to Player.replaceMediaItem This helps to highlight that the replaced range doesn't need to have the same size as before. #minor-release PiperOrigin-RevId: 534834917 --- .../common/src/main/java/androidx/media3/common/Player.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/common/src/main/java/androidx/media3/common/Player.java b/libraries/common/src/main/java/androidx/media3/common/Player.java index aeefd5522e..2941bd5706 100644 --- a/libraries/common/src/main/java/androidx/media3/common/Player.java +++ b/libraries/common/src/main/java/androidx/media3/common/Player.java @@ -2169,6 +2169,11 @@ public interface Player { *

This method must only be called if {@link #COMMAND_CHANGE_MEDIA_ITEMS} is {@linkplain * #getAvailableCommands() available}. * + *

Note that it is possible to replace a range with an arbitrary number of new items, so that + * the number of removed items defined by {@code fromIndex} and {@code toIndex} does not have to + * match the number of added items defined by {@code mediaItems}. As result, it may also change + * the index of subsequent items not touched by this operation. + * * @param fromIndex The start of the range. If the index is larger than the size of the playlist, * the request is ignored. * @param toIndex The first item not to be included in the range (exclusive). If the index is