mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Add ERROR_CODE_FAILED_RUNTIME_CHECK for failed checks
PiperOrigin-RevId: 387143625
This commit is contained in:
parent
f9d94204ad
commit
0df62a4f20
4 changed files with 19 additions and 3 deletions
|
|
@ -937,7 +937,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
|
|||
throw new OpenException(
|
||||
"HTTP request with non-empty body must set Content-Type",
|
||||
dataSpec,
|
||||
PlaybackException.ERROR_CODE_IO_BAD_HTTP_REQUEST,
|
||||
PlaybackException.ERROR_CODE_FAILED_RUNTIME_CHECK,
|
||||
Status.IDLE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
|
|||
throw new HttpDataSourceException(
|
||||
"Malformed URL",
|
||||
dataSpec,
|
||||
PlaybackException.ERROR_CODE_IO_BAD_HTTP_REQUEST,
|
||||
PlaybackException.ERROR_CODE_FAILED_RUNTIME_CHECK,
|
||||
HttpDataSourceException.TYPE_OPEN);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class PlaybackException extends Exception implements Bundleable {
|
|||
ERROR_CODE_REMOTE_ERROR,
|
||||
ERROR_CODE_BEHIND_LIVE_WINDOW,
|
||||
ERROR_CODE_TIMEOUT,
|
||||
ERROR_CODE_FAILED_RUNTIME_CHECK,
|
||||
ERROR_CODE_IO_UNSPECIFIED,
|
||||
ERROR_CODE_IO_NETWORK_UNAVAILABLE,
|
||||
ERROR_CODE_IO_NETWORK_CONNECTION_FAILED,
|
||||
|
|
@ -94,6 +95,13 @@ public class PlaybackException extends Exception implements Bundleable {
|
|||
public static final int ERROR_CODE_BEHIND_LIVE_WINDOW = 1002;
|
||||
/** Caused by a generic timeout. */
|
||||
public static final int ERROR_CODE_TIMEOUT = 1003;
|
||||
/**
|
||||
* Caused by a failed runtime check.
|
||||
*
|
||||
* <p>This can happen when the application fails to comply with the player's API requirements (for
|
||||
* example, by passing invalid arguments), or when the player reaches an invalid state.
|
||||
*/
|
||||
public static final int ERROR_CODE_FAILED_RUNTIME_CHECK = 1004;
|
||||
|
||||
// Input/Output errors (2xxx).
|
||||
|
||||
|
|
@ -217,6 +225,8 @@ public class PlaybackException extends Exception implements Bundleable {
|
|||
return "ERROR_CODE_BEHIND_LIVE_WINDOW";
|
||||
case ERROR_CODE_TIMEOUT:
|
||||
return "ERROR_CODE_TIMEOUT";
|
||||
case ERROR_CODE_FAILED_RUNTIME_CHECK:
|
||||
return "ERROR_CODE_FAILED_RUNTIME_CHECK";
|
||||
case ERROR_CODE_IO_UNSPECIFIED:
|
||||
return "ERROR_CODE_IO_UNSPECIFIED";
|
||||
case ERROR_CODE_IO_NETWORK_UNAVAILABLE:
|
||||
|
|
|
|||
|
|
@ -599,7 +599,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
} catch (IOException e) {
|
||||
handleIoException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);
|
||||
} catch (RuntimeException e) {
|
||||
ExoPlaybackException error = ExoPlaybackException.createForUnexpected(e);
|
||||
@ErrorCode int errorCode;
|
||||
if (e instanceof IllegalStateException || e instanceof IllegalArgumentException) {
|
||||
errorCode = PlaybackException.ERROR_CODE_FAILED_RUNTIME_CHECK;
|
||||
} else {
|
||||
errorCode = PlaybackException.ERROR_CODE_UNSPECIFIED;
|
||||
}
|
||||
ExoPlaybackException error = ExoPlaybackException.createForUnexpected(e, errorCode);
|
||||
Log.e(TAG, "Playback error", error);
|
||||
stopInternal(/* forceResetRenderers= */ true, /* acknowledgeStop= */ false);
|
||||
playbackInfo = playbackInfo.copyWithPlaybackError(error);
|
||||
|
|
|
|||
Loading…
Reference in a new issue