Commit 0ad33116 by olly Committed by Oliver Woodman

Simplify artwork selection in PlayerView

PiperOrigin-RevId: 338056357
parent f1c3928b
......@@ -300,10 +300,10 @@ public class EventLogger implements AnalyticsListener {
public void onStaticMetadataChanged(EventTime eventTime, List<Metadata> metadataList) {
logd("staticMetadata [" + getEventTimeString(eventTime));
for (int i = 0; i < metadataList.size(); i++) {
@Nullable Metadata currentMetadata = metadataList.get(i);
if (currentMetadata != null && currentMetadata.length() != 0) {
Metadata metadata = metadataList.get(i);
if (metadata.length() != 0) {
logd(" " + i);
printMetadata(currentMetadata, " ");
printMetadata(metadata, " ");
}
}
logd("]");
......
......@@ -57,7 +57,6 @@ import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.source.ads.AdsLoader;
import com.google.android.exoplayer2.text.Cue;
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.ui.AspectRatioFrameLayout.ResizeMode;
import com.google.android.exoplayer2.ui.spherical.SingleTapListener;
......@@ -1373,15 +1372,9 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
closeShutter();
// Display artwork if enabled and available, else hide it.
if (useArtwork()) {
for (int i = 0; i < selections.length; i++) {
@Nullable TrackSelection selection = selections.get(i);
if (selection != null) {
for (int j = 0; j < selection.length(); j++) {
@Nullable Metadata metadata = selection.getFormat(j).metadata;
if (metadata != null && setArtworkFromMetadata(metadata)) {
return;
}
}
for (Metadata metadata : player.getCurrentStaticMetadata()) {
if (setArtworkFromMetadata(metadata)) {
return;
}
}
if (setDrawableArtwork(defaultArtwork)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment