Пример #1
0
 public void start() {
   if (isInPlaybackState()) {
     mMediaPlayer.start();
     mCurrentState = STATE_PLAYING;
   }
   mTargetState = STATE_PLAYING;
 }
Пример #2
0
        @Override
        public boolean onInfo(MediaPlayer mp, int what, int extra) {
          Log.d("onInfo: (%d, %d)", what, extra);
          if (mOnInfoListener != null) {
            mOnInfoListener.onInfo(mp, what, extra);
          } else if (mMediaPlayer != null) {
            if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) mMediaPlayer.pause();
            else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) mMediaPlayer.start();
          }

          return true;
        }
 @Override
 public void start() {
   if (mMediaPlayer != null && mIsMediaReadyToBePlayed) {
     mMediaPlayer.start();
     Intent intent = new Intent();
     intent.setAction(ACTION_INFO);
     intent.putExtra("action", "start");
     if (!isStreaming) intent.putExtra("pos", getCurrentPosition());
     sendBroadcast(intent);
   } else {
     Log.e(TAG, "MediaPlayer is not instantiated yet.");
   }
 }
Пример #4
0
 private void preparePlayer() {
   if (player == null) {
     player = new MediaPlayer(this);
     playerNeedsPrepare = true;
     mediaController.setMediaPlayer(player);
     mediaController.setEnabled(true);
   }
   if (playerNeedsPrepare) {
     player.prepareAsync();
     playerNeedsPrepare = false;
   }
   player.setSurface(surfaceView.getHolder().getSurface());
   player.start();
 }
Пример #5
0
 @Override
 public boolean onInfo(MediaPlayer arg0, int arg1, int arg2) {
   switch (arg1) {
     case MediaPlayer.MEDIA_INFO_BUFFERING_START:
       if (mListener != null) mListener.onBufferStart();
       else mPlayer.pause();
       break;
     case MediaPlayer.MEDIA_INFO_BUFFERING_END:
       if (mListener != null) mListener.onBufferComplete();
       else mPlayer.start();
       break;
     case MediaPlayer.MEDIA_INFO_DOWNLOAD_RATE_CHANGED:
       if (mListener != null) mListener.onDownloadRateChanged(arg2);
       break;
   }
   return true;
 }
Пример #6
0
 private void startVideoPlayback() {
   Log.v(TAG, "startVideoPlayback");
   // holder.setFixedSize(mVideoWidth, mVideoHeight);
   player.start();
   showSystemUi(false);
 }
Пример #7
0
 @Override
 public void start() {
   player.start();
 }
Пример #8
0
 private void startVideoPlayback() {
   Log.v(TAG, "startVideoPlayback");
   holder.setFixedSize(mVideoWidth, mVideoHeight);
   mMediaPlayer.start();
 }
Пример #9
0
 public void start() {
   if (mInitialized) {
     mPlayer.start();
     setState(STATE_PLAYING);
   }
 }