本文整理匯總了Java中tv.danmaku.ijk.media.player.IMediaPlayer類的典型用法代碼示例。如果您正苦於以下問題:Java IMediaPlayer類的具體用法?Java IMediaPlayer怎麽用?Java IMediaPlayer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IMediaPlayer類屬於tv.danmaku.ijk.media.player包,在下文中一共展示了IMediaPlayer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bindToMediaPlayer
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@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());
}
}
示例2: onPrepared
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@Override
public void onPrepared(IMediaPlayer mp) {
mStatus = STATUS_PREPARED;
preparedMediaPlayer(mp);
if(startSeekPos > 0){
seekTo(startSeekPos);
startSeekPos = -1;
}
Log.d(TAG,"EVENT_CODE_PREPARED");
onPlayerEvent(OnPlayerEventListener.EVENT_CODE_PREPARED,null);
// //IjkVideoView ...int STATE_PLAYING = 3;
if(available() && mTargetStatus==STATUS_STARTED){
start();
}
}
示例3: getName
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
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();
}
}
示例4: bindToMediaPlayer
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@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());
}
}
示例5: bindToMediaPlayer
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@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.textureCallBack.setOwnSurfaceTexture(false);
SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
if (surfaceTexture != null) {
mTextureView.setSurfaceTexture(surfaceTexture);
} else {
textureHolder.setSurfaceTexture(mSurfaceTexture);
textureHolder.setSurfaceTextureHost(mTextureView.textureCallBack);
}
} else {
mp.setSurface(openSurface());
}
}
示例6: onError
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
Log.d(TAG, "Error: " + framework_err + "," + impl_err);
mCurrentState = STATE_ERROR;
mTargetState = STATE_ERROR;
if (mMediaController != null) {
mMediaController.hide();
}
/* If an error handler has been supplied, use it and finish. */
if (mOnErrorListener != null) {
if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
return true;
}
}
return true;
}
示例7: onInfo
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@Override
public void onInfo(int what, int extra) {
Log.d(TAG, "onInfo what - " + what + " extra - " + extra);
if (what == IMediaPlayer.MEDIA_INFO_BUFFERING_START) {
JCMediaManager.instance().backUpBufferState = currentState;
setUiWitStateAndScreen(CURRENT_STATE_PLAYING_BUFFERING_START);
Log.d(TAG, "MEDIA_INFO_BUFFERING_START");
} else if (what == IMediaPlayer.MEDIA_INFO_BUFFERING_END) {
if (JCMediaManager.instance().backUpBufferState != -1) {
setUiWitStateAndScreen(JCMediaManager.instance().backUpBufferState);
JCMediaManager.instance().backUpBufferState = -1;
}
Log.d(TAG, "MEDIA_INFO_BUFFERING_END");
} else if (what == IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED) {
JCMediaManager.instance().videoRotation = extra;
JCMediaManager.textureView.setRotation(extra);
Log.d(TAG, "MEDIA_INFO_VIDEO_ROTATION_CHANGED");
}
}
示例8: onInfo
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@Override
public boolean onInfo(IMediaPlayer mp, int what, int extra) {
DebugLog.dfmt(TAG, "onInfo: (%d, %d)", what, extra);
if (mOnInfoListener != null) {
mOnInfoListener.onInfo(mp, what, extra);
} else if (mMediaPlayer != null) {
if (what == IMediaPlayer.MEDIA_INFO_BUFFERING_START) {
DebugLog.dfmt(TAG, "onInfo: (MEDIA_INFO_BUFFERING_START)");
if (mMediaBufferingIndicator != null) {
mMediaBufferingIndicator.setVisibility(View.VISIBLE);
}
} else if (what == IMediaPlayer.MEDIA_INFO_BUFFERING_END) {
DebugLog.dfmt(TAG, "onInfo: (MEDIA_INFO_BUFFERING_END)");
if (mMediaBufferingIndicator != null) {
mMediaBufferingIndicator.setVisibility(View.GONE);
}
}
}
return true;
}
示例9: onError
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@Override
public boolean onError(IMediaPlayer player, int frameworkErr, int implErr) {
DebugLog.dfmt(TAG, "Error: %d, %d", frameworkErr, implErr);
mCurrentState = STATE_ERROR;
mTargetState = STATE_ERROR;
if (mMediaController != null)
mMediaController.hide();
if (mOnErrorListener != null)
if (mOnErrorListener.onError(mMediaPlayer, frameworkErr, implErr))
return true;
if (getWindowToken() != null){
int message = frameworkErr == IMediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK
? R.string.video_error_text_invalid_progressive_playback : R.string.video_error_text_unknown;
new AlertDialog.Builder(mContext)
.setTitle(R.string.video_error_title)
.setMessage(message)
.setPositiveButton(R.string.video_error_button, (error, whichButton) -> {
if (mOnCompletionListener != null)
mOnCompletionListener.onCompletion(mMediaPlayer);
})
.setCancelable(false)
.show();
}
return true;
}
示例10: onPrepared
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
public void onPrepared(IMediaPlayer mp) {
Log.d(TAG,"onPrepared...");
mStatus = STATUS_PREPARED;
onPlayerEvent(OnPlayerEventListener.EVENT_CODE_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.
Log.d(TAG,"mTargetStatus = " + mTargetStatus);
if (mTargetStatus == STATUS_STARTED) {
start();
}
}
示例11: onInfo
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@Override
public void onInfo(int what, int extra) {
if (listener != null) listener.onInfo(what, extra);
switch (what) {
case IMediaPlayer.MEDIA_INFO_BUFFERING_START:
mCurrentState = STATE_BUFFERING;
setPlayState(mCurrentState);
break;
case IMediaPlayer.MEDIA_INFO_BUFFERING_END:
mCurrentState = STATE_BUFFERED;
setPlayState(mCurrentState);
break;
case IjkMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: // 視頻開始渲染
if (getWindowVisibility() != VISIBLE) pause();
break;
}
}
示例12: onError
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
Log.d(TAG, "Error: " + framework_err + "," + impl_err);
mStatus = STATUS_ERROR;
mTargetStatus = STATUS_ERROR;
switch (framework_err){
case 100:
// release(true);
break;
}
/* If an error handler has been supplied, use it and finish. */
Bundle bundle = new Bundle();
bundle.putInt(OnErrorListener.KEY_EXTRA,framework_err);
onErrorEvent(OnErrorListener.ERROR_CODE_COMMON,bundle);
return true;
}
示例13: onVideoSizeChanged
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
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();
}
}
示例14: onPrepared
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
@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);
}
}
示例15: AbsControllerView
import tv.danmaku.ijk.media.player.IMediaPlayer; //導入依賴的package包/類
public AbsControllerView(Context context, IMediaPlayer player) {
this.context = context;
this.mPlayer = player;
initViews();
formatBuilder = new StringBuilder();
formatter = new Formatter(formatBuilder, Locale.getDefault());
}