Java Code Examples for android.media.MediaPlayer#MEDIA_INFO_VIDEO_RENDERING_START
The following examples show how to use
android.media.MediaPlayer#MEDIA_INFO_VIDEO_RENDERING_START .
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: JZVideoPlayer.java From JZVideoDemo with MIT License | 6 votes |
/** * exo没有这个方法 * 会直接调用onStatePlaybackBufferingStart()进入loading * * @param what * @param extra */ public void onInfo(int what, int extra) { Log.d(TAG, "onInfo what - " + what + " extra - " + extra); if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) { if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) return; BACKUP_PLAYING_BUFFERING_STATE = currentState; onStatePlaybackBufferingStart(); Log.d(TAG, "MEDIA_INFO_BUFFERING_START"); } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) { if (BACKUP_PLAYING_BUFFERING_STATE != -1) { if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) { setState(BACKUP_PLAYING_BUFFERING_STATE); } BACKUP_PLAYING_BUFFERING_STATE = -1; } Log.d(TAG, "MEDIA_INFO_BUFFERING_END"); } else if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { onVideoRendingStart(); } }
Example 2
Source File: VideoPlayActivity.java From TestChat with Apache License 2.0 | 6 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: // 音频和视频数据不正确 break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: if (!isFinishing()) mVideoView.pause(); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: if (!isFinishing()) mVideoView.start(); break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: if (DeviceUtils.hasJellyBean()) { mVideoView.setBackground(null); } else { mVideoView.setBackgroundDrawable(null); } break; } return false; }
Example 3
Source File: ImageDisplayActivity.java From TestChat with Apache License 2.0 | 6 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: // 音频和视频数据不正确 break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: if (!isFinishing()) mSurfaceVideoView.pause(); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: if (!isFinishing()) mSurfaceVideoView.start(); break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: if (DeviceUtils.hasJellyBean()) { mSurfaceVideoView.setBackground(null); } else { mSurfaceVideoView.setBackgroundDrawable(null); } break; } return false; }
Example 4
Source File: VideoPlayerActivity.java From VideoRecord with MIT License | 6 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: // 音频和视频数据不正确 break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: if (!isFinishing()) mVideoView.pause(); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: if (!isFinishing()) mVideoView.start(); break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: if (DeviceUtils.hasJellyBean()) { mVideoView.setBackground(null); } else { mVideoView.setBackgroundDrawable(null); } break; } return false; }
Example 5
Source File: ReactVideoView.java From react-native-video with MIT License | 6 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_INFO_BUFFERING_START: mEventEmitter.receiveEvent(getId(), Events.EVENT_STALLED.toString(), Arguments.createMap()); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: mEventEmitter.receiveEvent(getId(), Events.EVENT_RESUME.toString(), Arguments.createMap()); break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: mEventEmitter.receiveEvent(getId(), Events.EVENT_READY_FOR_DISPLAY.toString(), Arguments.createMap()); break; default: } return false; }
Example 6
Source File: Jzvd.java From imsdk-android with MIT License | 5 votes |
public void onInfo(int what, int extra) { Log.d(TAG, "onInfo what - " + what + " extra - " + extra); if(extra!=0){ setTextureViewRotation(extra); } if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { if (state == Jzvd.STATE_PREPARED || state == Jzvd.STATE_PREPARING_CHANGING_URL) { onStatePlaying();//真正的prepared,本质上这是进入playing状态。 } } }
Example 7
Source File: CustomVideoView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { // 播放器开始渲染 mCurrentState = STATE_PLAYING; stateChanged(mCurrentState); VenvyLog.d(TAG, "onInfo ——> MEDIA_INFO_VIDEO_RENDERING_START:STATE_PLAYING"); } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) { // MediaPlayer暂时不播放,以缓冲更多的数据 if (mCurrentState == STATE_PAUSED || mCurrentState == STATE_BUFFERING_PAUSED) { mCurrentState = STATE_BUFFERING_PAUSED; stateChanged(mCurrentState); VenvyLog.d(TAG, "onInfo ——> MEDIA_INFO_BUFFERING_START:STATE_BUFFERING_PAUSED"); } else { mCurrentState = STATE_BUFFERING_PLAYING; VenvyLog.d(TAG, "onInfo ——> MEDIA_INFO_BUFFERING_START:STATE_BUFFERING_PLAYING"); } } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) { // 填充缓冲区后,MediaPlayer恢复播放/暂停 if (mCurrentState == STATE_BUFFERING_PLAYING) { mCurrentState = STATE_PLAYING; stateChanged(mCurrentState); VenvyLog.d(TAG, "onInfo ——> MEDIA_INFO_BUFFERING_END: STATE_PLAYING"); } if (mCurrentState == STATE_BUFFERING_PAUSED) { mCurrentState = STATE_PAUSED; stateChanged(mCurrentState); VenvyLog.d(TAG, "onInfo ——> MEDIA_INFO_BUFFERING_END: STATE_PAUSED"); } } else if (what == MediaPlayer.MEDIA_INFO_NOT_SEEKABLE) { VenvyLog.d(TAG, "视频不能seekTo,为直播视频"); } else { VenvyLog.d(TAG, "onInfo ——> what:" + what); } return true; }
Example 8
Source File: VideoOutputActivity.java From SimpleVideoEdit with Apache License 2.0 | 5 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { int index = (playlistIndex) % mSVE.getAllInputClips().size(); ePlayerView.setGlFilter(FilterType.createGlFilter(mSVE.getAllInputClips().get(index).getClipfilter(),this)); return true; } return false; }
Example 9
Source File: DefaultVideoPlayer.java From NewFastFrame with Apache License 2.0 | 5 votes |
@Override public boolean onInfo(IMediaPlayer iMediaPlayer, int what, int extra) { if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { // 渲染开始 mState = PLAY_STATE_PLAYING; mVideoController.onPlayStateChanged(mState); } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) { // 缓存开始 if (mState == PLAY_STATE_PLAYING) { mState = PLAY_STATE_BUFFERING_PLAYING; } else if (mState == PLAY_STATE_PAUSE) { mState = PLAY_STATE_BUFFERING_PAUSE; } mVideoController.onPlayStateChanged(mState); } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) { // 缓存结束 if (mState == PLAY_STATE_BUFFERING_PAUSE) { mState = PLAY_STATE_PAUSE; } else if (mState == PLAY_STATE_BUFFERING_PLAYING) { mState = PLAY_STATE_PLAYING; } mVideoController.onPlayStateChanged(mState); } else if (what == IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED) { // 视频旋转了extra度,需要恢复 if (defaultTextureView != null) { defaultTextureView.setRotation(extra); CommonLogger.d("视频旋转角度:" + extra); } } else { CommonLogger.e("播放视频出错" + what + ":::" + extra); } return true; }
Example 10
Source File: PlaybackActivity.java From PLDroidShortVideo with Apache License 2.0 | 5 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { Log.i(TAG, "OnInfo, what = " + what + ", extra = " + extra); switch (what) { case MediaPlayer.MEDIA_INFO_UNKNOWN: break; case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING: break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: Log.i(TAG, "video rendering start, ts = " + extra); break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: Log.i(TAG, "onInfo: MediaPlayer.MEDIA_INFO_BUFFERING_START"); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: Log.i(TAG, "onInfo: MEDIA_INFO_BUFFERING_END"); break; case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: Log.i(TAG, "onInfo: MEDIA_INFO_BAD_INTERLEAVING"); break; case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE: Log.i(TAG, "onInfo: MEDIA_INFO_NOT_SEEKABLE"); break; case MediaPlayer.MEDIA_INFO_METADATA_UPDATE: Log.i(TAG, "onInfo: MediaPlayer.MEDIA_INFO_METADATA_UPDATE"); break; case MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE: Log.i(TAG, "onInfo: MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE"); break; case MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT: Log.i(TAG, "onInfo: MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT "); break; default: break; } return true; }
Example 11
Source File: PlaybackActivity.java From PLDroidShortVideo with Apache License 2.0 | 5 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { Log.i(TAG, "OnInfo, what = " + what + ", extra = " + extra); switch (what) { case MediaPlayer.MEDIA_INFO_UNKNOWN: break; case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING: break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: Log.i(TAG, "video rendering start, ts = " + extra); break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: Log.i(TAG, "onInfo: MediaPlayer.MEDIA_INFO_BUFFERING_START"); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: Log.i(TAG, "onInfo: MEDIA_INFO_BUFFERING_END"); break; case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: Log.i(TAG, "onInfo: MEDIA_INFO_BAD_INTERLEAVING"); break; case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE: Log.i(TAG, "onInfo: MEDIA_INFO_NOT_SEEKABLE"); break; case MediaPlayer.MEDIA_INFO_METADATA_UPDATE: Log.i(TAG, "onInfo: MediaPlayer.MEDIA_INFO_METADATA_UPDATE"); break; case MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE: Log.i(TAG, "onInfo: MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE"); break; case MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT: Log.i(TAG, "onInfo: MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT "); break; default: break; } return true; }
Example 12
Source File: VideoPlayerActivity.java From Simpler with Apache License 2.0 | 5 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { // 当一些特定信息出现或者警告时触发 Log.d(TAG, "INFO = " + what + "/" + extra); switch (what) { case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: Log.d(TAG, "MEDIA_INFO_BAD_INTERLEAVING"); break; case MediaPlayer.MEDIA_INFO_METADATA_UPDATE: Log.d(TAG, "MEDIA_INFO_METADATA_UPDATE"); break; case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING: Log.d(TAG, "MEDIA_INFO_VIDEO_TRACK_LAGGING"); break; case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE: Log.d(TAG, "MEDIA_INFO_NOT_SEEKABLE"); break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: Log.d(TAG, "MEDIA_INFO_BUFFERING_START"); if (mVideoView.isPlaying()) { mVideoView.pause(); mLoadingView.setVisibility(View.VISIBLE); } break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: Log.d(TAG, "MEDIA_INFO_BUFFERING_END"); mVideoView.start(); mLoadingView.setVisibility(View.GONE); break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: Log.d(TAG, "MEDIA_INFO_VIDEO_RENDERING_START"); mLoadingView.setVisibility(View.GONE); break; } return true; }
Example 13
Source File: VideoLoadTarget.java From VideoListPlayer with MIT License | 5 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) { mLoadMvpView.videoBeginning(); return true; } return false; }
Example 14
Source File: SysMediaPlayer.java From PlayerBase with Apache License 2.0 | 4 votes |
public boolean onInfo(MediaPlayer mp, int arg1, int arg2) { switch (arg1) { case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING: PLog.d(TAG, "MEDIA_INFO_VIDEO_TRACK_LAGGING:"); break; case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: PLog.d(TAG, "MEDIA_INFO_VIDEO_RENDERING_START"); startSeekPos = 0; submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_VIDEO_RENDER_START,null); break; case MediaPlayer.MEDIA_INFO_BUFFERING_START: PLog.d(TAG, "MEDIA_INFO_BUFFERING_START:" + arg2); Bundle bundle = BundlePool.obtain(); bundle.putLong(EventKey.LONG_DATA, mBandWidth); submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_BUFFERING_START,bundle); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: PLog.d(TAG, "MEDIA_INFO_BUFFERING_END:" + arg2); Bundle bundle1 = BundlePool.obtain(); bundle1.putLong(EventKey.LONG_DATA, mBandWidth); submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_BUFFERING_END,bundle1); break; case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: PLog.d(TAG, "MEDIA_INFO_BAD_INTERLEAVING:"); submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_BAD_INTERLEAVING,null); break; case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE: PLog.d(TAG, "MEDIA_INFO_NOT_SEEKABLE:"); submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_NOT_SEEK_ABLE,null); break; case MediaPlayer.MEDIA_INFO_METADATA_UPDATE: PLog.d(TAG, "MEDIA_INFO_METADATA_UPDATE:"); submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_METADATA_UPDATE,null); break; case MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE: PLog.d(TAG, "MEDIA_INFO_UNSUPPORTED_SUBTITLE:"); submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_UNSUPPORTED_SUBTITLE,null); break; case MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT: PLog.d(TAG, "MEDIA_INFO_SUBTITLE_TIMED_OUT:"); submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_SUBTITLE_TIMED_OUT,null); break; case MEDIA_INFO_NETWORK_BANDWIDTH: PLog.d(TAG,"band_width : " + arg2); mBandWidth = arg2 * 1000; break; } return true; }