use of com.codename1.media.AsyncMedia.MediaErrorType in project CodenameOne by codenameone.
the class AndroidImplementation method createMediaException.
public static MediaException createMediaException(int extra) {
MediaErrorType type;
String message;
switch(extra) {
case MediaPlayer.MEDIA_ERROR_IO:
type = MediaErrorType.Network;
message = "IO error";
break;
case MediaPlayer.MEDIA_ERROR_MALFORMED:
type = MediaErrorType.Decode;
message = "Media was malformed";
break;
case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
type = MediaErrorType.SrcNotSupported;
message = "Not valie for progressive playback";
break;
case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
type = MediaErrorType.Network;
message = "Server died";
break;
case MediaPlayer.MEDIA_ERROR_TIMED_OUT:
type = MediaErrorType.Network;
message = "Timed out";
break;
case MediaPlayer.MEDIA_ERROR_UNKNOWN:
type = MediaErrorType.Network;
message = "Unknown error";
break;
case MediaPlayer.MEDIA_ERROR_UNSUPPORTED:
type = MediaErrorType.SrcNotSupported;
message = "Unsupported media";
break;
default:
type = MediaErrorType.Network;
message = "Unknown error";
}
return new MediaException(type, message);
}
Aggregations