mirror of
https://github.com/androidx/media.git
synced 2025-05-16 12:09:50 +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
|
* Add `Player.onPlaybackStateChanged` and deprecate
|
||||||
`Player.onPlayerStateChanged`.
|
`Player.onPlayerStateChanged`.
|
||||||
* Deprecate and rename getPlaybackError to getPlayerError for consistency.
|
* Deprecate and rename getPlaybackError to getPlayerError for consistency.
|
||||||
|
* Deprecate and rename onLoadingChanged to onIsLoadingChanged for consistency.
|
||||||
* Make `MediaSourceEventListener.LoadEventInfo` and
|
* Make `MediaSourceEventListener.LoadEventInfo` and
|
||||||
`MediaSourceEventListener.MediaLoadData` top-level classes.
|
`MediaSourceEventListener.MediaLoadData` top-level classes.
|
||||||
* Rename `MediaCodecRenderer.onOutputFormatChanged` to
|
* Rename `MediaCodecRenderer.onOutputFormatChanged` to
|
||||||
|
@ -1202,7 +1202,11 @@ import java.util.concurrent.TimeoutException;
|
|||||||
playbackInfo.trackGroups, playbackInfo.trackSelectorResult.selections));
|
playbackInfo.trackGroups, playbackInfo.trackSelectorResult.selections));
|
||||||
}
|
}
|
||||||
if (isLoadingChanged) {
|
if (isLoadingChanged) {
|
||||||
invokeAll(listenerSnapshot, listener -> listener.onLoadingChanged(playbackInfo.isLoading));
|
invokeAll(
|
||||||
|
listenerSnapshot,
|
||||||
|
listener -> {
|
||||||
|
listener.onIsLoadingChanged(playbackInfo.isLoading);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (playbackStateChanged) {
|
if (playbackStateChanged) {
|
||||||
invokeAll(
|
invokeAll(
|
||||||
|
@ -407,6 +407,13 @@ public interface Player {
|
|||||||
*
|
*
|
||||||
* @param isLoading Whether the source is currently being loaded.
|
* @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) {}
|
default void onLoadingChanged(boolean isLoading) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1931,7 +1931,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
// Player.EventListener implementation.
|
// Player.EventListener implementation.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingChanged(boolean isLoading) {
|
public void onIsLoadingChanged(boolean isLoading) {
|
||||||
if (priorityTaskManager != null) {
|
if (priorityTaskManager != null) {
|
||||||
if (isLoading && !isPriorityTaskManagerRegistered) {
|
if (isLoading && !isPriorityTaskManagerRegistered) {
|
||||||
priorityTaskManager.add(C.PRIORITY_PLAYBACK);
|
priorityTaskManager.add(C.PRIORITY_PLAYBACK);
|
||||||
|
@ -431,10 +431,10 @@ public class AnalyticsCollector
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void onLoadingChanged(boolean isLoading) {
|
public final void onIsLoadingChanged(boolean isLoading) {
|
||||||
EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
|
EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
|
||||||
for (AnalyticsListener listener : listeners) {
|
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 eventTime The event time.
|
||||||
* @param isLoading Whether the player is loading.
|
* @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) {}
|
default void onLoadingChanged(EventTime eventTime, boolean isLoading) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +91,7 @@ public class EventLogger implements AnalyticsListener {
|
|||||||
// AnalyticsListener
|
// AnalyticsListener
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingChanged(EventTime eventTime, boolean isLoading) {
|
public void onIsLoadingChanged(EventTime eventTime, boolean isLoading) {
|
||||||
logd(eventTime, "loading", Boolean.toString(isLoading));
|
logd(eventTime, "loading", Boolean.toString(isLoading));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1393,7 +1393,7 @@ public final class AnalyticsCollectorTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingChanged(EventTime eventTime, boolean isLoading) {
|
public void onIsLoadingChanged(EventTime eventTime, boolean isLoading) {
|
||||||
reportedEvents.add(new ReportedEvent(EVENT_LOADING_CHANGED, eventTime));
|
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
|
* 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 {
|
public static final class WaitForIsLoading extends Action {
|
||||||
|
|
||||||
@ -1015,7 +1015,7 @@ public abstract class Action {
|
|||||||
player.addListener(
|
player.addListener(
|
||||||
new Player.EventListener() {
|
new Player.EventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingChanged(boolean isLoading) {
|
public void onIsLoadingChanged(boolean isLoading) {
|
||||||
if (targetIsLoading == isLoading) {
|
if (targetIsLoading == isLoading) {
|
||||||
player.removeListener(this);
|
player.removeListener(this);
|
||||||
nextAction.schedule(player, trackSelector, surface, handler);
|
nextAction.schedule(player, trackSelector, surface, handler);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user