mirror of
https://github.com/androidx/media.git
synced 2025-05-16 03:59:54 +08:00
deprecate and rename onLoadingChanged
PiperOrigin-RevId: 294222083
This commit is contained in:
parent
5725acb789
commit
0eb0267131
@ -10,6 +10,7 @@
|
||||
* Add `Player.onPlaybackStateChanged` and deprecate
|
||||
`Player.onPlayerStateChanged`.
|
||||
* Deprecate and rename getPlaybackError to getPlayerError for consistency.
|
||||
* Deprecate and rename onLoadingChanged to onIsLoadingChanged for consistency.
|
||||
* Make `MediaSourceEventListener.LoadEventInfo` and
|
||||
`MediaSourceEventListener.MediaLoadData` top-level classes.
|
||||
* Rename `MediaCodecRenderer.onOutputFormatChanged` to
|
||||
|
@ -1202,7 +1202,11 @@ import java.util.concurrent.TimeoutException;
|
||||
playbackInfo.trackGroups, playbackInfo.trackSelectorResult.selections));
|
||||
}
|
||||
if (isLoadingChanged) {
|
||||
invokeAll(listenerSnapshot, listener -> listener.onLoadingChanged(playbackInfo.isLoading));
|
||||
invokeAll(
|
||||
listenerSnapshot,
|
||||
listener -> {
|
||||
listener.onIsLoadingChanged(playbackInfo.isLoading);
|
||||
});
|
||||
}
|
||||
if (playbackStateChanged) {
|
||||
invokeAll(
|
||||
|
@ -407,6 +407,13 @@ public interface Player {
|
||||
*
|
||||
* @param isLoading Whether the source is currently being loaded.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
default void onIsLoadingChanged(boolean isLoading) {
|
||||
onLoadingChanged(isLoading);
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #onIsLoadingChanged(boolean)} instead. */
|
||||
@Deprecated
|
||||
default void onLoadingChanged(boolean isLoading) {}
|
||||
|
||||
/**
|
||||
|
@ -1931,7 +1931,7 @@ public class SimpleExoPlayer extends BasePlayer
|
||||
// Player.EventListener implementation.
|
||||
|
||||
@Override
|
||||
public void onLoadingChanged(boolean isLoading) {
|
||||
public void onIsLoadingChanged(boolean isLoading) {
|
||||
if (priorityTaskManager != null) {
|
||||
if (isLoading && !isPriorityTaskManagerRegistered) {
|
||||
priorityTaskManager.add(C.PRIORITY_PLAYBACK);
|
||||
|
@ -431,10 +431,10 @@ public class AnalyticsCollector
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onLoadingChanged(boolean isLoading) {
|
||||
public final void onIsLoadingChanged(boolean isLoading) {
|
||||
EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
|
||||
for (AnalyticsListener listener : listeners) {
|
||||
listener.onLoadingChanged(eventTime, isLoading);
|
||||
listener.onIsLoadingChanged(eventTime, isLoading);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,6 +227,13 @@ public interface AnalyticsListener {
|
||||
* @param eventTime The event time.
|
||||
* @param isLoading Whether the player is loading.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
default void onIsLoadingChanged(EventTime eventTime, boolean isLoading) {
|
||||
onLoadingChanged(eventTime, isLoading);
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #onIsLoadingChanged(EventTime, boolean)} instead. */
|
||||
@Deprecated
|
||||
default void onLoadingChanged(EventTime eventTime, boolean isLoading) {}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ public class EventLogger implements AnalyticsListener {
|
||||
// AnalyticsListener
|
||||
|
||||
@Override
|
||||
public void onLoadingChanged(EventTime eventTime, boolean isLoading) {
|
||||
public void onIsLoadingChanged(EventTime eventTime, boolean isLoading) {
|
||||
logd(eventTime, "loading", Boolean.toString(isLoading));
|
||||
}
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ public final class AnalyticsCollectorTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingChanged(EventTime eventTime, boolean isLoading) {
|
||||
public void onIsLoadingChanged(EventTime eventTime, boolean isLoading) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_LOADING_CHANGED, eventTime));
|
||||
}
|
||||
|
||||
|
@ -984,7 +984,7 @@ public abstract class Action {
|
||||
|
||||
/**
|
||||
* Waits for a specified loading state, returning either immediately or after a call to {@link
|
||||
* Player.EventListener#onLoadingChanged(boolean)}.
|
||||
* Player.EventListener#onIsLoadingChanged(boolean)}.
|
||||
*/
|
||||
public static final class WaitForIsLoading extends Action {
|
||||
|
||||
@ -1015,7 +1015,7 @@ public abstract class Action {
|
||||
player.addListener(
|
||||
new Player.EventListener() {
|
||||
@Override
|
||||
public void onLoadingChanged(boolean isLoading) {
|
||||
public void onIsLoadingChanged(boolean isLoading) {
|
||||
if (targetIsLoading == isLoading) {
|
||||
player.removeListener(this);
|
||||
nextAction.schedule(player, trackSelector, surface, handler);
|
||||
|
Loading…
x
Reference in New Issue
Block a user