ijkplayer 解决rtmp 延迟长的问题,达到秒开的结果

ijkplayer 播放rtmp等 实时性要求很高的 流媒体时候,会出现10S左右的延迟,原因是因为加了缓冲区处理,可以把其缓存设置变小,达到实时的效果。如下代码 

IjkVideoView.java

                    //YYH delete start
                    //ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 48);
                    //YYH delete end

                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", 0);

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

//                        ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 48);
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 8);
                    Log.i(TAG, "yyh debug .... set ok...");
                    //YYH add
                    ijkMediaPlayer.setOption(1, "analyzemaxduration", 100L);
                    ijkMediaPlayer.setOption(1, "probesize", 10240L);
                    ijkMediaPlayer.setOption(1, "flush_packets", 1L);
                    ijkMediaPlayer.setOption(4, "packet-buffering", 0L);
                    ijkMediaPlayer.setOption(4, "framedrop", 1L);
                    //YYH end
如添加红色所示部分

你可能感兴趣的:(android)