mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Add variable to track playWhenReady status of a TrackSelection instance
This commit is contained in:
parent
ceac959c29
commit
943e165f1f
@ -54,6 +54,10 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
|
|||||||
// Lazily initialized hashcode.
|
// Lazily initialized hashcode.
|
||||||
private int hashCode;
|
private int hashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last playWhenReady value when {@link #onPlayWhenReadyChanged(boolean)} was triggered */
|
||||||
|
private boolean lastPlayWhenReady;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param group The {@link TrackGroup}. Must not be null.
|
* @param group The {@link TrackGroup}. Must not be null.
|
||||||
* @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
|
* @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
|
||||||
@ -87,6 +91,7 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
|
|||||||
this.tracks[i] = group.indexOf(formats[i]);
|
this.tracks[i] = group.indexOf(formats[i]);
|
||||||
}
|
}
|
||||||
excludeUntilTimes = new long[length];
|
excludeUntilTimes = new long[length];
|
||||||
|
lastPlayWhenReady = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TrackSelection implementation.
|
// TrackSelection implementation.
|
||||||
@ -191,6 +196,15 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
|
|||||||
return excludeUntilTimes[index] > nowMs;
|
return excludeUntilTimes[index] > nowMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayWhenReadyChanged(boolean playWhenReady) {
|
||||||
|
lastPlayWhenReady = playWhenReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final boolean getPlayWhenReady() {
|
||||||
|
return lastPlayWhenReady;
|
||||||
|
}
|
||||||
|
|
||||||
// Object overrides.
|
// Object overrides.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user