Java Code Examples for android.media.MediaPlayer#MEDIA_ERROR_UNSUPPORTED
The following examples show how to use
android.media.MediaPlayer#MEDIA_ERROR_UNSUPPORTED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParsingPlayerProxy.java From ParsingPlayer with GNU Lesser General Public License v2.1 | 6 votes |
private String errToStr(int framework_err, int impl_err) { String msg = null; if (framework_err == MediaPlayer.MEDIA_ERROR_IO) { msg = "IO Error"; } else if (framework_err == MediaPlayer.MEDIA_ERROR_MALFORMED) { msg = "Bitstream unsupported"; } else if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) { msg = "Invalid progressive playback"; } else if (framework_err == MediaPlayer.MEDIA_ERROR_TIMED_OUT) { msg = "Operation time out"; } else if (framework_err == MediaPlayer.MEDIA_ERROR_SERVER_DIED) { msg = "MediaPlayer died"; } else if (framework_err == MediaPlayer.MEDIA_ERROR_UNSUPPORTED) { msg = "File spec is not supported in the media framework"; } else if (framework_err == MediaPlayer.MEDIA_ERROR_UNKNOWN) { msg = "Unknown error"; } return msg; }
Example 2
Source File: PlaybackActivity.java From PLDroidShortVideo with Apache License 2.0 | 5 votes |
@Override public boolean onError(MediaPlayer mp, int what, int extra) { Log.e(TAG, "Error happened, errorCode = " + extra); final String errorTip; switch (extra) { case MediaPlayer.MEDIA_ERROR_IO: /** * SDK will do reconnecting automatically */ Log.e(TAG, "IO Error!"); return false; case MediaPlayer.MEDIA_ERROR_MALFORMED: errorTip = "Malformed bitstream!"; break; case MediaPlayer.MEDIA_ERROR_UNSUPPORTED: errorTip = "Unsupported bitstream!"; break; case MediaPlayer.MEDIA_ERROR_TIMED_OUT: errorTip = "Timeout!"; break; default: errorTip = "unknown error !"; break; } if (errorTip != null) { runOnUiThread(new Runnable() { @Override public void run() { ToastUtils.s(PlaybackActivity.this, errorTip); } }); } finish(); return true; }
Example 3
Source File: PlaybackActivity.java From PLDroidShortVideo with Apache License 2.0 | 5 votes |
@Override public boolean onError(MediaPlayer mp, int what, int extra) { Log.e(TAG, "Error happened, errorCode = " + extra); final String errorTip; switch (extra) { case MediaPlayer.MEDIA_ERROR_IO: /** * SDK will do reconnecting automatically */ Log.e(TAG, "IO Error!"); return false; case MediaPlayer.MEDIA_ERROR_MALFORMED: errorTip = "Malformed bitstream!"; break; case MediaPlayer.MEDIA_ERROR_UNSUPPORTED: errorTip = "Unsupported bitstream!"; break; case MediaPlayer.MEDIA_ERROR_TIMED_OUT: errorTip = "Timeout!"; break; default: errorTip = "unknown error !"; break; } if (errorTip != null) { runOnUiThread(new Runnable() { @Override public void run() { ToastUtils.s(PlaybackActivity.this, errorTip); } }); } finish(); return true; }
Example 4
Source File: SysMediaPlayer.java From PlayerBase with Apache License 2.0 | 5 votes |
public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { PLog.d(TAG, "Error: " + framework_err + "," + impl_err); updateStatus(STATE_ERROR); mTargetState = STATE_ERROR; int eventCode = OnErrorEventListener.ERROR_EVENT_COMMON; switch (framework_err){ case MediaPlayer.MEDIA_ERROR_IO: eventCode = OnErrorEventListener.ERROR_EVENT_IO; break; case MediaPlayer.MEDIA_ERROR_MALFORMED: eventCode = OnErrorEventListener.ERROR_EVENT_MALFORMED; break; case MediaPlayer.MEDIA_ERROR_TIMED_OUT: eventCode = OnErrorEventListener.ERROR_EVENT_TIMED_OUT; break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: eventCode = OnErrorEventListener.ERROR_EVENT_UNKNOWN; break; case MediaPlayer.MEDIA_ERROR_UNSUPPORTED: eventCode = OnErrorEventListener.ERROR_EVENT_UNSUPPORTED; break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: eventCode = OnErrorEventListener.ERROR_EVENT_SERVER_DIED; break; case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: eventCode = OnErrorEventListener.ERROR_EVENT_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK; break; } /* If an error handler has been supplied, use it and finish. */ Bundle bundle = BundlePool.obtain(); submitErrorEvent(eventCode,bundle); return true; }
Example 5
Source File: SystemImplMediaPlayer.java From android-jungle-mediaplayer with Apache License 2.0 | 5 votes |
public boolean onError(MediaPlayer player, int what, int extra) { String errorWhat; switch (what) { case MediaPlayer.MEDIA_ERROR_UNKNOWN: errorWhat = "MEDIA_ERROR_UNKNOWN"; break; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: errorWhat = "MEDIA_ERROR_SERVER_DIED"; break; default: errorWhat = "!"; } String errorExtra; switch (extra) { case MediaPlayer.MEDIA_ERROR_UNSUPPORTED: errorExtra = "MEDIA_ERROR_UNSUPPORTED"; break; case MediaPlayer.MEDIA_ERROR_MALFORMED: errorExtra = "MEDIA_ERROR_MALFORMED"; break; case MediaPlayer.MEDIA_ERROR_IO: errorExtra = "MEDIA_ERROR_IO"; break; case MediaPlayer.MEDIA_ERROR_TIMED_OUT: errorExtra = "MEDIA_ERROR_TIMED_OUT"; break; default: errorExtra = "!"; } String msg = String.format("what = %d (%s), extra = %d (%s)", what, errorWhat, extra, errorExtra); Log.e(TAG, msg); notifyError(what, msg); return true; }
Example 6
Source File: MediaPlayerImpl.java From dcs-sdk-java with Apache License 2.0 | 4 votes |
@Override public boolean onError(MediaPlayer mp, int what, int extra) { LogUtil.d(TAG, "onError:" + what + ", extra:" + extra); if (what == -38) { isError38 = true; return false; } posHandler.removeMessages(MSG_UPDATE_PROGRESS); isError38 = false; mCurrentState = IMediaPlayer.PlayState.ERROR; JSONObject jsonObject = new JSONObject(); try { jsonObject.put("msg", "what: " + what + "; extra:" + extra); } catch (JSONException e) { e.printStackTrace(); } IMediaPlayer.ErrorType errorType; switch (what) { case MediaPlayer.MEDIA_ERROR_IO: // Stream服务端返回错误 (bad request, unauthorized, forbidden, not found etc) errorType = IMediaPlayer.ErrorType.MEDIA_ERROR_INVALID_REQUEST; break; case MediaPlayer.MEDIA_ERROR_TIMED_OUT: // 端无法连接stream服务端 errorType = IMediaPlayer.ErrorType.MEDIA_ERROR_SERVICE_UNAVAILABLE; break; case MediaPlayer.MEDIA_ERROR_UNSUPPORTED: // 端内部错误 errorType = IMediaPlayer.ErrorType.MEDIA_ERROR_INTERNAL_DEVICE_ERROR; break; case MediaPlayer.MEDIA_ERROR_MALFORMED: // stream服务端接受请求,但未能正确处理 ????? errorType = IMediaPlayer.ErrorType.MEDIA_ERROR_INTERNAL_SERVER_ERROR; break; default: // 未知错误 errorType = IMediaPlayer.ErrorType.MEDIA_ERROR_UNKNOWN; break; } fireOnError(jsonObject.toString(), errorType); return false; }
Example 7
Source File: MediaService.java From Cirrus_depricated with GNU General Public License v2.0 | 4 votes |
/** * Helper method to get an error message suitable to show to users for errors occurred in media playback, * * @param context A context to access string resources. * @param what See {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int) * @param extra See {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int) * @return Message suitable to users. */ public static String getMessageForMediaError(Context context, int what, int extra) { int messageId; if (what == OC_MEDIA_ERROR) { messageId = extra; } else if (extra == MediaPlayer.MEDIA_ERROR_UNSUPPORTED) { /* Added in API level 17 Bitstream is conforming to the related coding standard or file spec, but the media framework does not support the feature. Constant Value: -1010 (0xfffffc0e) */ messageId = R.string.media_err_unsupported; } else if (extra == MediaPlayer.MEDIA_ERROR_IO) { /* Added in API level 17 File or network related operation errors. Constant Value: -1004 (0xfffffc14) */ messageId = R.string.media_err_io; } else if (extra == MediaPlayer.MEDIA_ERROR_MALFORMED) { /* Added in API level 17 Bitstream is not conforming to the related coding standard or file spec. Constant Value: -1007 (0xfffffc11) */ messageId = R.string.media_err_malformed; } else if (extra == MediaPlayer.MEDIA_ERROR_TIMED_OUT) { /* Added in API level 17 Some operation takes too long to complete, usually more than 3-5 seconds. Constant Value: -110 (0xffffff92) */ messageId = R.string.media_err_timeout; } else if (what == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) { /* Added in API level 3 The video is streamed and its container is not valid for progressive playback i.e the video's index (e.g moov atom) is not at the start of the file. Constant Value: 200 (0x000000c8) */ messageId = R.string.media_err_invalid_progressive_playback; } else { /* MediaPlayer.MEDIA_ERROR_UNKNOWN Added in API level 1 Unspecified media player error. Constant Value: 1 (0x00000001) */ /* MediaPlayer.MEDIA_ERROR_SERVER_DIED) Added in API level 1 Media server died. In this case, the application must release the MediaPlayer object and instantiate a new one. Constant Value: 100 (0x00000064) */ messageId = R.string.media_err_unknown; } return context.getString(messageId); }