List of usage examples for android.media MediaPlayer MEDIA_INFO_METADATA_UPDATE
int MEDIA_INFO_METADATA_UPDATE
To view the source code for android.media MediaPlayer MEDIA_INFO_METADATA_UPDATE.
Click Source Link
From source file:at.wada811.app.fragment.VideoFragment.java
private void initMediaPlayer() { LogUtils.i();/*from w ww .j ava2 s. co m*/ if (getArguments().keySet().contains(KEY_RES_ID)) { mMediaPlayer = MediaPlayer.create(getActivity(), getArguments().getInt(KEY_RES_ID)); } else { mMediaPlayer = new MediaPlayer(); } mMediaPlayer.setOnVideoSizeChangedListener(this); mMediaPlayer.setOnBufferingUpdateListener(this); mMediaPlayer.setOnPreparedListener(this); mMediaPlayer.setOnCompletionListener(this); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.setOnInfoListener(new OnInfoListener() { @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: LogUtils.i("MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING"); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: LogUtils.i("MediaPlayer.MEDIA_INFO_BUFFERING_END"); break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: LogUtils.i("MediaPlayer.MEDIA_INFO_BUFFERING_START"); break; case MediaPlayer.MEDIA_INFO_METADATA_UPDATE: LogUtils.i("MediaPlayer.MEDIA_INFO_METADATA_UPDATE"); break; case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE: LogUtils.i("MediaPlayer.MEDIA_INFO_NOT_SEEKABLE"); break; case MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT: LogUtils.i("MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT"); break; case MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE: LogUtils.i("MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE"); break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: LogUtils.i("MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START"); break; case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING: LogUtils.i("MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING"); break; case MediaPlayer.MEDIA_INFO_UNKNOWN: default: LogUtils.i("MediaPlayer.MEDIA_INFO_UNKNOWN"); break; } LogUtils.d("extra: " + extra); return false; } }); mMediaPlayer.setOnErrorListener(new OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_ERROR_SERVER_DIED: LogUtils.e("MediaPlayer.MEDIA_ERROR_SERVER_DIED"); break; case MediaPlayer.MEDIA_ERROR_UNKNOWN: default: LogUtils.e("MediaPlayer.MEDIA_ERROR_UNKNOWN"); break; } switch (extra) { case MediaPlayer.MEDIA_ERROR_IO: LogUtils.e("MediaPlayer.MEDIA_ERROR_IO"); break; case MediaPlayer.MEDIA_ERROR_MALFORMED: LogUtils.e("MediaPlayer.MEDIA_ERROR_MALFORMED"); break; case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: LogUtils.e("MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK"); break; case MediaPlayer.MEDIA_ERROR_TIMED_OUT: LogUtils.e("MediaPlayer.MEDIA_ERROR_TIMED_OUT"); break; case MediaPlayer.MEDIA_ERROR_UNSUPPORTED: LogUtils.e("MediaPlayer.MEDIA_ERROR_UNSUPPORTED"); break; default: LogUtils.e("extra: " + extra); break; } return false; } }); mCallback.onActivityCreated(this); }
From source file:org.y20k.transistor.PlayerService.java
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_INFO_UNKNOWN: Log.i(LOG_TAG, "Unknown media info"); break;//from ww w. j a v a 2 s. c om case MediaPlayer.MEDIA_INFO_BUFFERING_START: Log.i(LOG_TAG, "Buffering started"); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: Log.i(LOG_TAG, "Buffering finished"); break; case MediaPlayer.MEDIA_INFO_METADATA_UPDATE: Log.i(LOG_TAG, "New metadata available"); break; default: Log.i(LOG_TAG, "other case of media info"); break; } return true; }
From source file:com.halseyburgund.rwframework.core.RWService.java
/** * Creates a media player for sound playback, with initial volume of 0. *//*from ww w.jav a 2s . c om*/ private void createPlayer() { if (mPlayer == null) { mPlayer = new MediaPlayer(); mPlayer.setWakeMode(this, PowerManager.PARTIAL_WAKE_LOCK); float volume = (float) 0.0; mPlayer.setVolume(volume, volume); mVolumeLevel = 0; mPlayer.pause(); mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { if (D) { Log.d(TAG, "MediaPlayer prepared event"); } broadcast(RW.READY_TO_PLAY); if (mStartPlayingWhenReady) { playbackFadeIn(mVolumeLevel); } mAssetTracker.start(); } }); mPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() { @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { if (D) { Log.i(TAG, "MediaPlayer info event"); if (MediaPlayer.MEDIA_INFO_METADATA_UPDATE == what) { Log.i(TAG, "MediaPlayer metadata updated, extra = " + extra); } } return true; } }); mPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { if (D) { Log.d(TAG, "MediaPlayer error event"); } mAssetTracker.reset(); return true; } }); mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { if (D) { Log.d(TAG, "MediaPlayer completion event"); } mAssetTracker.stop(); mp.stop(); broadcast(RW.PLAYBACK_FINISHED); } }); mPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() { @Override public void onBufferingUpdate(MediaPlayer mp, int percent) { if (D) { Log.d(TAG, "MediaPlayer buffering event, %=" + percent); } } }); } }