使用GSYVideoPlayer框架加载RTSP视频流,怎么使GSYVideoOptionBuilder()调用VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "packet-buffering", 0L)
时间: 2024-05-07 18:18:55 浏览: 191
使用GSYVideoPlayer框架加载RTSP视频流时,可以通过以下方式来调用VideoOptionModel:
```java
GSYVideoOptionBuilder builder = new GSYVideoOptionBuilder();
builder.setUrl("rtsp://xxxxxx");
builder.setVideoTitle("RTSP Stream");
builder.setCacheWithPlay(true);
builder.setRotateViewAuto(false);
builder.setLockLand(false);
builder.setPlayTag("rtsp");
builder.setShowFullAnimation(true);
builder.setNeedLockFull(true);
builder.setIsTouchWiget(false);
builder.setDismissControlTime(0);
builder.setVideoAllCallBack(new GSYSampleCallBack() {
@Override
public void onPrepared(String url, Object... objects) {
super.onPrepared(url, objects);
// 在此处调用VideoOptionModel
VideoOptionModel videoOptionModel = new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "packet-buffering", 0L);
GSYVideoManager.instance().setOptionModelList(Collections.singletonList(videoOptionModel));
}
});
builder.build(mVideoPlayer);
```
在上述代码中,我们在设置`GSYVideoOptionBuilder`的`VideoAllCallBack`时,重载了`onPrepared`方法,并在其中调用了`VideoOptionModel`的初始化。这样便可以在GSYVideoPlayer中加载RTSP视频流时,调用VideoOptionModel。
阅读全文