mirror of
https://github.com/androidx/media.git
synced 2025-05-07 23:50:44 +08:00
Fix cleared metadata when repeating the same item
Issue: androidx/media#1007 #minor-release PiperOrigin-RevId: 600477540
This commit is contained in:
parent
94bf9fa81d
commit
c6bf380d50
@ -10,6 +10,8 @@
|
|||||||
by wrapping an instance using the
|
by wrapping an instance using the
|
||||||
[decorator pattern](https://en.wikipedia.org/wiki/Decorator_pattern) and
|
[decorator pattern](https://en.wikipedia.org/wiki/Decorator_pattern) and
|
||||||
implementing a custom `CompositeSequenceableLoaderFactory`.
|
implementing a custom `CompositeSequenceableLoaderFactory`.
|
||||||
|
* Fix issue where repeating the same time causes metadata from this item
|
||||||
|
to be cleared ([#1007](https://github.com/androidx/media/issues/1007)).
|
||||||
* Transformer:
|
* Transformer:
|
||||||
* Track Selection:
|
* Track Selection:
|
||||||
* Extractors:
|
* Extractors:
|
||||||
|
@ -2019,7 +2019,8 @@ import java.util.concurrent.TimeoutException;
|
|||||||
}
|
}
|
||||||
staticAndDynamicMediaMetadata = MediaMetadata.EMPTY;
|
staticAndDynamicMediaMetadata = MediaMetadata.EMPTY;
|
||||||
}
|
}
|
||||||
if (!previousPlaybackInfo.staticMetadata.equals(newPlaybackInfo.staticMetadata)) {
|
if (mediaItemTransitioned
|
||||||
|
|| !previousPlaybackInfo.staticMetadata.equals(newPlaybackInfo.staticMetadata)) {
|
||||||
staticAndDynamicMediaMetadata =
|
staticAndDynamicMediaMetadata =
|
||||||
staticAndDynamicMediaMetadata
|
staticAndDynamicMediaMetadata
|
||||||
.buildUpon()
|
.buildUpon()
|
||||||
|
@ -14227,6 +14227,33 @@ public final class ExoPlayerTest {
|
|||||||
assertThat(positionAfterSeek).isEqualTo(0);
|
assertThat(positionAfterSeek).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void repeatingItemWithSameStaticMetadata_keepsMetadata() throws Exception {
|
||||||
|
Format formatWithStaticMetadata =
|
||||||
|
new Format.Builder()
|
||||||
|
.setSampleMimeType(MimeTypes.VIDEO_H264)
|
||||||
|
.setMetadata(
|
||||||
|
new Metadata(
|
||||||
|
new BinaryFrame(/* id= */ "", /* data= */ new byte[0]),
|
||||||
|
new TextInformationFrame(
|
||||||
|
/* id= */ "TT2",
|
||||||
|
/* description= */ null,
|
||||||
|
/* values= */ ImmutableList.of("title"))))
|
||||||
|
.build();
|
||||||
|
ExoPlayer player = new TestExoPlayerBuilder(context).build();
|
||||||
|
player.setMediaSource(new FakeMediaSource(new FakeTimeline(), formatWithStaticMetadata));
|
||||||
|
player.prepare();
|
||||||
|
player.setRepeatMode(Player.REPEAT_MODE_ONE);
|
||||||
|
player.play();
|
||||||
|
|
||||||
|
// Wait until item repeats.
|
||||||
|
runUntilPositionDiscontinuity(player, Player.DISCONTINUITY_REASON_AUTO_TRANSITION);
|
||||||
|
MediaMetadata metadataAfterTransition = player.getMediaMetadata();
|
||||||
|
player.release();
|
||||||
|
|
||||||
|
assertThat(metadataAfterTransition.title).isEqualTo("title");
|
||||||
|
}
|
||||||
|
|
||||||
// Internal methods.
|
// Internal methods.
|
||||||
|
|
||||||
private void addWatchAsSystemFeature() {
|
private void addWatchAsSystemFeature() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user