List of usage examples for android.media MediaPlayer MEDIA_ERROR_SERVER_DIED
int MEDIA_ERROR_SERVER_DIED
To view the source code for android.media MediaPlayer MEDIA_ERROR_SERVER_DIED.
Click Source Link
From source file:leoisasmendi.android.com.suricatepodcast.services.MediaPlayerService.java
@Override public boolean onError(MediaPlayer mp, int what, int extra) { //Invoked when there has been an error during an asynchronous operation Log.d(TAG, "onError: " + R.string.media_player_error_2); switch (what) { case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: Log.d("MediaPlayer Error", "MEDIA ERROR NOT VALID FOR PROGRESSIVE PLAYBACK " + extra); break;// w w w .j a v a 2 s.co m 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; }
From source file:com.repkap11.repcast.activities.LocalPlayerActivity.java
private void setupControlsCallbacks() { mVideoView.setOnErrorListener(new OnErrorListener() { @Override// w ww. j ava2 s.c o m public boolean onError(MediaPlayer mp, int what, int extra) { Log.e(TAG, "OnErrorListener.onError(): VideoView encountered an " + "error, what: " + what + ", extra: " + extra); String msg; if (extra == MediaPlayer.MEDIA_ERROR_TIMED_OUT) { msg = getString(R.string.video_error_media_load_timeout); } else if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) { msg = getString(R.string.video_error_server_unaccessible); } else { msg = getString(R.string.video_error_unknown_error); } Utils.showErrorDialog(LocalPlayerActivity.this, msg); mVideoView.stopPlayback(); mPlaybackState = PlaybackState.IDLE; updatePlayButton(mPlaybackState); return true; } }); mVideoView.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { Log.d(TAG, "onPrepared is reached"); mDuration = mp.getDuration(); mEndText.setText( com.google.android.libraries.cast.companionlibrary.utils.Utils.formatMillis(mDuration)); mSeekbar.setMax(mDuration); restartTrickplayTimer(); } }); mVideoView.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { stopTrickplayTimer(); Log.d(TAG, "setOnCompletionListener()"); mPlaybackState = PlaybackState.IDLE; updatePlayButton(mPlaybackState); } }); mVideoView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (!mControllersVisible) { updateControllersVisibility(!mControllersVisible); } startControllersTimer(); return false; } }); mSeekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { if (mPlaybackState == PlaybackState.PLAYING) { play(seekBar.getProgress()); } else if (mPlaybackState != PlaybackState.IDLE) { mVideoView.seekTo(seekBar.getProgress()); } startControllersTimer(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { stopTrickplayTimer(); mVideoView.pause(); stopControllersTimer(); } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mStartText.setText( com.google.android.libraries.cast.companionlibrary.utils.Utils.formatMillis(progress)); } }); mPlayPause.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLocation == PlaybackLocation.LOCAL) { togglePlayback(); } } }); }