Java Code Examples for io.vov.vitamio.utils.Log#d()

The following examples show how to use io.vov.vitamio.utils.Log#d() . 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: VideoView.java    From video-player with MIT License 6 votes vote down vote up
public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
  Log.d("Error: %d, %d", framework_err, impl_err);
  mCurrentState = STATE_ERROR;
  mTargetState = STATE_ERROR;
  if (mMediaController != null)
    mMediaController.hide();

  if (mOnErrorListener != null) {
    if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err))
      return true;
  }

  if (getWindowToken() != null) {
    int message = framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK ? getResources().getIdentifier("VideoView_error_text_invalid_progressive_playback", "string", mContext.getPackageName()): getResources().getIdentifier("VideoView_error_text_unknown", "string", mContext.getPackageName());

    new AlertDialog.Builder(mContext).setTitle(getResources().getIdentifier("VideoView_error_title", "string", mContext.getPackageName())).setMessage(message).setPositiveButton(getResources().getIdentifier("VideoView_error_button", "string", mContext.getPackageName()), new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int whichButton) {
        if (mOnCompletionListener != null)
          mOnCompletionListener.onCompletion(mMediaPlayer);
      }
    }).setCancelable(false).show();
  }
  return true;
}
 
Example 2
Source File: MediaController.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
public void hide() {
    if (mAnchor == null)
        return;

    if (mShowing) {
        try {
            mHandler.removeMessages(SHOW_PROGRESS);
            if (mFromXml)
                setVisibility(View.GONE);
            else
                mWindow.dismiss();
        } catch (IllegalArgumentException ex) {
            Log.d("MediaController already removed");
        }
        mShowing = false;
        if (mHiddenListener != null)
            mHiddenListener.onHidden();
    }
}
 
Example 3
Source File: VideoView.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
  Log.d("Error: %d, %d", framework_err, impl_err);
  mCurrentState = STATE_ERROR;
  mTargetState = STATE_ERROR;
  if (mMediaController != null)
    mMediaController.hide();
  if (mOnErrorListener != null) {
    if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err))
      return true;
  }

  if (getWindowToken() != null) {
    int message = framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK ? getResources().getIdentifier("VideoView_error_text_invalid_progressive_playback", "string", mContext.getPackageName()): getResources().getIdentifier("VideoView_error_text_unknown", "string", mContext.getPackageName());

    new AlertDialog.Builder(mContext).setTitle(getResources().getIdentifier("VideoView_error_title", "string", mContext.getPackageName())).setMessage(message).setPositiveButton(getResources().getIdentifier("VideoView_error_button", "string", mContext.getPackageName()), new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int whichButton) {
        if (mOnCompletionListener != null)
          mOnCompletionListener.onCompletion(mMediaPlayer);
      }
    }).setCancelable(false).show();
  }
  return true;
}
 
Example 4
Source File: MediaController.java    From HPlayer with Apache License 2.0 6 votes vote down vote up
public void hide() {
  if (mAnchor == null)
    return;

  if (mShowing) {
    try {
      mHandler.removeMessages(SHOW_PROGRESS);
      if (mFromXml)
        setVisibility(View.GONE);
      else
        mWindow.dismiss();
    } catch (IllegalArgumentException ex) {
      Log.d("MediaController already removed");
    }
    mShowing = false;
    if (mHiddenListener != null)
      mHiddenListener.onHidden();
  }
}
 
Example 5
Source File: VideoView.java    From video-player with MIT License 5 votes vote down vote up
public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
  Log.d("onVideoSizeChanged: (%dx%d)", width, height);
  mVideoWidth = mp.getVideoWidth();
  mVideoHeight = mp.getVideoHeight();
  mVideoAspectRatio = mp.getVideoAspectRatio();
  if (mVideoWidth != 0 && mVideoHeight != 0)
    setVideoLayout(mVideoLayout, mAspectRatio);
}
 
Example 6
Source File: VideoView.java    From video-player with MIT License 5 votes vote down vote up
public void onCompletion(MediaPlayer mp) {
  Log.d("onCompletion");
  mCurrentState = STATE_PLAYBACK_COMPLETED;
  mTargetState = STATE_PLAYBACK_COMPLETED;
  if (mMediaController != null)
    mMediaController.hide();
  if (mOnCompletionListener != null)
    mOnCompletionListener.onCompletion(mMediaPlayer);
}
 
Example 7
Source File: VideoView.java    From HPlayer with Apache License 2.0 5 votes vote down vote up
public void suspend() {
  if (isInPlaybackState()) {
    release(false);
    mCurrentState = STATE_SUSPEND_UNSUPPORTED;
    Log.d("Unable to suspend video. Release MediaPlayer.");
  }
}
 
Example 8
Source File: VideoView.java    From NetEasyNews with GNU General Public License v3.0 5 votes vote down vote up
public void onPrepared(MediaPlayer mp) {
   Log.d("onPrepared");
mCurrentState = STATE_PREPARED;
// mTargetState = STATE_PLAYING;

// Get the capabilities of the player for this stream
//TODO mCanPause

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

   long seekToPosition = mSeekWhenPrepared;
   if (seekToPosition != 0)
     seekTo(seekToPosition);
   
   if (mVideoWidth != 0 && mVideoHeight != 0) {
     setVideoLayout(mVideoLayout, mAspectRatio);
     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();
   }
 }
 
Example 9
Source File: VideoView.java    From video-player with MIT License 5 votes vote down vote up
public void suspend() {
  if (isInPlaybackState()) {
    release(false);
    mCurrentState = STATE_SUSPEND_UNSUPPORTED;
    Log.d("Unable to suspend video. Release MediaPlayer.");
  }
}
 
Example 10
Source File: VideoView.java    From HPlayer with Apache License 2.0 5 votes vote down vote up
public void onCompletion(MediaPlayer mp) {
  Log.d("onCompletion");
  mCurrentState = STATE_PLAYBACK_COMPLETED;
  mTargetState = STATE_PLAYBACK_COMPLETED;
  if (mMediaController != null)
    mMediaController.hide();
  if (mOnCompletionListener != null)
    mOnCompletionListener.onCompletion(mMediaPlayer);
}
 
Example 11
Source File: VideoView.java    From HPlayer with Apache License 2.0 5 votes vote down vote up
public void onPrepared(MediaPlayer mp) {
   Log.d("onPrepared");
if (false) {
	stopPlayback();
	return;
}
mCurrentState = STATE_PREPARED;
// mTargetState = STATE_PLAYING;

// Get the capabilities of the player for this stream
//TODO mCanPause

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

   long seekToPosition = mSeekWhenPrepared;
   if (seekToPosition != 0)
     seekTo(seekToPosition);

   if (mVideoWidth != 0 && mVideoHeight != 0) {
     setVideoLayout(mVideoLayout, mAspectRatio);
     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();
   }
 }
 
Example 12
Source File: VideoView.java    From NetEasyNews with GNU General Public License v3.0 5 votes vote down vote up
public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
  Log.d("onVideoSizeChanged: (%dx%d)", width, height);
  mVideoWidth = mp.getVideoWidth();
  mVideoHeight = mp.getVideoHeight();
  mVideoAspectRatio = mp.getVideoAspectRatio();
  if (mVideoWidth != 0 && mVideoHeight != 0)
    setVideoLayout(mVideoLayout, mAspectRatio);
}
 
Example 13
Source File: VideoView.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
public void suspend() {
  if (isInPlaybackState()) {
    release(false);
    mCurrentState = STATE_SUSPEND_UNSUPPORTED;
    Log.d("Unable to suspend video. Release MediaPlayer.");
  }
}
 
Example 14
Source File: VideoView.java    From video-player with MIT License 5 votes vote down vote up
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
  Log.d("onInfo: (%d, %d)", what, extra);
	
  	if(MediaPlayer.MEDIA_INFO_UNKNOW_TYPE == what){
		Log.e(" VITAMIO--TYPE_CHECK  stype  not include  onInfo mediaplayer unknow type ");
	} 
	
	if(MediaPlayer.MEDIA_INFO_FILE_OPEN_OK == what){
		long buffersize=mMediaPlayer.audioTrackInit(); 
		mMediaPlayer.audioInitedOk(buffersize);
	}

  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();
      if (mMediaBufferingIndicator != null)
        mMediaBufferingIndicator.setVisibility(View.VISIBLE);
    } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) {
      mMediaPlayer.start();
      if (mMediaBufferingIndicator != null)
        mMediaBufferingIndicator.setVisibility(View.GONE);
    }
  }
  return true;
}
 
Example 15
Source File: VideoView.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
  Log.d("onInfo: (%d, %d)", what, extra);
	
  	if(MediaPlayer.MEDIA_INFO_UNKNOW_TYPE == what){
		Log.e(" VITAMIO--TYPE_CHECK  stype  not include  onInfo mediaplayer unknow type ");
	} 
	
	if(MediaPlayer.MEDIA_INFO_FILE_OPEN_OK == what){
		long buffersize=mMediaPlayer.audioTrackInit(); 
		mMediaPlayer.audioInitedOk(buffersize);
	}

  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();
      if (mMediaBufferingIndicator != null)
        mMediaBufferingIndicator.setVisibility(View.VISIBLE);
    } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) {
      mMediaPlayer.start();
      if (mMediaBufferingIndicator != null)
        mMediaBufferingIndicator.setVisibility(View.GONE);
    }
  }
  return true;
}
 
Example 16
Source File: VideoView.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
public void onCompletion(MediaPlayer mp) {
  Log.d("onCompletion");
  mCurrentState = STATE_PLAYBACK_COMPLETED;
  mTargetState = STATE_PLAYBACK_COMPLETED;
  if (mMediaController != null)
    mMediaController.hide();
  if (mOnCompletionListener != null)
    mOnCompletionListener.onCompletion(mMediaPlayer);
}
 
Example 17
Source File: VideoView.java    From NetEasyNews with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
  Log.d("onInfo: (%d, %d)", what, extra);
	
  	if(MediaPlayer.MEDIA_INFO_UNKNOW_TYPE == what){
		Log.e(" VITAMIO--TYPE_CHECK  stype  not include  onInfo mediaplayer unknow type ");
	} 
	
	if(MediaPlayer.MEDIA_INFO_FILE_OPEN_OK == what){
		long buffersize=mMediaPlayer.audioTrackInit(); 
		mMediaPlayer.audioInitedOk(buffersize);
	}

  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();
      if (mMediaBufferingIndicator != null)
        mMediaBufferingIndicator.setVisibility(View.VISIBLE);
    } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) {
      mMediaPlayer.start();
      if (mMediaBufferingIndicator != null)
        mMediaBufferingIndicator.setVisibility(View.GONE);
    }
  }
  return true;
}
 
Example 18
Source File: VideoView.java    From NetEasyNews with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onSeekComplete(MediaPlayer mp) {
  Log.d("onSeekComplete");
  if (mOnSeekCompleteListener != null)
    mOnSeekCompleteListener.onSeekComplete(mp);
}
 
Example 19
Source File: VideoView.java    From HPlayer with Apache License 2.0 4 votes vote down vote up
@Override
public void onSeekComplete(MediaPlayer mp) {
  Log.d("onSeekComplete");
  if (mOnSeekCompleteListener != null)
    mOnSeekCompleteListener.onSeekComplete(mp);
}
 
Example 20
Source File: VideoView.java    From video-player with MIT License 4 votes vote down vote up
@Override
public void onSeekComplete(MediaPlayer mp) {
  Log.d("onSeekComplete");
  if (mOnSeekCompleteListener != null)
    mOnSeekCompleteListener.onSeekComplete(mp);
}