tv.danmaku.ijk.media.player.IjkMediaPlayer Java Examples

The following examples show how to use tv.danmaku.ijk.media.player.IjkMediaPlayer. 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: IjkPlayer.java    From DKVideoPlayer with Apache License 2.0 7 votes vote down vote up
@Override
public void setDataSource(String path, Map<String, String> headers) {
    try {
        Uri uri = Uri.parse(path);
        if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(uri.getScheme())) {
            RawDataSourceProvider rawDataSourceProvider = RawDataSourceProvider.create(mAppContext, uri);
            mMediaPlayer.setDataSource(rawDataSourceProvider);
        } else {
            //处理UA问题
            if (headers != null) {
                String userAgent = headers.get("User-Agent");
                if (!TextUtils.isEmpty(userAgent)) {
                    mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "user_agent", userAgent);
                }
            }
            mMediaPlayer.setDataSource(mAppContext, uri, headers);
        }
    } catch (Exception e) {
        mPlayerEventListener.onError();
    }
}
 
Example #2
Source File: LiveVideoActivity.java    From AndroidTvDemo with Apache License 2.0 6 votes vote down vote up
@Override
protected void onStop()
{
    super.onStop();
    
    if (mBackPressed || !mVideoView.isBackgroundPlayEnabled())
    {
        mVideoView.stopPlayback();
        mVideoView.release(true);
        mVideoView.stopBackgroundPlay();
    }
    else
    {
        mVideoView.enterBackground();
    }
    IjkMediaPlayer.native_profileEnd();
}
 
Example #3
Source File: MainActivity.java    From AndroidTvDemo with Apache License 2.0 6 votes vote down vote up
@Override
protected void onStop()
{
    super.onStop();
    
    if (!mVideoView.isBackgroundPlayEnabled())
    {
        mVideoView.stopPlayback();
        mVideoView.release(true);
        mVideoView.stopBackgroundPlay();
    }
    else
    {
        mVideoView.enterBackground();
    }
    IjkMediaPlayer.native_profileEnd();
}
 
Example #4
Source File: FullScreenVideoActivity.java    From AndroidTvDemo with Apache License 2.0 6 votes vote down vote up
@Override
protected void onStop()
{
    super.onStop();
    
    if (mBackPressed || !mVideoView.isBackgroundPlayEnabled())
    {
        mVideoView.stopPlayback();
        mVideoView.release(true);
        mVideoView.stopBackgroundPlay();
    }
    else
    {
        mVideoView.enterBackground();
    }
    IjkMediaPlayer.native_profileEnd();
}
 
Example #5
Source File: VideoPlayer.java    From YCVideoPlayer with Apache License 2.0 6 votes vote down vote up
/**
 * 注意:MediaPlayer没有这个方法
 * 设置播放速度,不必须
 * @param speed                     播放速度
 */
@Override
public void setSpeed(float speed) {
    if (speed<0){
        VideoLogUtil.d("设置参数-------设置的视频播放速度不能小于0");
    }
    if (videoMediaPlayer.getMediaPlayer() instanceof IjkMediaPlayer) {
        ((IjkMediaPlayer) videoMediaPlayer.getMediaPlayer()).setSpeed(speed);
    } else if (videoMediaPlayer.getMediaPlayer() instanceof AndroidMediaPlayer){
        //((AndroidMediaPlayer) videoMediaPlayer.getMediaPlayer()).setSpeed(speed);
        VideoLogUtil.d("设置参数-------只有IjkPlayer才能设置播放速度");
    }else if(videoMediaPlayer.getMediaPlayer() instanceof MediaPlayer){
        //((MediaPlayer) videoMediaPlayer.getMediaPlayer()).setSpeed(speed);
        VideoLogUtil.d("设置参数-------只有IjkPlayer才能设置播放速度");
    } else {
        VideoLogUtil.d("设置参数-------只有IjkPlayer才能设置播放速度");
    }
}
 
Example #6
Source File: IjkVideoView.java    From DMusic with Apache License 2.0 6 votes vote down vote up
private void init(Context context) {
    this.mActivity = (Activity) context;
    // init player
    try {
        IjkMediaPlayer.loadLibrariesOnce(null);
        IjkMediaPlayer.native_profileBegin("libijkplayer.so");
        playerSupport = true;
    } catch (Throwable e) {
        ULog.e("GiraffePlayer loadLibraries error" + e);
    }

    initBackground();
    setFocusable(true);
    setFocusableInTouchMode(true);
    requestFocus();
}
 
Example #7
Source File: IjkPlayer.java    From VideoDemoJava with MIT License 6 votes vote down vote up
private IjkMediaPlayer createPlayer() {
        IjkMediaPlayer ijkMediaPlayer = new IjkMediaPlayer();
//        ijkMediaPlayer.native_setLogLevel(IjkMediaPlayer.IJK_LOG_DEBUG);

        //open mediacodec
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);

        //accurate seek
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1);

        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", 1);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "opensles", 1);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 1);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", 0);

        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "timeout", 10000000);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "reconnect", 1);

        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "http-detect-range-support", 0);

        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 48);
        return ijkMediaPlayer;
    }
 
Example #8
Source File: DragVideoActivity.java    From MVideo with Apache License 2.0 6 votes vote down vote up
@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_drag_video);
        screenWidth = getResources().getDisplayMetrics().widthPixels;
        screenHeight = getResources().getDisplayMetrics().heightPixels;
        previewImage = (ImageView) findViewById(R.id.previewImage);
        dragVideoView = (DragVideoView) findViewById(R.id.dragVideoView);
        mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
        IjkMediaPlayer.loadLibrariesOnce(null);
        IjkMediaPlayer.native_profileBegin("libijkplayer.so");
        getIntentData();
        mProgressBar.getIndeterminateDrawable().setColorFilter(
                progressColor, PorterDuff.Mode.MULTIPLY);
        if (!TextUtils.isEmpty(imagePath)) {
//            Glide.with(DragVideoActivity.this).load(imagePath).into(previewImage);
            loader.bind(previewImage, imagePath);
        }
        setViewPosition();
    }
 
Example #9
Source File: IjkPlayer.java    From DKVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public void initPlayer() {
    mMediaPlayer = new IjkMediaPlayer();
    //native日志
    IjkMediaPlayer.native_setLogLevel(VideoViewManager.getConfig().mIsEnableLog ? IjkMediaPlayer.IJK_LOG_INFO : IjkMediaPlayer.IJK_LOG_SILENT);
    setOptions();
    mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    mMediaPlayer.setOnErrorListener(onErrorListener);
    mMediaPlayer.setOnCompletionListener(onCompletionListener);
    mMediaPlayer.setOnInfoListener(onInfoListener);
    mMediaPlayer.setOnBufferingUpdateListener(onBufferingUpdateListener);
    mMediaPlayer.setOnPreparedListener(onPreparedListener);
    mMediaPlayer.setOnVideoSizeChangedListener(onVideoSizeChangedListener);
    mMediaPlayer.setOnNativeInvokeListener(new IjkMediaPlayer.OnNativeInvokeListener() {
        @Override
        public boolean onNativeInvoke(int i, Bundle bundle) {
            return true;
        }
    });
}
 
Example #10
Source File: PlayActivity.java    From Interessant with Apache License 2.0 6 votes vote down vote up
private void playVideo(String path) {
    try {
        mediaPlayer = new IjkMediaPlayer();
        videoController.attachPlayer(mediaPlayer, item);
        boolean cacheWithWifi = PreferenceManager.getBooleanValue(this, SettingsFragment.CACHE_KEY, true);
        if (cacheWithWifi && NetUtils.isWifiConnected(this)) {
            String proxyPath = cacheServer().getProxyUrl(path);
            cacheServer().registerCacheListener(this, path);
            mediaPlayer.setDataSource(proxyPath);
        } else {
            mediaPlayer.setDataSource(path);
        }
        mediaPlayer.prepareAsync();
        mediaPlayer.setOnBufferingUpdateListener(this);
        mediaPlayer.setOnCompletionListener(this);
        mediaPlayer.setOnPreparedListener(this);
        mediaPlayer.setOnInfoListener(this);
        mediaPlayer.setOnVideoSizeChangedListener(this);
        setVolumeControlStream(AudioManager.STREAM_MUSIC);
        mediaPlayer.setScreenOnWhilePlaying(true);
        videoController.startVideoPlayback(surfaceHolder);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example #11
Source File: VideoController.java    From Interessant with Apache License 2.0 6 votes vote down vote up
public void onInfo(int what) {
    switch (what) {
        case IjkMediaPlayer.MEDIA_INFO_BUFFERING_START:
            if (mediaPlayer.isPlaying()) {
                mediaPlayer.pause();
                progressBar.setVisibility(View.VISIBLE);
            }
            break;
        case IjkMediaPlayer.MEDIA_INFO_BUFFERING_END:
            mediaPlayer.start();
            progressBar.setVisibility(View.GONE);
            break;
        case IjkMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
        case IjkMediaPlayer.MEDIA_INFO_AUDIO_RENDERING_START:
            progressBar.setVisibility(View.GONE);
            break;
    }
}
 
Example #12
Source File: IjkPlayer.java    From youqu_master with Apache License 2.0 6 votes vote down vote up
@Override
public void initPlayer() {
    mMediaPlayer = new IjkMediaPlayer();
    setOptions();
    mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    mMediaPlayer.setOnErrorListener(onErrorListener);
    mMediaPlayer.setOnCompletionListener(onCompletionListener);
    mMediaPlayer.setOnInfoListener(onInfoListener);
    mMediaPlayer.setOnBufferingUpdateListener(onBufferingUpdateListener);
    mMediaPlayer.setOnPreparedListener(onPreparedListener);
    mMediaPlayer.setOnVideoSizeChangedListener(onVideoSizeChangedListener);
    mMediaPlayer.setOnNativeInvokeListener(new IjkMediaPlayer.OnNativeInvokeListener() {
        @Override
        public boolean onNativeInvoke(int i, Bundle bundle) {
            return true;
        }
    });
}
 
Example #13
Source File: IjkPlayerManager.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
public void setSpeed(float speed, boolean soundTouch) {
    if (speed > 0) {
        try {
            if (mediaPlayer != null) {
                mediaPlayer.setSpeed(speed);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (soundTouch) {
            VideoOptionModel videoOptionModel =
                    new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "soundtouch", 1);
            List<VideoOptionModel> list = getOptionModelList();
            if (list != null) {
                list.add(videoOptionModel);
            } else {
                list = new ArrayList<>();
                list.add(videoOptionModel);
            }
            setOptionModelList(list);
        }

    }
}
 
Example #14
Source File: IjkMedia.java    From QSVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public boolean setSpeed(float rate) {
    if (isPrepar & mediaPlayer != null) {
        ((IjkMediaPlayer) mediaPlayer).setSpeed(rate);
    }
    return true;
}
 
Example #15
Source File: IjkPlayerImpl.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
public IjkPlayerImpl(Context context, PlayerAttributes attributes) {
    super(context, attributes);

    mPlayer = new IjkMediaPlayer();

    //不用MediaCodec编解码
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
        "mediacodec", 1);

    //不用opensles编解码
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
        "opensles", 0);
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
        "overlay-format", IjkMediaPlayer.SDL_FCC_RV32);
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "framedrop", 1);
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
        "start-on-prepared", 0);
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
        "http-detect-range-support", 0);
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
        "timeout", 10000000);
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
        "reconnect", 1);
    mPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC,
        "skip_loop_filter", 48);
    mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

    initPlayerListeners();
}
 
Example #16
Source File: LiveActivity.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
@Override
protected void onStop() {
    super.onStop();
    if (mBackPressed || !videoView.isBackgroundPlayEnabled()) {
        videoView.stopPlayback();
        videoView.release(true);
        videoView.stopBackgroundPlay();
    }
    IjkMediaPlayer.native_profileEnd();
}
 
Example #17
Source File: GiraffePlayer.java    From IjkPlayerDemo with Apache License 2.0 5 votes vote down vote up
public GiraffePlayer(
        final Activity activity,
        final LinearLayout containerView,
        final String url
) {
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    this.activity=activity;
    this.containerView = containerView;
    this.view = LayoutInflater.from(activity).inflate(R.layout.giraffe_player,containerView,false);
    containerView.addView(view);
    commonInit(url);
}
 
Example #18
Source File: MainFragment.java    From GiraffePlayer2 with Apache License 2.0 5 votes vote down vote up
@Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //set global configuration: turn on multiple_requests
        PlayerManager.getInstance().getDefaultVideoInfo().addOption(Option.create(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "multiple_requests", 1L));
//        PlayerManager.getInstance().getDefaultVideoInfo().addOptions(Option.preset4Realtime());
    }
 
Example #19
Source File: IjkWrapper.java    From Fatigue-Detection with MIT License 5 votes vote down vote up
public void init(){
    mStatus = STATUS_IDLE;
    mPlayer = new IjkMediaPlayer();
    mPlayer.setOnPreparedListener(this);
    mPlayer.setOnInfoListener(new IMediaPlayer.OnInfoListener() {
        @Override
        public boolean onInfo(IMediaPlayer mp, int what, int extra) {
            return false;
        }
    });
}
 
Example #20
Source File: IjkVideoView.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
public void setSpeed(float speed) {
    if (mIsUsingPlayerType == Constants.IJK_PLAYER) {
        IjkMediaPlayer ijkMediaPlayer = (IjkMediaPlayer) mMediaPlayer;
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "soundtouch", 1);
        ijkMediaPlayer.setSpeed(speed);
        mMediaPlayer.start();
    }
}
 
Example #21
Source File: LiveVideoActivity.java    From AndroidTvDemo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_live_video);
    initTiemData();
    initVideoList();
    mSettings = new Settings(this);
    
    // handle arguments
    mVideoPath = getIntent().getStringExtra("videoPath");
    playIndex = getIntent().getIntExtra("index", 0);
    mVideoPath = urls[playIndex];
    Intent intent = getIntent();
    String intentAction = intent.getAction();
    if (!TextUtils.isEmpty(mVideoPath))
    {
        new RecentMediaStorage(this).saveUrlAsync(mVideoPath);
    }
    
    // init player
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    tips = (TextView)findViewById(R.id.tips);
    liveName = (TextView)findViewById(R.id.liveName);
    mVideoView = (IjkVideoView)findViewById(R.id.video_view);
    playVideo(mVideoPath, playIndex);
}
 
Example #22
Source File: PlayerView.java    From VRPlayer with Apache License 2.0 5 votes vote down vote up
private void enableHardwareDecoding() {
    if (mMediaPlayer instanceof IjkMediaPlayer) {
        IjkMediaPlayer player = (IjkMediaPlayer) mMediaPlayer;
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", 1);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", IjkMediaPlayer.SDL_FCC_RV32);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 60);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "max-fps", 0);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 48);
    }
}
 
Example #23
Source File: IjkPlayer.java    From PlayerBase with Apache License 2.0 5 votes vote down vote up
protected IjkMediaPlayer createPlayer(){
        IjkMediaPlayer ijkMediaPlayer = new IjkMediaPlayer();
//        ijkMediaPlayer.native_setLogLevel(IjkMediaPlayer.IJK_LOG_DEBUG);

        //设置清除dns cache
        //IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1

        //open mediacodec
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-hevc", 1);

        //accurate seek
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1);

        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", 1);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "opensles", 1);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 1);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", 0);

        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "timeout", 10000000);
        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "reconnect", 1);

        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "http-detect-range-support", 0);

        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 48);
        return ijkMediaPlayer;
    }
 
Example #24
Source File: VideoPlayer.java    From YCVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 获取播放速度
 * @param speed             播放速度
 * @return                  速度
 */
@Override
public float getSpeed(float speed) {
    if (videoMediaPlayer.getMediaPlayer() instanceof IjkMediaPlayer) {
        return ((IjkMediaPlayer) videoMediaPlayer.getMediaPlayer()).getSpeed(speed);
    }
    return 0;
}
 
Example #25
Source File: MediaPlayerWrapper.java    From MD360Player4Android with Apache License 2.0 5 votes vote down vote up
private void enableHardwareDecoding(){
    if (mPlayer instanceof IjkMediaPlayer){
        IjkMediaPlayer player = (IjkMediaPlayer) mPlayer;
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", 1);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", IjkMediaPlayer.SDL_FCC_RV32);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 60);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "max-fps", 0);
        player.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 48);
    }
}
 
Example #26
Source File: LiveActivityRel.java    From TvPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onStop() {
    super.onStop();
    if (!mVideoView.isBackgroundPlayEnabled()) {
        mVideoView.stopPlayback();
        mVideoView.release(true);
        mVideoView.stopBackgroundPlay();
    }
    IjkMediaPlayer.native_profileEnd();
}
 
Example #27
Source File: ParsingPlayer.java    From ParsingPlayer with GNU Lesser General Public License v2.1 5 votes vote down vote up
private IjkMediaPlayer createPlayer(Config config) {
    IjkMediaPlayer ijkMediaPlayer = new IjkMediaPlayer();
    IjkMediaPlayer.loadLibrariesOnce(null);
    IjkMediaPlayer.native_profileBegin("libijkplayer.so");
    IjkMediaPlayer.native_setLogLevel(BuildConfig.DEBUG ? IjkMediaPlayer.IJK_LOG_DEFAULT : IjkMediaPlayer.IJK_LOG_ERROR);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
            "safe", config.safe ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
            "protocol_whitelist", config.whiteList);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "mediacodec-auto-rotate", config.mediacodecAutoRotate ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "mediacodec-handle-resolution-change", config.mediacodecHandleResolutionChange ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "opensles", config.opensles ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "overlay-format", config.overLayFormat);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "framedrop", config.frameDrop ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,
            "start-on-prepared", config.startOnPrepared ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,
            "http-detect-range-support", config.httpRangeSupport ? 1 : 0);
    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC,
            "skip_loop_filter", config.skipLoopFilter);
    return ijkMediaPlayer;
}
 
Example #28
Source File: IjkPlayerManager.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void setSpeedPlaying(float speed, boolean soundTouch) {
    if (mediaPlayer != null) {
        mediaPlayer.setSpeed(speed);
        mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "soundtouch", (soundTouch) ? 1 : 0);
    }
}
 
Example #29
Source File: IjkPlayerManager.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
private void initIJKOption(IjkMediaPlayer ijkMediaPlayer, List<VideoOptionModel> optionModelList) {
    if (optionModelList != null && optionModelList.size() > 0) {
        for (VideoOptionModel videoOptionModel : optionModelList) {
            if (videoOptionModel.getValueType() == VideoOptionModel.VALUE_TYPE_INT) {
                ijkMediaPlayer.setOption(videoOptionModel.getCategory(),
                        videoOptionModel.getName(), videoOptionModel.getValueInt());
            } else {
                ijkMediaPlayer.setOption(videoOptionModel.getCategory(),
                        videoOptionModel.getName(), videoOptionModel.getValueString());
            }
        }
    }
}
 
Example #30
Source File: MediaPlayerWrapper.java    From MD360Player4Android with Apache License 2.0 5 votes vote down vote up
public void init(){
    mStatus = STATUS_IDLE;
    mPlayer = new IjkMediaPlayer();
    mPlayer.setOnPreparedListener(this);
    mPlayer.setOnInfoListener(new IMediaPlayer.OnInfoListener() {
        @Override
        public boolean onInfo(IMediaPlayer mp, int what, int extra) {
            return false;
        }
    });

    enableHardwareDecoding();
}