當前位置: 首頁>>代碼示例>>Java>>正文


Java MediaPlayer.MEDIA_ERROR_SERVER_DIED屬性代碼示例

本文整理匯總了Java中android.media.MediaPlayer.MEDIA_ERROR_SERVER_DIED屬性的典型用法代碼示例。如果您正苦於以下問題:Java MediaPlayer.MEDIA_ERROR_SERVER_DIED屬性的具體用法?Java MediaPlayer.MEDIA_ERROR_SERVER_DIED怎麽用?Java MediaPlayer.MEDIA_ERROR_SERVER_DIED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.media.MediaPlayer的用法示例。


在下文中一共展示了MediaPlayer.MEDIA_ERROR_SERVER_DIED屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onError

@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    //Invoked when there has been an error during an asynchronous operation
    switch (what) {
        case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
            Log.d("MediaPlayer Error", "MEDIA ERROR NOT VALID FOR PROGRESSIVE PLAYBACK " + extra);
            break;
        case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
            Log.d("MediaPlayer Error", "MEDIA ERROR SERVER DIED " + extra);
            break;
        case MediaPlayer.MEDIA_ERROR_UNKNOWN:
            Log.d("MediaPlayer Error", "MEDIA ERROR UNKNOWN " + extra);
            break;
    }
    return false;
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:16,代碼來源:AudioService.java

示例2: onError

@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    AppToast.showToast("播放失敗");
    Log.d(TAG, "播放失敗, " + what + ", " + extra);
    switch (what) {
        case MediaPlayer.MEDIA_ERROR_IO:
            Log.d(TAG, "MEDIA_ERROR_IO");
            break;
        case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
            Log.d(TAG, "MEDIA_ERROR_SERVER_DIED");
            break;
        case MediaPlayer.MEDIA_ERROR_UNKNOWN:
            Log.d(TAG, "MEDIA_ERROR_UNKNOWN");
            break;
        case MediaPlayer.MEDIA_ERROR_TIMED_OUT:
            Log.d(TAG, "MEDIA_ERROR_TIMED_OUT");
            break;
        default:
            break;
    }
    return true;
}
 
開發者ID:liying2008,項目名稱:Simpler,代碼行數:22,代碼來源:VideoPlayerActivity.java

示例3: onError

@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
	if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
		// we are finished, so put up an appropriate error toast if required
		// and finish
		activity.finish();
	} else {
		// possibly media player error, so release and recreate
		mp.release();
		mediaPlayer = null;
		updatePrefs();
	}
	return true;
}
 
開發者ID:TonnyL,項目名稱:Espresso,代碼行數:14,代碼來源:BeepManager.java

示例4: onError

@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
  if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
    // we are finished, so put up an appropriate error toast if required and finish
    activity.finish();
  } else {
    // possibly media player error, so release and recreate
    mp.release();
    mediaPlayer = null;
    updatePrefs();
  }
  return true;
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:13,代碼來源:BeepManager.java

示例5: onError

@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
    if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
        // we are finished, so put up an appropriate error toast if required
        // and finish
        activity.finish();
    } else {
        // possibly media player error, so release and recreate
        mp.release();
        mediaPlayer = null;
        updatePrefs();
    }
    return true;
}
 
開發者ID:CardInfoLink,項目名稱:QRScanner,代碼行數:14,代碼來源:BeepManager.java

示例6: onError

@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
  if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
    // we are finished, so put up an appropriate error toast if required and finish
    activity.finish();
  } else {
    // possibly media player error, so release and recreate
    close();
    updatePrefs();
  }
  return true;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:12,代碼來源:BeepManager.java

示例7: onError

@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
    if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
        // we are finished, so put up an appropriate error toast if required and finish
        activity.finish();
    } else {
        // possibly media player error, so release and recreate
        close();
        updatePrefs();
    }
    return true;
}
 
開發者ID:MRYangY,項目名稱:YZxing,代碼行數:12,代碼來源:BeepManager.java

示例8: 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

示例9: onError

@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
  Log.d("CameraActivity", "Error en media player");
  if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
    // we are finished, so put up an appropriate error toast if required and finish
    activity.finish();
  } else {
    // possibly media player error, so release and recreate
    //mp.release();
    close();
    createAllMedias();
  }
  return true;
}
 
開發者ID:crisfg86,項目名稱:Zxing-Custom,代碼行數:14,代碼來源:BeepManager.java


注:本文中的android.media.MediaPlayer.MEDIA_ERROR_SERVER_DIED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。