Added ExoPlayer error messages
This commit is contained in:
parent
930642cb36
commit
2b22f116cd
|
@ -39,6 +39,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
public class ExoPlayerWrapper implements IPlayer {
|
||||
private static final String TAG = "ExoPlayerWrapper";
|
||||
public static final int ERROR_CODE_OFFSET = 1000;
|
||||
private final Context mContext;
|
||||
private final Disposable bufferingUpdateDisposable;
|
||||
private SimpleExoPlayer mExoPlayer;
|
||||
|
@ -109,7 +110,7 @@ public class ExoPlayerWrapper implements IPlayer {
|
|||
@Override
|
||||
public void onPlayerError(ExoPlaybackException error) {
|
||||
if (audioErrorListener != null) {
|
||||
audioErrorListener.onError(null, 0, 0);
|
||||
audioErrorListener.onError(null, error.type + ERROR_CODE_OFFSET, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@ package de.danoeh.antennapod.core.util.playback;
|
|||
|
||||
import android.content.Context;
|
||||
import android.media.MediaPlayer;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.service.playback.ExoPlayerWrapper;
|
||||
|
||||
/** Utility class for MediaPlayer errors. */
|
||||
public class MediaPlayerError {
|
||||
|
@ -12,16 +13,20 @@ public class MediaPlayerError {
|
|||
/** Get a human-readable string for a specific error code. */
|
||||
public static String getErrorString(Context context, int code) {
|
||||
int resId;
|
||||
switch(code) {
|
||||
switch (code) {
|
||||
case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
|
||||
resId = R.string.playback_error_server_died;
|
||||
break;
|
||||
case MediaPlayer.MEDIA_ERROR_UNSUPPORTED:
|
||||
case MediaPlayer.MEDIA_ERROR_UNSUPPORTED: // fall-through
|
||||
case ExoPlayerWrapper.ERROR_CODE_OFFSET + ExoPlaybackException.TYPE_RENDERER:
|
||||
resId = R.string.playback_error_unsupported;
|
||||
break;
|
||||
case MediaPlayer.MEDIA_ERROR_TIMED_OUT:
|
||||
resId = R.string.playback_error_timeout;
|
||||
break;
|
||||
case ExoPlayerWrapper.ERROR_CODE_OFFSET + ExoPlaybackException.TYPE_SOURCE:
|
||||
resId = R.string.playback_error_source;
|
||||
break;
|
||||
default:
|
||||
resId = R.string.playback_error_unknown;
|
||||
break;
|
||||
|
|
|
@ -283,6 +283,7 @@
|
|||
<string name="playback_error_server_died">Server died</string>
|
||||
<string name="playback_error_unsupported">Unsupported media type</string>
|
||||
<string name="playback_error_timeout">Operation timed out</string>
|
||||
<string name="playback_error_source">Unable to access media file</string>
|
||||
<string name="playback_error_unknown">Unknown Error</string>
|
||||
<string name="no_media_playing_label">No media playing</string>
|
||||
<string name="position_default_label" translate="false">00:00:00</string>
|
||||
|
|
Loading…
Reference in New Issue