コード例 #1
0
ファイル: VideoView.java プロジェクト: avenwu/vplus
        public void onPrepared(IMediaPlayer mp) {
          DebugLog.d(TAG, "onPrepared");
          mCurrentState = STATE_PREPARED;
          mTargetState = STATE_PLAYING;

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

          long seekToPosition = mSeekWhenPrepared;

          if (seekToPosition != 0) seekTo(seekToPosition);
          if (mVideoWidth != 0 && mVideoHeight != 0) {
            setVideoLayout(mVideoLayout);
            if (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();
          }
        }
コード例 #2
0
ファイル: VideoView.java プロジェクト: avenwu/vplus
 public void onVideoSizeChanged(
     IMediaPlayer mp, int width, int height, int sarNum, int sarDen) {
   DebugLog.dfmt(TAG, "onVideoSizeChanged: (%dx%d)", width, height);
   mVideoWidth = mp.getVideoWidth();
   mVideoHeight = mp.getVideoHeight();
   mVideoSarNum = sarNum;
   mVideoSarDen = sarDen;
   if (mVideoWidth != 0 && mVideoHeight != 0) setVideoLayout(mVideoLayout);
 }