當前位置: 首頁>>代碼示例>>Java>>正文


Java IMediaPlayer類代碼示例

本文整理匯總了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());
    }
}
 
開發者ID:lanyan520,項目名稱:Idea-ijkplayer,代碼行數:22,代碼來源:TextureRenderView.java

示例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();
            }
        }
 
開發者ID:jiajunhui,項目名稱:PlayerBase,代碼行數:17,代碼來源:IJKVideoViewPlayer.java

示例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();
    }
}
 
開發者ID:SethWen,項目名稱:GestureVideoView,代碼行數:18,代碼來源:MediaPlayerCompat.java

示例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());
    }
}
 
開發者ID:khizar1556,項目名稱:MKVideoPlayer,代碼行數:21,代碼來源:TextureRenderView.java

示例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());
    }
}
 
開發者ID:miaoyongjun,項目名稱:MVideo,代碼行數:22,代碼來源:TextureRenderView.java

示例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;
}
 
開發者ID:TongmingWu,項目名稱:BLPlayer,代碼行數:18,代碼來源:IjkVideoView.java

示例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");
    }
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:20,代碼來源:JCVideoPlayer.java

示例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;
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:23,代碼來源:VideoPlayerView.java

示例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;
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:26,代碼來源:VideoPlayerView.java

示例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();
    }
}
 
開發者ID:jiajunhui,項目名稱:PlayerBase,代碼行數:26,代碼來源:IJkDecoderPlayer.java

示例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;
    }
}
 
開發者ID:dueeeke,項目名稱:dkplayer,代碼行數:18,代碼來源:BaseIjkVideoView.java

示例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;
                }
 
開發者ID:jiajunhui,項目名稱:PlayerBase,代碼行數:18,代碼來源:IJkDecoderPlayer.java

示例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();
    }
}
 
開發者ID:Dreamxiaoxuan,項目名稱:AndroidTvDemo,代碼行數:18,代碼來源:IjkVideoView.java

示例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);
    }
}
 
開發者ID:TedaLIEz,項目名稱:ParsingPlayer,代碼行數:17,代碼來源:ParsingPlayerProxy.java

示例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());
}
 
開發者ID:SethWen,項目名稱:GestureVideoView,代碼行數:9,代碼來源:AbsControllerView.java


注:本文中的tv.danmaku.ijk.media.player.IMediaPlayer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。