本文整理汇总了Java中com.pili.pldroid.player.PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED属性的典型用法代码示例。如果您正苦于以下问题:Java PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED属性的具体用法?Java PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED怎么用?Java PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.pili.pldroid.player.PLMediaPlayer
的用法示例。
在下文中一共展示了PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onError
@Override
public boolean onError(PLMediaPlayer mp, int errorCode) {
switch (errorCode) {
case PLMediaPlayer.ERROR_CODE_INVALID_URI:
showToastTips("Invalid URL !");
break;
case PLMediaPlayer.ERROR_CODE_404_NOT_FOUND:
showToastTips("404 resource not found !");
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED:
showToastTips("Connection refused !");
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_TIMEOUT:
showToastTips("Connection timeout !");
break;
case PLMediaPlayer.ERROR_CODE_EMPTY_PLAYLIST:
showToastTips("Empty playlist !");
break;
case PLMediaPlayer.ERROR_CODE_STREAM_DISCONNECTED:
showToastTips("Stream disconnected !");
break;
case PLMediaPlayer.ERROR_CODE_IO_ERROR:
showToastTips("Network IO Error !");
break;
case PLMediaPlayer.MEDIA_ERROR_UNKNOWN:
default:
showToastTips("unknown error !");
break;
}
// Todo pls handle the error status here, retry or call finish()
finish();
// If you want to retry, do like this:
// mVideoView.setVideoPath(mVideoPath);
// mVideoView.start();
// Return true means the error has been handled
// If return false, then `onCompletion` will be called
return true;
}
示例2: getErrorMessage
private static String getErrorMessage(int code) {
String msg;
switch (code) {
case PLMediaPlayer.ERROR_CODE_INVALID_URI:
msg = "Invalid URL !";
break;
case PLMediaPlayer.ERROR_CODE_404_NOT_FOUND:
msg = "404 resource not found !";
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED:
msg = "Connection refused !";
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_TIMEOUT:
msg = "Connection timeout !";
break;
case PLMediaPlayer.ERROR_CODE_EMPTY_PLAYLIST:
msg = "Empty playlist !";
break;
case PLMediaPlayer.ERROR_CODE_STREAM_DISCONNECTED:
msg = "Stream disconnected !";
break;
case PLMediaPlayer.ERROR_CODE_IO_ERROR:
msg = "Network IO Error !";
break;
case PLMediaPlayer.ERROR_CODE_UNAUTHORIZED:
msg = "Unauthorized Error !";
break;
case PLMediaPlayer.ERROR_CODE_PREPARE_TIMEOUT:
msg = "Prepare timeout !";
break;
case PLMediaPlayer.ERROR_CODE_READ_FRAME_TIMEOUT:
msg = "Read frame timeout !";
break;
case PLMediaPlayer.MEDIA_ERROR_UNKNOWN:
default:
msg = "unknown error !";
break;
}
return msg;
}
示例3: onError
@Override
public boolean onError(PLMediaPlayer mp, int errorCode) {
boolean isNeedReconnect = false;
Log.e(TAG, "Error happened, errorCode = " + errorCode);
switch (errorCode) {
case PLMediaPlayer.ERROR_CODE_INVALID_URI:
showToastTips("Invalid URL !");
break;
case PLMediaPlayer.ERROR_CODE_404_NOT_FOUND:
showToastTips("404 resource not found !");
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED:
showToastTips("Connection refused !");
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_TIMEOUT:
showToastTips("Connection timeout !");
isNeedReconnect = true;
break;
case PLMediaPlayer.ERROR_CODE_EMPTY_PLAYLIST:
showToastTips("Empty playlist !");
break;
case PLMediaPlayer.ERROR_CODE_STREAM_DISCONNECTED:
showToastTips("Stream disconnected !");
isNeedReconnect = true;
break;
case PLMediaPlayer.ERROR_CODE_IO_ERROR:
showToastTips("Network IO Error !");
isNeedReconnect = true;
break;
case PLMediaPlayer.ERROR_CODE_UNAUTHORIZED:
showToastTips("Unauthorized Error !");
break;
case PLMediaPlayer.ERROR_CODE_PREPARE_TIMEOUT:
showToastTips("Prepare timeout !");
isNeedReconnect = true;
break;
case PLMediaPlayer.ERROR_CODE_READ_FRAME_TIMEOUT:
showToastTips("Read frame timeout !");
isNeedReconnect = true;
break;
case PLMediaPlayer.MEDIA_ERROR_UNKNOWN:
break;
default:
showToastTips("unknown error !");
break;
}
// Todo pls handle the error status here, reconnect or call finish()
release();
if (isNeedReconnect) {
mActivity.onReConnecting();
prepare();
} else {
mActivity.finish();
}
// Return true means the error has been handled
// If return false, then `onCompletion` will be called
return true;
}
示例4: onError
@Override
public boolean onError(PLMediaPlayer plMediaPlayer, int errorCode) {
boolean isNeedReconnect = false;
Log.e(TAG, "Error happened, errorCode = " + errorCode);
switch (errorCode) {
case PLMediaPlayer.ERROR_CODE_INVALID_URI:
showToastTips("Invalid URL !");
break;
case PLMediaPlayer.ERROR_CODE_404_NOT_FOUND:
showToastTips("404 resource not found !");
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED:
showToastTips("Connection refused !");
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_TIMEOUT:
showToastTips("Connection timeout !");
isNeedReconnect = true;
break;
case PLMediaPlayer.ERROR_CODE_EMPTY_PLAYLIST:
showToastTips("Empty playlist !");
break;
case PLMediaPlayer.ERROR_CODE_STREAM_DISCONNECTED:
showToastTips("Stream disconnected !");
isNeedReconnect = true;
break;
case PLMediaPlayer.ERROR_CODE_IO_ERROR:
showToastTips("Network IO Error !");
isNeedReconnect = true;
break;
case PLMediaPlayer.ERROR_CODE_UNAUTHORIZED:
showToastTips("Unauthorized Error !");
break;
case PLMediaPlayer.ERROR_CODE_PREPARE_TIMEOUT:
showToastTips("Prepare timeout !");
isNeedReconnect = true;
break;
case PLMediaPlayer.ERROR_CODE_READ_FRAME_TIMEOUT:
showToastTips("Read frame timeout !");
isNeedReconnect = true;
break;
case PLMediaPlayer.MEDIA_ERROR_UNKNOWN:
break;
default:
showToastTips("unknown error !");
break;
}
// Todo pls handle the error status here, reconnect or call finish()
if (isNeedReconnect) {
sendReconnectMessage();
} else {
finish();
}
// Return true means the error has been handled
// If return false, then `onCompletion` will be called
return true;
}
示例5: onError
@Override
public boolean onError(PLMediaPlayer mp, int errorCode) {
Log.e(TAG, "Error happened, errorCode = " + errorCode);
switch (errorCode) {
case PLMediaPlayer.ERROR_CODE_INVALID_URI:
showToastTips("Invalid URL !");
break;
case PLMediaPlayer.ERROR_CODE_404_NOT_FOUND:
showToastTips("404 resource not found !");
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED:
showToastTips("Connection refused !");
break;
case PLMediaPlayer.ERROR_CODE_CONNECTION_TIMEOUT:
showToastTips("Connection timeout !");
break;
case PLMediaPlayer.ERROR_CODE_EMPTY_PLAYLIST:
showToastTips("Empty playlist !");
break;
case PLMediaPlayer.ERROR_CODE_STREAM_DISCONNECTED:
showToastTips("Stream disconnected !");
break;
case PLMediaPlayer.ERROR_CODE_IO_ERROR:
showToastTips("Network IO Error !");
break;
case PLMediaPlayer.MEDIA_ERROR_UNKNOWN:
default:
showToastTips("unknown error !");
break;
}
// Todo pls handle the error status here, retry or call finish()
finish();
// The PLMediaPlayer has moved to the Error state, if you want to retry, must reset first !
// try {
// mMediaPlayer.reset();
// mMediaPlayer.setDisplay(mSurfaceView.getHolder());
// mMediaPlayer.setDataSource(mVideoPath);
// mMediaPlayer.prepareAsync();
// } catch (IOException e) {
// e.printStackTrace();
// }
// Return true means the error has been handled
// If return false, then `onCompletion` will be called
return true;
}