mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Make Player.getPlayerError return a PlaybackException
PiperOrigin-RevId: 378899373
This commit is contained in:
parent
5f77bf0469
commit
5f1921f531
5 changed files with 14 additions and 5 deletions
|
|
@ -178,7 +178,7 @@ public class ForwardingPlayer implements Player {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ExoPlaybackException getPlayerError() {
|
public PlaybackException getPlayerError() {
|
||||||
return player.getPlayerError();
|
return player.getPlayerError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1472,7 +1472,7 @@ public interface Player {
|
||||||
* @see Listener#onPlayerError(ExoPlaybackException)
|
* @see Listener#onPlayerError(ExoPlaybackException)
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
ExoPlaybackException getPlayerError();
|
PlaybackException getPlayerError();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resumes playback as soon as {@link #getPlaybackState()} == {@link #STATE_READY}. Equivalent to
|
* Resumes playback as soon as {@link #getPlaybackState()} == {@link #STATE_READY}. Equivalent to
|
||||||
|
|
|
||||||
|
|
@ -834,6 +834,13 @@ public interface ExoPlayer extends Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Equivalent to {@link Player#getPlayerError()}, except the exception is guaranteed to be an
|
||||||
|
* {@link ExoPlaybackException}.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
ExoPlaybackException getPlayerError();
|
||||||
|
|
||||||
/** Returns the component of this player for audio output, or null if audio is not supported. */
|
/** Returns the component of this player for audio output, or null if audio is not supported. */
|
||||||
@Nullable
|
@Nullable
|
||||||
AudioComponent getAudioComponent();
|
AudioComponent getAudioComponent();
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ import android.os.SystemClock;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
|
||||||
import com.google.android.exoplayer2.Format;
|
import com.google.android.exoplayer2.Format;
|
||||||
|
import com.google.android.exoplayer2.PlaybackException;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.Timeline;
|
import com.google.android.exoplayer2.Timeline;
|
||||||
import com.google.android.exoplayer2.Timeline.Period;
|
import com.google.android.exoplayer2.Timeline.Period;
|
||||||
|
|
@ -489,7 +489,7 @@ public final class PlaybackStatsListener
|
||||||
int droppedFrameCount,
|
int droppedFrameCount,
|
||||||
boolean hasAudioUnderun,
|
boolean hasAudioUnderun,
|
||||||
boolean startedLoading,
|
boolean startedLoading,
|
||||||
@Nullable ExoPlaybackException fatalError,
|
@Nullable PlaybackException fatalError,
|
||||||
@Nullable Exception nonFatalException,
|
@Nullable Exception nonFatalException,
|
||||||
long bandwidthTimeMs,
|
long bandwidthTimeMs,
|
||||||
long bandwidthBytes,
|
long bandwidthBytes,
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,9 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (events.contains(EVENT_PLAYER_ERROR)) {
|
if (events.contains(EVENT_PLAYER_ERROR)) {
|
||||||
playerError = checkNotNull(player.getPlayerError());
|
// The exception is guaranteed to be an ExoPlaybackException because the underlying player is
|
||||||
|
// an ExoPlayer instance.
|
||||||
|
playerError = (ExoPlaybackException) checkNotNull(player.getPlayerError());
|
||||||
onPlayerErrorInternal(playerError);
|
onPlayerErrorInternal(playerError);
|
||||||
}
|
}
|
||||||
if (events.contains(EVENT_PLAYBACK_STATE_CHANGED)) {
|
if (events.contains(EVENT_PLAYBACK_STATE_CHANGED)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue