Move ExoPlaybackException back into core
PiperOrigin-RevId: 381941053
This commit is contained in:
parent
02db70bdd0
commit
155e27ec7c
@ -28,10 +28,10 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import com.google.android.exoplayer2.BasePlayer;
|
import com.google.android.exoplayer2.BasePlayer;
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
|
||||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||||
import com.google.android.exoplayer2.MediaItem;
|
import com.google.android.exoplayer2.MediaItem;
|
||||||
import com.google.android.exoplayer2.MediaMetadata;
|
import com.google.android.exoplayer2.MediaMetadata;
|
||||||
|
import com.google.android.exoplayer2.PlaybackException;
|
||||||
import com.google.android.exoplayer2.PlaybackParameters;
|
import com.google.android.exoplayer2.PlaybackParameters;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.Timeline;
|
import com.google.android.exoplayer2.Timeline;
|
||||||
@ -338,7 +338,7 @@ public final class CastPlayer extends BasePlayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public ExoPlaybackException getPlayerError() {
|
public PlaybackException getPlayerError() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ import androidx.leanback.media.SurfaceHolderGlueHost;
|
|||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ControlDispatcher;
|
import com.google.android.exoplayer2.ControlDispatcher;
|
||||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
|
||||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||||
import com.google.android.exoplayer2.PlaybackException;
|
import com.google.android.exoplayer2.PlaybackException;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
@ -262,14 +261,14 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
|||||||
Pair<Integer, String> errorMessage = errorMessageProvider.getErrorMessage(exception);
|
Pair<Integer, String> errorMessage = errorMessageProvider.getErrorMessage(exception);
|
||||||
callback.onError(LeanbackPlayerAdapter.this, errorMessage.first, errorMessage.second);
|
callback.onError(LeanbackPlayerAdapter.this, errorMessage.first, errorMessage.second);
|
||||||
} else {
|
} else {
|
||||||
int rendererIndex = C.INDEX_UNSET;
|
|
||||||
if (exception instanceof ExoPlaybackException) {
|
|
||||||
rendererIndex = ((ExoPlaybackException) exception).rendererIndex;
|
|
||||||
}
|
|
||||||
callback.onError(
|
callback.onError(
|
||||||
LeanbackPlayerAdapter.this,
|
LeanbackPlayerAdapter.this,
|
||||||
exception.errorCode,
|
exception.errorCode,
|
||||||
context.getString(R.string.lb_media_player_error, exception.errorCode, rendererIndex));
|
// This string was probably tailored for MediaPlayer, whose callback takes 2 ints as
|
||||||
|
// error code. Since ExoPlayer provides a single error code, we just pass 0 as the
|
||||||
|
// extra.
|
||||||
|
context.getString(
|
||||||
|
R.string.lb_media_player_error, /* formatArgs...= */ exception.errorCode, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import androidx.annotation.IntDef;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import com.google.android.exoplayer2.C.FormatSupport;
|
import com.google.android.exoplayer2.C.FormatSupport;
|
||||||
import com.google.android.exoplayer2.source.MediaPeriodId;
|
import com.google.android.exoplayer2.source.MediaPeriodId;
|
||||||
|
import com.google.android.exoplayer2.source.MediaSource;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -43,18 +44,16 @@ public final class ExoPlaybackException extends PlaybackException {
|
|||||||
@IntDef({TYPE_SOURCE, TYPE_RENDERER, TYPE_UNEXPECTED, TYPE_REMOTE})
|
@IntDef({TYPE_SOURCE, TYPE_RENDERER, TYPE_UNEXPECTED, TYPE_REMOTE})
|
||||||
public @interface Type {}
|
public @interface Type {}
|
||||||
/**
|
/**
|
||||||
* The error occurred loading data from a {@code MediaSource}.
|
* The error occurred loading data from a {@link MediaSource}.
|
||||||
*
|
*
|
||||||
* <p>Call {@link #getSourceException()} to retrieve the underlying cause.
|
* <p>Call {@link #getSourceException()} to retrieve the underlying cause.
|
||||||
*/
|
*/
|
||||||
// TODO(b/172315872) MediaSource was a link. Link to equivalent concept or remove @code.
|
|
||||||
public static final int TYPE_SOURCE = 0;
|
public static final int TYPE_SOURCE = 0;
|
||||||
/**
|
/**
|
||||||
* The error occurred in a {@code Renderer}.
|
* The error occurred in a {@link Renderer}.
|
||||||
*
|
*
|
||||||
* <p>Call {@link #getRendererException()} to retrieve the underlying cause.
|
* <p>Call {@link #getRendererException()} to retrieve the underlying cause.
|
||||||
*/
|
*/
|
||||||
// TODO(b/172315872) Renderer was a link. Link to equivalent concept or remove @code.
|
|
||||||
public static final int TYPE_RENDERER = 1;
|
public static final int TYPE_RENDERER = 1;
|
||||||
/**
|
/**
|
||||||
* The error was an unexpected {@link RuntimeException}.
|
* The error was an unexpected {@link RuntimeException}.
|
Loading…
x
Reference in New Issue
Block a user