Deprecate static metadata getter and listener method.
PiperOrigin-RevId: 385781004
This commit is contained in:
parent
fa9a4521ce
commit
d47d1ebf19
@ -41,6 +41,13 @@
|
|||||||
* Add a `DefaultMediaDescriptionAdapter` for the
|
* Add a `DefaultMediaDescriptionAdapter` for the
|
||||||
`PlayerNotificationManager`, that makes use of the `Player`
|
`PlayerNotificationManager`, that makes use of the `Player`
|
||||||
`MediaMetadata` to populate the notification fields.
|
`MediaMetadata` to populate the notification fields.
|
||||||
|
* Deprecate `Player.getCurrentStaticMetadata`,
|
||||||
|
`Player.Listener.onStaticMetadataChanged` and
|
||||||
|
`Player.EVENT_STATIC_METADATA_CHANGED`. Use `Player.getMediaMetadata`,
|
||||||
|
`Player.Listener.onMediaMetadataChanged` and
|
||||||
|
`Player.EVENT_MEDIA_METADATA_CHANGED` for convenient access to
|
||||||
|
structured metadata, or access the raw static metadata directly from
|
||||||
|
the `TrackSelection#getFormat()`.
|
||||||
* Remove deprecated symbols:
|
* Remove deprecated symbols:
|
||||||
* Remove `Player.getPlaybackError`. Use `Player.getPlayerError` instead.
|
* Remove `Player.getPlaybackError`. Use `Player.getPlayerError` instead.
|
||||||
* Remove `Player.getCurrentTag`. Use `Player.getCurrentMediaItem` and
|
* Remove `Player.getCurrentTag`. Use `Player.getCurrentMediaItem` and
|
||||||
|
@ -541,6 +541,7 @@ public final class CastPlayer extends BasePlayer {
|
|||||||
return currentTrackGroups;
|
return currentTrackGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public ImmutableList<Metadata> getCurrentStaticMetadata() {
|
public ImmutableList<Metadata> getCurrentStaticMetadata() {
|
||||||
// CastPlayer does not currently support metadata.
|
// CastPlayer does not currently support metadata.
|
||||||
|
@ -367,6 +367,7 @@ public class ForwardingPlayer implements Player {
|
|||||||
return player.getCurrentTrackSelections();
|
return player.getCurrentTrackSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public List<Metadata> getCurrentStaticMetadata() {
|
public List<Metadata> getCurrentStaticMetadata() {
|
||||||
return player.getCurrentStaticMetadata();
|
return player.getCurrentStaticMetadata();
|
||||||
@ -642,6 +643,7 @@ public class ForwardingPlayer implements Player {
|
|||||||
eventListener.onTracksChanged(trackGroups, trackSelections);
|
eventListener.onTracksChanged(trackGroups, trackSelections);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void onStaticMetadataChanged(List<Metadata> metadataList) {
|
public void onStaticMetadataChanged(List<Metadata> metadataList) {
|
||||||
eventListener.onStaticMetadataChanged(metadataList);
|
eventListener.onStaticMetadataChanged(metadataList);
|
||||||
|
@ -32,6 +32,7 @@ import com.google.android.exoplayer2.metadata.MetadataOutput;
|
|||||||
import com.google.android.exoplayer2.source.TrackGroupArray;
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
import com.google.android.exoplayer2.text.Cue;
|
import com.google.android.exoplayer2.text.Cue;
|
||||||
import com.google.android.exoplayer2.text.TextOutput;
|
import com.google.android.exoplayer2.text.TextOutput;
|
||||||
|
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||||||
import com.google.android.exoplayer2.util.FlagSet;
|
import com.google.android.exoplayer2.util.FlagSet;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
@ -128,30 +129,20 @@ public interface Player {
|
|||||||
TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {}
|
TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the static metadata changes.
|
* @deprecated Use {@link Player#getMediaMetadata()} and {@link
|
||||||
*
|
* #onMediaMetadataChanged(MediaMetadata)} for access to structured metadata, or access the
|
||||||
* <p>The provided {@code metadataList} is an immutable list of {@link Metadata} instances,
|
* raw static metadata directly from the {@link TrackSelection#getFormat(int) track
|
||||||
* where the elements correspond to the {@link #getCurrentTrackSelections() current track
|
* selections' formats}.
|
||||||
* selections}, or an empty list if there are no track selections or the selected tracks contain
|
|
||||||
* no static metadata.
|
|
||||||
*
|
|
||||||
* <p>The metadata is considered static in the sense that it comes from the tracks' declared
|
|
||||||
* Formats, rather than being timed (or dynamic) metadata, which is represented within a
|
|
||||||
* metadata track.
|
|
||||||
*
|
|
||||||
* <p>{@link #onEvents(Player, Events)} will also be called to report this event along with
|
|
||||||
* other events that happen in the same {@link Looper} message queue iteration.
|
|
||||||
*
|
|
||||||
* @param metadataList The static metadata.
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
default void onStaticMetadataChanged(List<Metadata> metadataList) {}
|
default void onStaticMetadataChanged(List<Metadata> metadataList) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the combined {@link MediaMetadata} changes.
|
* Called when the combined {@link MediaMetadata} changes.
|
||||||
*
|
*
|
||||||
* <p>The provided {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata}
|
* <p>The provided {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata}
|
||||||
* and the static and dynamic metadata sourced from {@link #onStaticMetadataChanged(List)} and
|
* and the static and dynamic metadata from the {@link TrackSelection#getFormat(int) track
|
||||||
* {@link MetadataOutput#onMetadata(Metadata)}.
|
* selections' formats} and {@link MetadataOutput#onMetadata(Metadata)}.
|
||||||
*
|
*
|
||||||
* <p>{@link #onEvents(Player, Events)} will also be called to report this event along with
|
* <p>{@link #onEvents(Player, Events)} will also be called to report this event along with
|
||||||
* other events that happen in the same {@link Looper} message queue iteration.
|
* other events that happen in the same {@link Looper} message queue iteration.
|
||||||
@ -987,9 +978,6 @@ public interface Player {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void onPlaylistMetadataChanged(MediaMetadata mediaMetadata) {}
|
default void onPlaylistMetadataChanged(MediaMetadata mediaMetadata) {}
|
||||||
|
|
||||||
@Override
|
|
||||||
default void onStaticMetadataChanged(List<Metadata> metadataList) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1215,8 +1203,8 @@ public interface Player {
|
|||||||
int EVENT_MEDIA_ITEM_TRANSITION = 1;
|
int EVENT_MEDIA_ITEM_TRANSITION = 1;
|
||||||
/** {@link #getCurrentTrackGroups()} or {@link #getCurrentTrackSelections()} changed. */
|
/** {@link #getCurrentTrackGroups()} or {@link #getCurrentTrackSelections()} changed. */
|
||||||
int EVENT_TRACKS_CHANGED = 2;
|
int EVENT_TRACKS_CHANGED = 2;
|
||||||
/** {@link #getCurrentStaticMetadata()} changed. */
|
/** @deprecated Use {@link #EVENT_MEDIA_METADATA_CHANGED} for structured metadata changes. */
|
||||||
int EVENT_STATIC_METADATA_CHANGED = 3;
|
@Deprecated int EVENT_STATIC_METADATA_CHANGED = 3;
|
||||||
/** {@link #isLoading()} ()} changed. */
|
/** {@link #isLoading()} ()} changed. */
|
||||||
int EVENT_IS_LOADING_CHANGED = 4;
|
int EVENT_IS_LOADING_CHANGED = 4;
|
||||||
/** {@link #getPlaybackState()} changed. */
|
/** {@link #getPlaybackState()} changed. */
|
||||||
@ -1926,18 +1914,12 @@ public interface Player {
|
|||||||
TrackSelectionArray getCurrentTrackSelections();
|
TrackSelectionArray getCurrentTrackSelections();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current static metadata for the track selections.
|
* @deprecated Use {@link #getMediaMetadata()} and {@link
|
||||||
*
|
* Listener#onMediaMetadataChanged(MediaMetadata)} for access to structured metadata, or
|
||||||
* <p>The returned {@code metadataList} is an immutable list of {@link Metadata} instances, where
|
* access the raw static metadata directly from the {@link TrackSelection#getFormat(int) track
|
||||||
* the elements correspond to the {@link #getCurrentTrackSelections() current track selections},
|
* selections' formats}.
|
||||||
* or an empty list if there are no track selections or the selected tracks contain no static
|
|
||||||
* metadata.
|
|
||||||
*
|
|
||||||
* <p>This metadata is considered static in that it comes from the tracks' declared Formats,
|
|
||||||
* rather than being timed (or dynamic) metadata, which is represented within a metadata track.
|
|
||||||
*
|
|
||||||
* @see Listener#onStaticMetadataChanged(List)
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
List<Metadata> getCurrentStaticMetadata();
|
List<Metadata> getCurrentStaticMetadata();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1945,8 +1927,8 @@ public interface Player {
|
|||||||
* supported.
|
* supported.
|
||||||
*
|
*
|
||||||
* <p>This {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata} and the
|
* <p>This {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata} and the
|
||||||
* static and dynamic metadata sourced from {@link Listener#onStaticMetadataChanged(List)} and
|
* static and dynamic metadata from the {@link TrackSelection#getFormat(int) track selections'
|
||||||
* {@link MetadataOutput#onMetadata(Metadata)}.
|
* formats} and {@link MetadataOutput#onMetadata(Metadata)}.
|
||||||
*/
|
*/
|
||||||
MediaMetadata getMediaMetadata();
|
MediaMetadata getMediaMetadata();
|
||||||
|
|
||||||
|
@ -1004,6 +1004,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
return new TrackSelectionArray(playbackInfo.trackSelectorResult.selections);
|
return new TrackSelectionArray(playbackInfo.trackSelectorResult.selections);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public List<Metadata> getCurrentStaticMetadata() {
|
public List<Metadata> getCurrentStaticMetadata() {
|
||||||
return playbackInfo.staticMetadata;
|
return playbackInfo.staticMetadata;
|
||||||
@ -1264,7 +1265,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
.windowIndex;
|
.windowIndex;
|
||||||
mediaItem = newPlaybackInfo.timeline.getWindow(windowIndex, window).mediaItem;
|
mediaItem = newPlaybackInfo.timeline.getWindow(windowIndex, window).mediaItem;
|
||||||
}
|
}
|
||||||
mediaMetadata = mediaItem != null ? mediaItem.mediaMetadata : MediaMetadata.EMPTY;
|
newMediaMetadata = mediaItem != null ? mediaItem.mediaMetadata : MediaMetadata.EMPTY;
|
||||||
}
|
}
|
||||||
if (!previousPlaybackInfo.staticMetadata.equals(newPlaybackInfo.staticMetadata)) {
|
if (!previousPlaybackInfo.staticMetadata.equals(newPlaybackInfo.staticMetadata)) {
|
||||||
newMediaMetadata =
|
newMediaMetadata =
|
||||||
|
@ -1723,6 +1723,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
return player.getCurrentTrackSelections();
|
return player.getCurrentTrackSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public List<Metadata> getCurrentStaticMetadata() {
|
public List<Metadata> getCurrentStaticMetadata() {
|
||||||
verifyApplicationThread();
|
verifyApplicationThread();
|
||||||
|
@ -595,6 +595,7 @@ public class AnalyticsCollector
|
|||||||
listener -> listener.onTracksChanged(eventTime, trackGroups, trackSelections));
|
listener -> listener.onTracksChanged(eventTime, trackGroups, trackSelections));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public final void onStaticMetadataChanged(List<Metadata> metadataList) {
|
public final void onStaticMetadataChanged(List<Metadata> metadataList) {
|
||||||
EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
|
EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
|
||||||
|
@ -48,6 +48,7 @@ import com.google.android.exoplayer2.source.LoadEventInfo;
|
|||||||
import com.google.android.exoplayer2.source.MediaLoadData;
|
import com.google.android.exoplayer2.source.MediaLoadData;
|
||||||
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
||||||
import com.google.android.exoplayer2.source.TrackGroupArray;
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
|
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||||||
import com.google.android.exoplayer2.util.FlagSet;
|
import com.google.android.exoplayer2.util.FlagSet;
|
||||||
import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer;
|
import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer;
|
||||||
@ -225,8 +226,8 @@ public interface AnalyticsListener {
|
|||||||
* {@link Player#getCurrentTrackGroups()} or {@link Player#getCurrentTrackSelections()} changed.
|
* {@link Player#getCurrentTrackGroups()} or {@link Player#getCurrentTrackSelections()} changed.
|
||||||
*/
|
*/
|
||||||
int EVENT_TRACKS_CHANGED = Player.EVENT_TRACKS_CHANGED;
|
int EVENT_TRACKS_CHANGED = Player.EVENT_TRACKS_CHANGED;
|
||||||
/** {@link Player#getCurrentStaticMetadata()} changed. */
|
/** @deprecated See {@link Player#EVENT_MEDIA_METADATA_CHANGED}. */
|
||||||
int EVENT_STATIC_METADATA_CHANGED = Player.EVENT_STATIC_METADATA_CHANGED;
|
@Deprecated int EVENT_STATIC_METADATA_CHANGED = Player.EVENT_STATIC_METADATA_CHANGED;
|
||||||
/** {@link Player#isLoading()} ()} changed. */
|
/** {@link Player#isLoading()} ()} changed. */
|
||||||
int EVENT_IS_LOADING_CHANGED = Player.EVENT_IS_LOADING_CHANGED;
|
int EVENT_IS_LOADING_CHANGED = Player.EVENT_IS_LOADING_CHANGED;
|
||||||
/** {@link Player#getPlaybackState()} changed. */
|
/** {@link Player#getPlaybackState()} changed. */
|
||||||
@ -682,28 +683,19 @@ public interface AnalyticsListener {
|
|||||||
EventTime eventTime, TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {}
|
EventTime eventTime, TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the static metadata changes.
|
* @deprecated Use {@link Player#getMediaMetadata()} and {@link #onMediaMetadataChanged(EventTime,
|
||||||
*
|
* MediaMetadata)} for access to structured metadata, or access the raw static metadata
|
||||||
* <p>The provided {@code metadataList} is an immutable list of {@link Metadata} instances, where
|
* directly from the {@link TrackSelection#getFormat(int) track selections' formats}.
|
||||||
* the elements correspond to the current track selections (as returned by {@link
|
|
||||||
* #onTracksChanged(EventTime, TrackGroupArray, TrackSelectionArray)}, or an empty list if there
|
|
||||||
* are no track selections or the selected tracks contain no static metadata.
|
|
||||||
*
|
|
||||||
* <p>The metadata is considered static in the sense that it comes from the tracks' declared
|
|
||||||
* Formats, rather than being timed (or dynamic) metadata, which is represented within a metadata
|
|
||||||
* track.
|
|
||||||
*
|
|
||||||
* @param eventTime The event time.
|
|
||||||
* @param metadataList The static metadata.
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
default void onStaticMetadataChanged(EventTime eventTime, List<Metadata> metadataList) {}
|
default void onStaticMetadataChanged(EventTime eventTime, List<Metadata> metadataList) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the combined {@link MediaMetadata} changes.
|
* Called when the combined {@link MediaMetadata} changes.
|
||||||
*
|
*
|
||||||
* <p>The provided {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata}
|
* <p>The provided {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata}
|
||||||
* and the static and dynamic metadata sourced from {@link
|
* and the static and dynamic metadata from the {@link TrackSelection#getFormat(int) track
|
||||||
* Player.Listener#onStaticMetadataChanged(List)} and {@link MetadataOutput#onMetadata(Metadata)}.
|
* selections' formats} and {@link MetadataOutput#onMetadata(Metadata)}.
|
||||||
*
|
*
|
||||||
* @param eventTime The event time.
|
* @param eventTime The event time.
|
||||||
* @param mediaMetadata The combined {@link MediaMetadata}.
|
* @param mediaMetadata The combined {@link MediaMetadata}.
|
||||||
|
@ -47,7 +47,6 @@ import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
|||||||
import com.google.android.exoplayer2.video.VideoSize;
|
import com.google.android.exoplayer2.video.VideoSize;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/** Logs events from {@link Player} and other core components using {@link Log}. */
|
/** Logs events from {@link Player} and other core components using {@link Log}. */
|
||||||
@ -334,20 +333,6 @@ public class EventLogger implements AnalyticsListener {
|
|||||||
logd("]");
|
logd("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStaticMetadataChanged(EventTime eventTime, List<Metadata> metadataList) {
|
|
||||||
logd("staticMetadata [" + getEventTimeString(eventTime));
|
|
||||||
for (int i = 0; i < metadataList.size(); i++) {
|
|
||||||
Metadata metadata = metadataList.get(i);
|
|
||||||
if (metadata.length() != 0) {
|
|
||||||
logd(" Metadata:" + i + " [");
|
|
||||||
printMetadata(metadata, " ");
|
|
||||||
logd(" ]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logd("]");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMetadata(EventTime eventTime, Metadata metadata) {
|
public void onMetadata(EventTime eventTime, Metadata metadata) {
|
||||||
logd("metadata [" + getEventTimeString(eventTime));
|
logd("metadata [" + getEventTimeString(eventTime));
|
||||||
|
@ -8937,72 +8937,6 @@ public final class ExoPlayerTest {
|
|||||||
runUntilPlaybackState(player, Player.STATE_ENDED);
|
runUntilPlaybackState(player, Player.STATE_ENDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void staticMetadata_callbackIsCalledCorrectlyAndMatchesGetter() throws Exception {
|
|
||||||
Format videoFormat =
|
|
||||||
new Format.Builder()
|
|
||||||
.setSampleMimeType(MimeTypes.VIDEO_H264)
|
|
||||||
.setMetadata(
|
|
||||||
new Metadata(
|
|
||||||
new TextInformationFrame(
|
|
||||||
/* id= */ "TT2",
|
|
||||||
/* description= */ "Video",
|
|
||||||
/* value= */ "Video track name")))
|
|
||||||
.build();
|
|
||||||
Format audioFormat =
|
|
||||||
new Format.Builder()
|
|
||||||
.setSampleMimeType(MimeTypes.AUDIO_AAC)
|
|
||||||
.setMetadata(
|
|
||||||
new Metadata(
|
|
||||||
new TextInformationFrame(
|
|
||||||
/* id= */ "TT2",
|
|
||||||
/* description= */ "Audio",
|
|
||||||
/* value= */ "Audio track name")))
|
|
||||||
.build();
|
|
||||||
Player.Listener playerListener = mock(Player.Listener.class);
|
|
||||||
Timeline fakeTimeline =
|
|
||||||
new FakeTimeline(
|
|
||||||
new TimelineWindowDefinition(
|
|
||||||
/* isSeekable= */ true, /* isDynamic= */ false, /* durationUs= */ 100000));
|
|
||||||
SimpleExoPlayer player = new TestExoPlayerBuilder(context).build();
|
|
||||||
|
|
||||||
player.setMediaSource(new FakeMediaSource(fakeTimeline, videoFormat, audioFormat));
|
|
||||||
player.addListener(playerListener);
|
|
||||||
player.prepare();
|
|
||||||
player.play();
|
|
||||||
runUntilPlaybackState(player, Player.STATE_ENDED);
|
|
||||||
List<Metadata> metadata = player.getCurrentStaticMetadata();
|
|
||||||
player.release();
|
|
||||||
|
|
||||||
assertThat(metadata).containsExactly(videoFormat.metadata, audioFormat.metadata).inOrder();
|
|
||||||
verify(playerListener)
|
|
||||||
.onStaticMetadataChanged(ImmutableList.of(videoFormat.metadata, audioFormat.metadata));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void staticMetadata_callbackIsNotCalledWhenMetadataEmptyAndGetterReturnsEmptyList()
|
|
||||||
throws Exception {
|
|
||||||
Format videoFormat = new Format.Builder().setSampleMimeType(MimeTypes.VIDEO_H264).build();
|
|
||||||
Format audioFormat = new Format.Builder().setSampleMimeType(MimeTypes.AUDIO_AAC).build();
|
|
||||||
Player.Listener playerListener = mock(Player.Listener.class);
|
|
||||||
Timeline fakeTimeline =
|
|
||||||
new FakeTimeline(
|
|
||||||
new TimelineWindowDefinition(
|
|
||||||
/* isSeekable= */ true, /* isDynamic= */ false, /* durationUs= */ 100000));
|
|
||||||
SimpleExoPlayer player = new TestExoPlayerBuilder(context).build();
|
|
||||||
|
|
||||||
player.setMediaSource(new FakeMediaSource(fakeTimeline, videoFormat, audioFormat));
|
|
||||||
player.addListener(playerListener);
|
|
||||||
player.prepare();
|
|
||||||
player.play();
|
|
||||||
runUntilPlaybackState(player, Player.STATE_ENDED);
|
|
||||||
List<Metadata> metadata = player.getCurrentStaticMetadata();
|
|
||||||
player.release();
|
|
||||||
|
|
||||||
assertThat(metadata).isEmpty();
|
|
||||||
verify(playerListener, never()).onStaticMetadataChanged(any());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void targetLiveOffsetInMedia_adjustsLiveOffsetToTargetOffset() throws Exception {
|
public void targetLiveOffsetInMedia_adjustsLiveOffsetToTargetOffset() throws Exception {
|
||||||
long windowStartUnixTimeMs = 987_654_321_000L;
|
long windowStartUnixTimeMs = 987_654_321_000L;
|
||||||
@ -9495,7 +9429,11 @@ public final class ExoPlayerTest {
|
|||||||
Format formatWithStaticMetadata =
|
Format formatWithStaticMetadata =
|
||||||
new Format.Builder()
|
new Format.Builder()
|
||||||
.setSampleMimeType(MimeTypes.VIDEO_H264)
|
.setSampleMimeType(MimeTypes.VIDEO_H264)
|
||||||
.setMetadata(new Metadata(new BinaryFrame(/* id= */ "", /* data= */ new byte[0])))
|
.setMetadata(
|
||||||
|
new Metadata(
|
||||||
|
new BinaryFrame(/* id= */ "", /* data= */ new byte[0]),
|
||||||
|
new TextInformationFrame(
|
||||||
|
/* id= */ "TT2", /* description= */ null, /* value= */ "title")))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Set multiple values together.
|
// Set multiple values together.
|
||||||
@ -9554,7 +9492,7 @@ public final class ExoPlayerTest {
|
|||||||
verify(listener, atLeastOnce()).onPlaybackStateChanged(anyInt());
|
verify(listener, atLeastOnce()).onPlaybackStateChanged(anyInt());
|
||||||
verify(listener, atLeastOnce()).onIsLoadingChanged(anyBoolean());
|
verify(listener, atLeastOnce()).onIsLoadingChanged(anyBoolean());
|
||||||
verify(listener, atLeastOnce()).onTracksChanged(any(), any());
|
verify(listener, atLeastOnce()).onTracksChanged(any(), any());
|
||||||
verify(listener, atLeastOnce()).onStaticMetadataChanged(any());
|
verify(listener, atLeastOnce()).onMediaMetadataChanged(any());
|
||||||
verify(listener, atLeastOnce()).onPlayWhenReadyChanged(anyBoolean(), anyInt());
|
verify(listener, atLeastOnce()).onPlayWhenReadyChanged(anyBoolean(), anyInt());
|
||||||
verify(listener, atLeastOnce()).onIsPlayingChanged(anyBoolean());
|
verify(listener, atLeastOnce()).onIsPlayingChanged(anyBoolean());
|
||||||
verify(listener, atLeastOnce()).onPlayerErrorChanged(any());
|
verify(listener, atLeastOnce()).onPlayerErrorChanged(any());
|
||||||
@ -9572,7 +9510,7 @@ public final class ExoPlayerTest {
|
|||||||
assertThat(containsEvent(allEvents, Player.EVENT_PLAYBACK_STATE_CHANGED)).isTrue();
|
assertThat(containsEvent(allEvents, Player.EVENT_PLAYBACK_STATE_CHANGED)).isTrue();
|
||||||
assertThat(containsEvent(allEvents, Player.EVENT_IS_LOADING_CHANGED)).isTrue();
|
assertThat(containsEvent(allEvents, Player.EVENT_IS_LOADING_CHANGED)).isTrue();
|
||||||
assertThat(containsEvent(allEvents, Player.EVENT_TRACKS_CHANGED)).isTrue();
|
assertThat(containsEvent(allEvents, Player.EVENT_TRACKS_CHANGED)).isTrue();
|
||||||
assertThat(containsEvent(allEvents, Player.EVENT_STATIC_METADATA_CHANGED)).isTrue();
|
assertThat(containsEvent(allEvents, Player.EVENT_MEDIA_METADATA_CHANGED)).isTrue();
|
||||||
assertThat(containsEvent(allEvents, Player.EVENT_PLAY_WHEN_READY_CHANGED)).isTrue();
|
assertThat(containsEvent(allEvents, Player.EVENT_PLAY_WHEN_READY_CHANGED)).isTrue();
|
||||||
assertThat(containsEvent(allEvents, Player.EVENT_IS_PLAYING_CHANGED)).isTrue();
|
assertThat(containsEvent(allEvents, Player.EVENT_IS_PLAYING_CHANGED)).isTrue();
|
||||||
assertThat(containsEvent(allEvents, Player.EVENT_PLAYER_ERROR)).isTrue();
|
assertThat(containsEvent(allEvents, Player.EVENT_PLAYER_ERROR)).isTrue();
|
||||||
|
@ -375,6 +375,7 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public List<Metadata> getCurrentStaticMetadata() {
|
public List<Metadata> getCurrentStaticMetadata() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user