tv.danmaku.ijk.media.player.IMediaPlayer Java Examples
The following examples show how to use
tv.danmaku.ijk.media.player.IMediaPlayer.
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: TextureRenderView.java From DanDanPlayForAndroid with MIT License | 6 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void bindToMediaPlayer(IMediaPlayer mp) { if (mp == null) return; if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder)) { ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp; mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false); SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture(); if (surfaceTexture != null) { mTextureView.setSurfaceTexture(surfaceTexture); } else { textureHolder.setSurfaceTexture(mSurfaceTexture); textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback); } } else { mp.setSurface(openSurface()); } }
Example #2
Source File: MediaPlayerCompat.java From AndroidTvDemo with Apache License 2.0 | 6 votes |
public static String getName(IMediaPlayer mp) { if (mp == null) { return "null"; } else if (mp instanceof TextureMediaPlayer) { StringBuilder sb = new StringBuilder("TextureMediaPlayer <"); IMediaPlayer internalMediaPlayer = ((TextureMediaPlayer) mp).getInternalMediaPlayer(); if (internalMediaPlayer == null) { sb.append("null>"); } else { sb.append(internalMediaPlayer.getClass().getSimpleName()); sb.append(">"); } return sb.toString(); } else { return mp.getClass().getSimpleName(); } }
Example #3
Source File: TextureRenderView.java From TvPlayer with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void bindToMediaPlayer(IMediaPlayer mp) { if (mp == null) return; if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder)) { ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp; mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false); SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture(); if (surfaceTexture != null) { mTextureView.setSurfaceTexture(surfaceTexture); } else { textureHolder.setSurfaceTexture(mSurfaceTexture); textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback); } } else { mp.setSurface(openSurface()); } }
Example #4
Source File: TextureRenderView.java From HeroVideo-master with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void bindToMediaPlayer(IMediaPlayer mp) { if (mp == null) return; if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder)) { ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp; mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false); SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture(); if (surfaceTexture != null) { mTextureView.setSurfaceTexture(surfaceTexture); } else { textureHolder.setSurfaceTexture(mSurfaceTexture); } } else { mp.setSurface(openSurface()); } }
Example #5
Source File: TextureRenderView.java From GiraffePlayer with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void bindToMediaPlayer(IMediaPlayer mp) { if (mp == null) return; if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder)) { ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp; mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false); SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture(); if (surfaceTexture != null) { mTextureView.setSurfaceTexture(surfaceTexture); } else { textureHolder.setSurfaceTexture(mSurfaceTexture); } } else { mp.setSurface(openSurface()); } }
Example #6
Source File: IjkVideoView.java From DMusic with Apache License 2.0 | 6 votes |
@Override public boolean onInfo(IMediaPlayer mp, int what, int extra) { // 当what为MEDIA_INFO_VIDEO_RENDERING_START时播放第一帧画面了 if (mActivity == null || mActivity.isFinishing()) { return false; } switch (what) { case IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED: videoRotationDegree = extra; ULog.d("MEDIA_INFO_VIDEO_ROTATION_CHANGED: " + extra); if (renderView != null) { renderView.setVideoRotation(extra); } break; // case IMediaPlayer.MEDIA_INFO_... } return listener == null || listener.onInfo(mp, what, extra); }
Example #7
Source File: MediaManager.java From DMusic with Apache License 2.0 | 6 votes |
@Override public void onPrepared(final IMediaPlayer mp) { currentState = STATE_PREPARED; // mSeekWhenPrepared may be changed after seekTo() call if (seekWhenPrepared != 0) { seekTo(seekWhenPrepared); } if (listener != null) { handler.post(new Runnable() { @Override public void run() { if (listener != null) listener.onPrepared(mp); } }); } }
Example #8
Source File: TextureRenderView.java From MKVideoPlayer with MIT License | 6 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void bindToMediaPlayer(IMediaPlayer mp) { if (mp == null) return; if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder)) { ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp; mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false); SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture(); if (surfaceTexture != null) { mTextureView.setSurfaceTexture(surfaceTexture); } else { textureHolder.setSurfaceTexture(mSurfaceTexture); } } else { mp.setSurface(openSurface()); } }
Example #9
Source File: TextureRenderView.java From HeroVideo-master with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void bindToMediaPlayer(IMediaPlayer mp) { if (mp == null) return; if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder)) { ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp; mTextureView.mSurfaceCallback.setOwnSurfaceTecture(false); SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture(); if (surfaceTexture != null) { mTextureView.setSurfaceTexture(surfaceTexture); } else { textureHolder.setSurfaceTexture(mSurfaceTexture); } } else { mp.setSurface(openSurface()); } }
Example #10
Source File: IjkVideoView.java From MD with Apache License 2.0 | 5 votes |
private void bindSurfaceHolder(IMediaPlayer mp, IRenderView.ISurfaceHolder holder) { if (mp == null) return; if (holder == null) { mp.setDisplay(null); return; } holder.bindToMediaPlayer(mp); }
Example #11
Source File: InfoHudViewHolder.java From MD with Apache License 2.0 | 5 votes |
public void setMediaPlayer(IMediaPlayer mp) { mMediaPlayer = mp; if (mMediaPlayer != null) { mHandler.sendEmptyMessageDelayed(MSG_UPDATE_HUD, 500); } else { mHandler.removeMessages(MSG_UPDATE_HUD); } }
Example #12
Source File: GSYVideoBaseManager.java From GSYVideoPlayer with Apache License 2.0 | 5 votes |
@Override public void onPrepared(IMediaPlayer mp) { mainThreadHandler.post(new Runnable() { @Override public void run() { cancelTimeOutBuffer(); if (listener() != null) { listener().onPrepared(); } } }); }
Example #13
Source File: JZMediaIjkplayer.java From JZVideoDemo with MIT License | 5 votes |
@Override public void onPrepared(IMediaPlayer iMediaPlayer) { ijkMediaPlayer.start(); if (currentDataSource.toString().toLowerCase().contains("mp3")) { JZMediaManager.instance().mainThreadHandler.post(new Runnable() { @Override public void run() { if (JZVideoPlayerManager.getCurrentJzvd() != null) { JZVideoPlayerManager.getCurrentJzvd().onPrepared(); } } }); } }
Example #14
Source File: SurfaceRenderView.java From HeroVideo-master with Apache License 2.0 | 5 votes |
public void bindToMediaPlayer(IMediaPlayer mp) { if (mp != null) { if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder)) { ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp; textureHolder.setSurfaceTexture(null); } mp.setDisplay(mSurfaceHolder); } }
Example #15
Source File: IjkVideoView.java From LivePlayback with Apache License 2.0 | 5 votes |
private void bindSurfaceHolder(IMediaPlayer mp, IRenderView.ISurfaceHolder holder) { if (mp == null) return; if (holder == null) { mp.setDisplay(null); return; } holder.bindToMediaPlayer(mp); }
Example #16
Source File: IjkVideoView.java From MVideo with Apache License 2.0 | 5 votes |
@Override public boolean onInfo(IMediaPlayer iMediaPlayer, int what, int extra) { if (what == IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED) { if (rotateDirectionValue != 1) { mRenderView.setVideoRotation(rotateDirectionValue); } else { mRenderView.setVideoRotation(extra); } } return false; }
Example #17
Source File: IjkVideoView.java From ShareBox with Apache License 2.0 | 5 votes |
public void onVideoSizeChanged(IMediaPlayer mp, int width, int height, int sarNum, int sarDen) { mVideoWidth = mp.getVideoWidth(); mVideoHeight = mp.getVideoHeight(); mVideoSarNum = mp.getVideoSarNum(); mVideoSarDen = mp.getVideoSarDen(); if (mVideoWidth != 0 && mVideoHeight != 0) { if (mRenderView != null) { mRenderView.setVideoSize(mVideoWidth, mVideoHeight); mRenderView.setVideoSampleAspectRatio(mVideoSarNum, mVideoSarDen); } // REMOVED: getHolder().setFixedSize(mVideoWidth, mVideoHeight); requestLayout(); } }
Example #18
Source File: MediaManager.java From DMusic with Apache License 2.0 | 5 votes |
@Override public void onCompletion(final IMediaPlayer mp) { currentState = STATE_PLAYBACK_COMPLETED; targetState = STATE_PLAYBACK_COMPLETED; if (listener != null) { handler.post(new Runnable() { @Override public void run() { if (listener != null) listener.onCompletion(mp); } }); } }
Example #19
Source File: IjkVideoView.java From AndroidTvDemo with Apache License 2.0 | 5 votes |
public void onCompletion(IMediaPlayer mp) { mCurrentState = STATE_PLAYBACK_COMPLETED; mTargetState = STATE_PLAYBACK_COMPLETED; if (mMediaController != null) { mMediaController.hide(); } if (mOnCompletionListener != null) { mOnCompletionListener.onCompletion(mMediaPlayer); } }
Example #20
Source File: IjkExoMediaPlayer.java From AndroidTvDemo with Apache License 2.0 | 5 votes |
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { mVideoWidth = width; mVideoHeight = height; notifyOnVideoSizeChanged(width, height, 1, 1); if (unappliedRotationDegrees > 0) notifyOnInfo(IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED, unappliedRotationDegrees); }
Example #21
Source File: InfoHudViewHolder.java From TvPlayer with Apache License 2.0 | 5 votes |
public void setMediaPlayer(IMediaPlayer mp) { mMediaPlayer = mp; if (mMediaPlayer != null) { mHandler.sendEmptyMessageDelayed(MSG_UPDATE_HUD, 500); } else { mHandler.removeMessages(MSG_UPDATE_HUD); } }
Example #22
Source File: SurfaceRenderView.java From DMusic with Apache License 2.0 | 5 votes |
public void bindToMediaPlayer(IMediaPlayer mp) { if (mp != null) { if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) && (mp instanceof ISurfaceTextureHolder)) { ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp; textureHolder.setSurfaceTexture(null); } mp.setDisplay(mSurfaceHolder); } }
Example #23
Source File: XLVideoPlayActivity.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
/** * 播放准备就绪 */ @Override public void onPrepared(IMediaPlayer iMediaPlayer) { duration = mVideoView.getDuration(); final GestureDetector gestureDetector = new GestureDetector(this, new PlayerGestureListener()); mRoot = findViewById(R.id.touch_area); mRoot.setClickable(true); mRoot.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (gestureDetector.onTouchEvent(motionEvent)) return true; // 处理手势结束 switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_UP: endGesture(); break; } return false; } }); start(); }
Example #24
Source File: MediaPlayerService.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public static void setMediaPlayer(IMediaPlayer mp) { if (sMediaPlayer != null && sMediaPlayer != mp) { if (sMediaPlayer.isPlaying()) sMediaPlayer.stop(); sMediaPlayer.release(); sMediaPlayer = null; } sMediaPlayer = mp; }
Example #25
Source File: IjkVideoView.java From MD with Apache License 2.0 | 5 votes |
public void onCompletion(IMediaPlayer mp) { mCurrentState = STATE_PLAYBACK_COMPLETED; mTargetState = STATE_PLAYBACK_COMPLETED; if (mMediaController != null) { mMediaController.hide(); } if (mOnCompletionListener != null) { mOnCompletionListener.onCompletion(mMediaPlayer); } }
Example #26
Source File: DefaultVideoPlayer.java From NewFastFrame with Apache License 2.0 | 5 votes |
@Override public void onCompletion(IMediaPlayer iMediaPlayer) { container.setKeepScreenOn(false); mState = PLAY_STATE_FINISH; // BaseApplication.getAppComponent().getSharedPreferences().edit().putBoolean(url, true).apply(); mVideoController.onPlayStateChanged(mState); }
Example #27
Source File: IjkWrapper.java From Fatigue-Detection with MIT License | 5 votes |
public void init(){ mStatus = STATUS_IDLE; mPlayer = new IjkMediaPlayer(); mPlayer.setOnPreparedListener(this); mPlayer.setOnInfoListener(new IMediaPlayer.OnInfoListener() { @Override public boolean onInfo(IMediaPlayer mp, int what, int extra) { return false; } }); }
Example #28
Source File: IjkVideoView.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
private void bindSurfaceHolder(IMediaPlayer mp, IRenderView.ISurfaceHolder holder) { if (mp == null) return; if (holder == null) { mp.setDisplay(null); return; } holder.bindToMediaPlayer(mp); }
Example #29
Source File: IjkVideoView.java From ShareBox with Apache License 2.0 | 4 votes |
public boolean onInfo(IMediaPlayer mp, int arg1, int arg2) { if (mOnInfoListener != null) { mOnInfoListener.onInfo(mp, arg1, arg2); } switch (arg1) { case IMediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING: Log.d(TAG, "MEDIA_INFO_VIDEO_TRACK_LAGGING:"); break; case IMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: Log.d(TAG, "MEDIA_INFO_VIDEO_RENDERING_START:"); break; case IMediaPlayer.MEDIA_INFO_BUFFERING_START: Log.d(TAG, "MEDIA_INFO_BUFFERING_START:"); break; case IMediaPlayer.MEDIA_INFO_BUFFERING_END: Log.d(TAG, "MEDIA_INFO_BUFFERING_END:"); break; case IMediaPlayer.MEDIA_INFO_NETWORK_BANDWIDTH: Log.d(TAG, "MEDIA_INFO_NETWORK_BANDWIDTH: " + arg2); break; case IMediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: Log.d(TAG, "MEDIA_INFO_BAD_INTERLEAVING:"); break; case IMediaPlayer.MEDIA_INFO_NOT_SEEKABLE: Log.d(TAG, "MEDIA_INFO_NOT_SEEKABLE:"); break; case IMediaPlayer.MEDIA_INFO_METADATA_UPDATE: Log.d(TAG, "MEDIA_INFO_METADATA_UPDATE:"); break; case IMediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE: Log.d(TAG, "MEDIA_INFO_UNSUPPORTED_SUBTITLE:"); break; case IMediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT: Log.d(TAG, "MEDIA_INFO_SUBTITLE_TIMED_OUT:"); break; case IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED: mVideoRotationDegree = arg2; Log.d(TAG, "MEDIA_INFO_VIDEO_ROTATION_CHANGED: " + arg2); if (mRenderView != null) mRenderView.setVideoRotation(arg2); break; case IMediaPlayer.MEDIA_INFO_AUDIO_RENDERING_START: Log.d(TAG, "MEDIA_INFO_AUDIO_RENDERING_START:"); break; } return true; }
Example #30
Source File: IjkVideoView.java From talk-android with MIT License | 4 votes |
public boolean onInfo(IMediaPlayer mp, int arg1, int arg2) { if (mOnInfoListener != null) { mOnInfoListener.onInfo(mp, arg1, arg2); } return true; }