com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.DecoderInitializationException Java Examples

The following examples show how to use com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.DecoderInitializationException. 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: PlayerActivity.java    From leafpicrevived with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onPlayerError(ExoPlaybackException e) {
    String errorString = null;
    if (e.type == ExoPlaybackException.TYPE_RENDERER) {
        Exception cause = e.getRendererException();
        if (cause instanceof DecoderInitializationException) {
            // Special case for decoder initialization failures.
            DecoderInitializationException decoderInitializationException =
                    (DecoderInitializationException) cause;
            if (decoderInitializationException.decoderName == null)
                if (decoderInitializationException.getCause() instanceof DecoderQueryException)
                    errorString = getString(R.string.error_querying_decoders);
                else if (decoderInitializationException.secureDecoderRequired)
                    errorString = getString(R.string.error_no_secure_decoder, decoderInitializationException.mimeType);
                else
                    errorString = getString(R.string.error_no_decoder, decoderInitializationException.mimeType);
            else
                errorString = getString(R.string.error_instantiating_decoder, decoderInitializationException.decoderName);
        }
    }
    if (errorString != null)
        showToast(errorString);
    inErrorState = true;
    supportInvalidateOptionsMenu();
    showControls();
}
 
Example #2
Source File: MediaPlayerFragment.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onPlayerError(ExoPlaybackException e) {
	String errorString = null;
	if (e.type == ExoPlaybackException.TYPE_RENDERER) {
		Exception cause = e.getRendererException();
		if (cause instanceof DecoderInitializationException) {
			// Special case for decoder initialization failures.
			DecoderInitializationException decoderInitializationException =
				(DecoderInitializationException) cause;
			if (decoderInitializationException.decoderName == null) {
				if (decoderInitializationException.getCause() instanceof DecoderQueryException) {
					errorString = getString(R.string.error_querying_decoders);
				} else if (decoderInitializationException.secureDecoderRequired) {
					errorString = getString(R.string.error_no_secure_decoder,
											decoderInitializationException.mimeType);
				} else {
					errorString = getString(R.string.error_no_decoder,
											decoderInitializationException.mimeType);
				}
			} else {
				errorString = getString(R.string.error_instantiating_decoder,
										decoderInitializationException.decoderName);
			}
		}
	}
	if (errorString != null) {
		showToast(errorString);
	}
	needRetrySource = true;
	if (isBehindLiveWindow(e)) {
		clearResumePosition();
		initializePlayer();
	} else {
		updateResumePosition();
		updateButtonVisibilities();
		showControls();
	}
}
 
Example #3
Source File: PlayerActivity.java    From ExoPlayer-Offline with Apache License 2.0 5 votes vote down vote up
@Override
public void onPlayerError(ExoPlaybackException e) {
    String errorString = null;
    if (e.type == ExoPlaybackException.TYPE_RENDERER) {
        Exception cause = e.getRendererException();
        if (cause instanceof DecoderInitializationException) {
            // Special case for decoder initialization failures.
            DecoderInitializationException decoderInitializationException =
                    (DecoderInitializationException) cause;
            if (decoderInitializationException.decoderName == null) {
                if (decoderInitializationException.getCause() instanceof DecoderQueryException) {
                    errorString = getString(R.string.error_querying_decoders);
                } else if (decoderInitializationException.secureDecoderRequired) {
                    errorString = getString(R.string.error_no_secure_decoder,
                            decoderInitializationException.mimeType);
                } else {
                    errorString = getString(R.string.error_no_decoder,
                            decoderInitializationException.mimeType);
                }
            } else {
                errorString = getString(R.string.error_instantiating_decoder,
                        decoderInitializationException.decoderName);
            }
        }
    }
    if (errorString != null) {
        showToast(errorString);
    }
    playerNeedsSource = true;
    if (isBehindLiveWindow(e)) {
        clearResumePosition();
        initializePlayer();
    } else {
        updateResumePosition();
        updateButtonVisibilities();
        showControls();
    }
}
 
Example #4
Source File: LiveVideoPlayerActivity.java    From LiveVideoBroadcaster with Apache License 2.0 5 votes vote down vote up
@Override
public void onPlayerError(ExoPlaybackException e) {
  videoStartControlLayout.setVisibility(View.VISIBLE);
  String errorString = null;
  if (e.type == ExoPlaybackException.TYPE_RENDERER) {
    Exception cause = e.getRendererException();
    if (cause instanceof DecoderInitializationException) {
      // Special case for decoder initialization failures.
      DecoderInitializationException decoderInitializationException =
              (DecoderInitializationException) cause;
      if (decoderInitializationException.decoderName == null) {
        if (decoderInitializationException.getCause() instanceof DecoderQueryException) {
          errorString = getString(R.string.error_querying_decoders);
        } else if (decoderInitializationException.secureDecoderRequired) {
          errorString = getString(R.string.error_no_secure_decoder,
                  decoderInitializationException.mimeType);
        } else {
          errorString = getString(R.string.error_no_decoder,
                  decoderInitializationException.mimeType);
        }
      } else {
        errorString = getString(R.string.error_instantiating_decoder,
                decoderInitializationException.decoderName);
      }
    }
  }
  if (errorString != null) {
    showToast(errorString);
  }
  needRetrySource = true;
  if (isBehindLiveWindow(e)) {
    clearResumePosition();
    play(null);
  } else {
    updateResumePosition();
    showControls();
  }
}