当前位置: 首页>>代码示例>>Java>>正文


Java MediaPlayer.MEDIA_ERROR_UNSUPPORTED属性代码示例

本文整理汇总了Java中android.media.MediaPlayer.MEDIA_ERROR_UNSUPPORTED属性的典型用法代码示例。如果您正苦于以下问题:Java MediaPlayer.MEDIA_ERROR_UNSUPPORTED属性的具体用法?Java MediaPlayer.MEDIA_ERROR_UNSUPPORTED怎么用?Java MediaPlayer.MEDIA_ERROR_UNSUPPORTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.media.MediaPlayer的用法示例。


在下文中一共展示了MediaPlayer.MEDIA_ERROR_UNSUPPORTED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: errToStr

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;
}
 
开发者ID:TedaLIEz,项目名称:ParsingPlayer,代码行数:19,代码来源:ParsingPlayerProxy.java

示例2: onError

@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;
}
 
开发者ID:dueros,项目名称:dcs-sdk-java,代码行数:42,代码来源:MediaPlayerImpl.java

示例3: onError

@Override
public boolean onError(MediaPlayer mp, int what, int extra) {

    switch (what) {
        case MediaPlayer.MEDIA_ERROR_UNKNOWN:
            LogHelper.e(LOG_TAG, "Unknown media playback error");
            break;
        case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
            LogHelper.e(LOG_TAG, "Connection to server lost");
            break;
        default:
            LogHelper.e(LOG_TAG, "Generic audio playback error");
            break;
    }

    switch (extra) {
        case MediaPlayer.MEDIA_ERROR_IO:
            LogHelper.e(LOG_TAG, "IO media error.");
            break;
        case MediaPlayer.MEDIA_ERROR_MALFORMED:
            LogHelper.e(LOG_TAG, "Malformed media.");
            break;
        case MediaPlayer.MEDIA_ERROR_UNSUPPORTED:
            LogHelper.e(LOG_TAG, "Unsupported content type");
            break;
        case MediaPlayer.MEDIA_ERROR_TIMED_OUT:
            LogHelper.e(LOG_TAG, "Media timeout");
            break;
        default:
            LogHelper.e(LOG_TAG, "Other case of media playback error");
            break;
    }

    // stop playback
    stopPlayback(false);

    // try to reconnect to stream - limited to ten attempts
    if (mReconnectCounter < 10) {
        mReconnectCounter++;
        LogHelper.e(LOG_TAG, "Trying to reconnect after media playback error - attempt #" + mReconnectCounter + ".");
        startPlayback();
    }

    return true;
}
 
开发者ID:malah-code,项目名称:Open-Quran-Radio,代码行数:45,代码来源:PlayerService.java


注:本文中的android.media.MediaPlayer.MEDIA_ERROR_UNSUPPORTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。