Java Code Examples for tv.danmaku.ijk.media.player.IMediaPlayer#getVideoHeight()

The following examples show how to use tv.danmaku.ijk.media.player.IMediaPlayer#getVideoHeight() . 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: ParsingPlayerProxy.java    From ParsingPlayer with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void onPrepared(IMediaPlayer mp) {
    LogUtil.i(TAG, "Proxy onPrepared");
    mCurrentState = STATE_PLAYING;
    mVideoWidth = mp.getVideoWidth();
    mVideoHeight = mp.getVideoHeight();
    int seekToPos = mSeekWhenPrepared;
    if (seekToPos != 0) {
        seekTo(seekToPos);
    }
    if (mVideoHeight != 0 && mVideoWidth != 0) {
        if (mStateListener != null)
            mStateListener.onPrepared(mVideoWidth,
                    mVideoHeight, mVideoSarNum, mVideoSarDen);
    }
}
 
Example 2
Source File: GSYVideoBaseManager.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onVideoSizeChanged(IMediaPlayer mp, int width, int height, int sar_num, int sar_den) {
    currentVideoWidth = mp.getVideoWidth();
    currentVideoHeight = mp.getVideoHeight();
    mainThreadHandler.post(new Runnable() {
        @Override
        public void run() {
            if (listener() != null) {
                listener().onVideoSizeChanged();
            }
        }
    });
}
 
Example 3
Source File: IjkVideoView.java    From MD with Apache License 2.0 5 votes vote down vote up
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 4
Source File: PlayerView.java    From VRPlayer with Apache License 2.0 5 votes vote down vote up
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) {

        // REMOVED: getHolder().setFixedSize(mVideoWidth, mVideoHeight);
        requestLayout();
    }
}
 
Example 5
Source File: IjkVideoView.java    From TvPlayer with Apache License 2.0 5 votes vote down vote up
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 6
Source File: IjkPlayer.java    From DKVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onVideoSizeChanged(IMediaPlayer iMediaPlayer, int i, int i1, int i2, int i3) {
    int videoWidth = iMediaPlayer.getVideoWidth();
    int videoHeight = iMediaPlayer.getVideoHeight();
    if (videoWidth != 0 && videoHeight != 0) {
        mPlayerEventListener.onVideoSizeChanged(videoWidth, videoHeight);
    }
}
 
Example 7
Source File: JZMediaIjkplayer.java    From JZVideoDemo with MIT License 5 votes vote down vote up
@Override
public void onVideoSizeChanged(IMediaPlayer iMediaPlayer, int i, int i1, int i2, int i3) {
    JZMediaManager.instance().currentVideoWidth = iMediaPlayer.getVideoWidth();
    JZMediaManager.instance().currentVideoHeight = iMediaPlayer.getVideoHeight();
    JZMediaManager.instance().mainThreadHandler.post(new Runnable() {
        @Override
        public void run() {
            if (JZVideoPlayerManager.getCurrentJzvd() != null) {
                JZVideoPlayerManager.getCurrentJzvd().onVideoSizeChanged();
            }
        }
    });
}
 
Example 8
Source File: IjkVideoView.java    From LivePlayback with Apache License 2.0 5 votes vote down vote up
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 9
Source File: IjkVideoView.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
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 10
Source File: IjkVideoView.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
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 11
Source File: IjkVideoView.java    From GiraffePlayer with Apache License 2.0 5 votes vote down vote up
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 12
Source File: IjkVideoView.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
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 13
Source File: IjkPlayer.java    From PlayerBase with Apache License 2.0 5 votes vote down vote up
public void onPrepared(IMediaPlayer mp) {
    PLog.d(TAG,"onPrepared...");
    updateStatus(STATE_PREPARED);

    mVideoWidth = mp.getVideoWidth();
    mVideoHeight = mp.getVideoHeight();

    Bundle bundle = BundlePool.obtain();
    bundle.putInt(EventKey.INT_ARG1, mVideoWidth);
    bundle.putInt(EventKey.INT_ARG2, mVideoHeight);

    submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_PREPARED,bundle);

    int seekToPosition = startSeekPos;  // mSeekWhenPrepared may be changed after seekTo() call
    if (seekToPosition != 0) {
        mMediaPlayer.seekTo(seekToPosition);
        startSeekPos = 0;
    }

    // We don't know the video size yet, but should start anyway.
    // The video size might be reported to us later.
    PLog.d(TAG,"mTargetState = " + mTargetState);
    if (mTargetState == STATE_STARTED) {
        start();
    }else if(mTargetState == STATE_PAUSED){
        pause();
    }else if(mTargetState == STATE_STOPPED
            || mTargetState == STATE_IDLE){
        reset();
    }
}
 
Example 14
Source File: IjkPlayer.java    From VideoDemoJava with MIT License 5 votes vote down vote up
public void onPrepared(IMediaPlayer mp) {
    PLog.d(TAG, "onPrepared...");
    updateStatus(STATE_PREPARED);

    submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_PREPARED, null);

    // Get the capabilities of the player for this stream
    // REMOVED: Metadata

    mVideoWidth = mp.getVideoWidth();
    mVideoHeight = mp.getVideoHeight();

    int seekToPosition = startSeekPos;  // mSeekWhenPrepared may be changed after seekTo() call
    if (seekToPosition != 0) {
        seekTo(seekToPosition);
        startSeekPos = 0;
    }

    // We don't know the video size yet, but should start anyway.
    // The video size might be reported to us later.
    PLog.d(TAG, "mTargetState = " + mTargetState);
    if (mTargetState == STATE_STARTED) {
        start();
    } else if (mTargetState == STATE_PAUSED) {
        pause();
    } else if (mTargetState == STATE_STOPPED
            || mTargetState == STATE_IDLE) {
        reset();
    }
}
 
Example 15
Source File: IjkVideoView.java    From IjkPlayerDemo with Apache License 2.0 5 votes vote down vote up
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 16
Source File: MediaPlayerView.java    From HeroVideo-master with Apache License 2.0 4 votes vote down vote up
public void onPrepared(IMediaPlayer mp) {
    mCurrentState = STATE_PREPARED;

    // Get the capabilities of the player for this stream
    // REMOVED: Metadata

    if (mOnPreparedListener != null) {
        mOnPreparedListener.onPrepared(mMediaPlayer);
    }
    if (mMediaController != null) {
        mMediaController.setEnabled(true);
    }
    mVideoWidth = mp.getVideoWidth();
    mVideoHeight = mp.getVideoHeight();

    long seekToPosition = mSeekWhenPrepared;  // mSeekWhenPrepared may be changed after seekTo() call
    if (seekToPosition != 0) {
        seekTo((int) seekToPosition);
    }
    if (mVideoWidth != 0 && mVideoHeight != 0) {
        //Log.i("@@@@", "video size: " + mVideoWidth +"/"+ mVideoHeight);
        // REMOVED: getHolder().setFixedSize(mVideoWidth, mVideoHeight);
        if (mRenderView != null) {
            mRenderView.setVideoSize(mVideoWidth, mVideoHeight);
            mRenderView.setVideoSampleAspectRatio(mVideoSarNum, mVideoSarDen);
            if (!mRenderView.shouldWaitForResize() || mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) {
                // We didn't actually change the size (it was already at the size
                // we need), so we won't get a "surface changed" callback, so
                // start the video here instead of in the callback.
                if (mTargetState == STATE_PLAYING) {
                    start();
                    if (mMediaController != null) {
                        mMediaController.show();
                    }
                } else if (!isPlaying() &&
                    (seekToPosition != 0 || getCurrentPosition() > 0)) {
                    if (mMediaController != null) {
                        // Show the media controls when we're paused into a video and make 'em stick.
                        mMediaController.show(0);
                    }
                }
            }
        }
    } else {
        // We don't know the video size yet, but should start anyway.
        // The video size might be reported to us later.
        if (mTargetState == STATE_PLAYING) {
            start();
        }
    }
}
 
Example 17
Source File: IjkVideoView.java    From talk-android with MIT License 4 votes vote down vote up
public void onPrepared(IMediaPlayer mp) {
    mCurrentState = STATE_PREPARED;
    progressView.setVisibility(GONE);
    if (duration == -1) {
        duration = (int) mp.getDuration();
    }
    if (mOnPreparedListener != null) {
        mOnPreparedListener.onPrepared(mMediaPlayer);
    }
    if (mMediaController != null) {
        mMediaController.setEnabled(true);
    }
    if (mVideoWidth <= 0) {
        mVideoWidth = mp.getVideoWidth();
    }
    if (mVideoHeight <= 0) {
        mVideoHeight = mp.getVideoHeight();
    }

    int seekToPosition = mSeekWhenPrepared;  // mSeekWhenPrepared may be changed after seekTo() call
    if (seekToPosition != 0) {
        seekTo(seekToPosition);
    }
    if (mVideoWidth != 0 && mVideoHeight != 0) {
        if (mRenderView != null) {
            mRenderView.setVideoSize(mVideoWidth, mVideoHeight);
            mRenderView.setVideoSampleAspectRatio(mVideoSarNum, mVideoSarDen);
            if (!mRenderView.shouldWaitForResize() || mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) {
                if (mTargetState == STATE_PLAYING) {
                    start();
                    if (mMediaController != null) {
                        mMediaController.show();
                    }
                } else if (!isPlaying() &&
                        (seekToPosition != 0 || getCurrentPosition() > 0)) {
                    if (mMediaController != null) {
                        mMediaController.show(0);
                    }
                }
            }
        }
    } else {
        if (mTargetState == STATE_PLAYING) {
            start();
        }
    }
}
 
Example 18
Source File: IjkVideoView.java    From IjkPlayerDemo with Apache License 2.0 4 votes vote down vote up
public void onPrepared(IMediaPlayer mp) {
    mCurrentState = STATE_PREPARED;

    // Get the capabilities of the player for this stream
    // REMOVED: Metadata

    if (mOnPreparedListener != null) {
        mOnPreparedListener.onPrepared(mMediaPlayer);
    }
    if (mMediaController != null) {
        mMediaController.setEnabled(true);
    }
    mVideoWidth = mp.getVideoWidth();
    mVideoHeight = mp.getVideoHeight();

    long seekToPosition = mSeekWhenPrepared;  // mSeekWhenPrepared may be changed after seekTo() call
    if (seekToPosition != 0) {
        seekTo((int) seekToPosition);
    }
    if (mVideoWidth != 0 && mVideoHeight != 0) {
        //Log.i("@@@@", "video size: " + mVideoWidth +"/"+ mVideoHeight);
        // REMOVED: getHolder().setFixedSize(mVideoWidth, mVideoHeight);
        if (mRenderView != null) {
            mRenderView.setVideoSize(mVideoWidth, mVideoHeight);
            mRenderView.setVideoSampleAspectRatio(mVideoSarNum, mVideoSarDen);
            if (!mRenderView.shouldWaitForResize() || mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) {
                // We didn't actually change the size (it was already at the size
                // we need), so we won't get a "surface changed" callback, so
                // start the video here instead of in the callback.
                if (mTargetState == STATE_PLAYING) {
                    start();
                    if (mMediaController != null) {
                        mMediaController.show();
                    }
                } else if (!isPlaying() &&
                    (seekToPosition != 0 || getCurrentPosition() > 0)) {
                    if (mMediaController != null) {
                        // Show the media controls when we're paused into a video and make 'em stick.
                        mMediaController.show(0);
                    }
                }
            }
        }
    } else {
        // We don't know the video size yet, but should start anyway.
        // The video size might be reported to us later.
        if (mTargetState == STATE_PLAYING) {
            start();
        }
    }
}
 
Example 19
Source File: IjkVideoView.java    From LivePlayback with Apache License 2.0 4 votes vote down vote up
public void onPrepared(IMediaPlayer mp) {
    mCurrentState = STATE_PREPARED;

    // Get the capabilities of the player for this stream
    // REMOVED: Metadata

    if (mOnPreparedListener != null) {
        mOnPreparedListener.onPrepared(mMediaPlayer);
    }
    if (mMediaController != null) {
        mMediaController.setEnabled(true);
    }
    mVideoWidth = mp.getVideoWidth();
    mVideoHeight = mp.getVideoHeight();

    int seekToPosition = mSeekWhenPrepared;  // mSeekWhenPrepared may be changed after seekTo() call
    if (seekToPosition != 0) {
        seekTo(seekToPosition);
    }
    if (mVideoWidth != 0 && mVideoHeight != 0) {
        //Log.i("@@@@", "video size: " + mVideoWidth +"/"+ mVideoHeight);
        // REMOVED: getHolder().setFixedSize(mVideoWidth, mVideoHeight);
        if (mRenderView != null) {
            mRenderView.setVideoSize(mVideoWidth, mVideoHeight);
            mRenderView.setVideoSampleAspectRatio(mVideoSarNum, mVideoSarDen);
            if (!mRenderView.shouldWaitForResize() || mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) {
                // We didn't actually change the size (it was already at the size
                // we need), so we won't get a "surface changed" callback, so
                // start the video here instead of in the callback.
                if (mTargetState == STATE_PLAYING) {
                    start();
                    if (mMediaController != null) {
                        mMediaController.show();
                    }
                } else if (!isPlaying() &&
                        (seekToPosition != 0 || getCurrentPosition() > 0)) {
                    if (mMediaController != null) {
                        // Show the media controls when we're paused into a video and make 'em stick.
                        mMediaController.show(0);
                    }
                }
            }
        }
    } else {
        // We don't know the video size yet, but should start anyway.
        // The video size might be reported to us later.
        if (mTargetState == STATE_PLAYING) {
            start();
        }
    }
}
 
Example 20
Source File: IjkVideoView.java    From ZZShow with Apache License 2.0 4 votes vote down vote up
public void onPrepared(IMediaPlayer mp) {
    mCurrentState = STATE_PREPARED;

    // Get the capabilities of the player for this stream
    // REMOVED: Metadata

    if (mOnPreparedListener != null) {
        mOnPreparedListener.onPrepared(mMediaPlayer);
    }
    if (mMediaController != null) {
        mMediaController.setEnabled(true);
    }
    mVideoWidth = mp.getVideoWidth();
    mVideoHeight = mp.getVideoHeight();

    int seekToPosition = mSeekWhenPrepared;  // mSeekWhenPrepared may be changed after seekTo() call
    if (seekToPosition != 0) {
        seekTo(seekToPosition);
    }
    if (mVideoWidth != 0 && mVideoHeight != 0) {
        //Log.i("@@@@", "video size: " + mVideoWidth +"/"+ mVideoHeight);
        // REMOVED: getHolder().setFixedSize(mVideoWidth, mVideoHeight);
        if (mRenderView != null) {
            mRenderView.setVideoSize(mVideoWidth, mVideoHeight);
            mRenderView.setVideoSampleAspectRatio(mVideoSarNum, mVideoSarDen);
            if (!mRenderView.shouldWaitForResize() || mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) {
                // We didn't actually change the size (it was already at the size
                // we need), so we won't get a "surface changed" callback, so
                // start the video here instead of in the callback.
                if (mTargetState == STATE_PLAYING) {
                    start();
                    if (mMediaController != null) {
                        mMediaController.show();
                    }
                } else if (!isPlaying() &&
                        (seekToPosition != 0 || getCurrentPosition() > 0)) {
                    if (mMediaController != null) {
                        // Show the media controls when we're paused into a video and make 'em stick.
                        mMediaController.show(0);
                    }
                }
            }
        }
    } else {
        // We don't know the video size yet, but should start anyway.
        // The video size might be reported to us later.
        if (mTargetState == STATE_PLAYING) {
            start();
        }
    }
}