use of com.shuyu.gsyvideoplayer.listener.LockClickListener in project GSYVideoPlayer by CarGuo.
the class DanmkuVideoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_danmaku_layout);
ButterKnife.bind(this);
//使用自定义的全屏切换图片,!!!注意xml布局中也需要设置为一样的
//必须在setUp之前设置
danmakuVideoPlayer.setShrinkImageRes(R.drawable.custom_shrink);
danmakuVideoPlayer.setEnlargeImageRes(R.drawable.custom_enlarge);
String url = "http://baobab.wdjcdn.com/14564977406580.mp4";
//String url = "https://res.exexm.com/cw_145225549855002";
danmakuVideoPlayer.setUp(url, true, null, "测试视频");
//增加封面
ImageView imageView = new ImageView(this);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(R.mipmap.xxx1);
danmakuVideoPlayer.setThumbImageView(imageView);
resolveNormalVideoUI();
//外部辅助的旋转,帮助全屏
orientationUtils = new OrientationUtils(this, danmakuVideoPlayer);
//初始化不打开外部的旋转
orientationUtils.setEnable(false);
danmakuVideoPlayer.setIsTouchWiget(true);
//关闭自动旋转
danmakuVideoPlayer.setRotateViewAuto(false);
danmakuVideoPlayer.setLockLand(false);
danmakuVideoPlayer.setShowFullAnimation(false);
danmakuVideoPlayer.setNeedLockFull(true);
//detailPlayer.setOpenPreView(true);
danmakuVideoPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//直接横屏
orientationUtils.resolveByClick();
//第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar
danmakuVideoPlayer.startWindowFullscreen(DanmkuVideoActivity.this, true, true);
}
});
danmakuVideoPlayer.setStandardVideoAllCallBack(new SampleListener() {
@Override
public void onPrepared(String url, Object... objects) {
super.onPrepared(url, objects);
//开始播放了才能旋转和全屏
orientationUtils.setEnable(true);
isPlay = true;
}
@Override
public void onAutoComplete(String url, Object... objects) {
super.onAutoComplete(url, objects);
}
@Override
public void onClickStartError(String url, Object... objects) {
super.onClickStartError(url, objects);
}
@Override
public void onQuitFullscreen(String url, Object... objects) {
super.onQuitFullscreen(url, objects);
if (orientationUtils != null) {
orientationUtils.backToProtVideo();
}
}
});
danmakuVideoPlayer.setLockClickListener(new LockClickListener() {
@Override
public void onClick(View view, boolean lock) {
if (orientationUtils != null) {
//配合下方的onConfigurationChanged
orientationUtils.setEnable(!lock);
}
}
});
}
use of com.shuyu.gsyvideoplayer.listener.LockClickListener in project GSYVideoPlayer by CarGuo.
the class DetailListPlayer method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_deatil_list_player);
ButterKnife.bind(this);
//String url = "http://baobab.wd jcdn.com/14564977406580.mp4";
List<GSYVideoModel> urls = new ArrayList<>();
urls.add(new GSYVideoModel("http://baobab.wdjcdn.com/14564977406580.mp4", "标题1"));
urls.add(new GSYVideoModel("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4", "标题2"));
urls.add(new GSYVideoModel("http://baobab.wdjcdn.com/14564977406580.mp4", "标题3"));
urls.add(new GSYVideoModel("http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4", "标题4"));
detailPlayer.setUp(urls, true, 0, "");
//增加封面
ImageView imageView = new ImageView(this);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(R.mipmap.xxx1);
detailPlayer.setThumbImageView(imageView);
resolveNormalVideoUI();
//外部辅助的旋转,帮助全屏
orientationUtils = new OrientationUtils(this, detailPlayer);
//初始化不打开外部的旋转
orientationUtils.setEnable(false);
detailPlayer.setIsTouchWiget(true);
//关闭自动旋转
detailPlayer.setRotateViewAuto(false);
detailPlayer.setLockLand(false);
detailPlayer.setShowFullAnimation(false);
detailPlayer.setNeedLockFull(true);
detailPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//直接横屏
orientationUtils.resolveByClick();
//第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar
detailPlayer.startWindowFullscreen(DetailListPlayer.this, true, true);
}
});
detailPlayer.setStandardVideoAllCallBack(new SampleListener() {
@Override
public void onPrepared(String url, Object... objects) {
super.onPrepared(url, objects);
//开始播放了才能旋转和全屏
orientationUtils.setEnable(true);
isPlay = true;
}
@Override
public void onAutoComplete(String url, Object... objects) {
super.onAutoComplete(url, objects);
}
@Override
public void onClickStartError(String url, Object... objects) {
super.onClickStartError(url, objects);
}
@Override
public void onQuitFullscreen(String url, Object... objects) {
super.onQuitFullscreen(url, objects);
if (orientationUtils != null) {
orientationUtils.backToProtVideo();
}
}
});
detailPlayer.setLockClickListener(new LockClickListener() {
@Override
public void onClick(View view, boolean lock) {
if (orientationUtils != null) {
//配合下方的onConfigurationChanged
orientationUtils.setEnable(!lock);
}
}
});
}
use of com.shuyu.gsyvideoplayer.listener.LockClickListener in project GSYVideoPlayer by CarGuo.
the class WebDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_detail);
ButterKnife.bind(this);
String url = "http://baobab.wdjcdn.com/14564977406580.mp4";
//String url = "https://d131x7vzzf85jg.cloudfront.net/upload/documents/paper/b2/61/00/00/20160420_115018_b544.mp4";
webPlayer.setUp(url, true, null, "测试视频");
//增加封面
ImageView imageView = new ImageView(this);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(R.mipmap.xxx1);
webPlayer.setThumbImageView(imageView);
resolveNormalVideoUI();
//外部辅助的旋转,帮助全屏
orientationUtils = new OrientationUtils(this, webPlayer);
//初始化不打开外部的旋转
orientationUtils.setEnable(false);
webPlayer.setIsTouchWiget(true);
//关闭自动旋转
webPlayer.setRotateViewAuto(false);
webPlayer.setLockLand(false);
webPlayer.setShowFullAnimation(false);
webPlayer.setNeedLockFull(true);
//detailPlayer.setOpenPreView(true);
webPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//直接横屏
orientationUtils.resolveByClick();
//第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar
webPlayer.startWindowFullscreen(WebDetailActivity.this, true, true);
}
});
webPlayer.setStandardVideoAllCallBack(new SampleListener() {
@Override
public void onPrepared(String url, Object... objects) {
super.onPrepared(url, objects);
//开始播放了才能旋转和全屏
orientationUtils.setEnable(true);
isPlay = true;
}
@Override
public void onAutoComplete(String url, Object... objects) {
super.onAutoComplete(url, objects);
}
@Override
public void onClickStartError(String url, Object... objects) {
super.onClickStartError(url, objects);
}
@Override
public void onQuitFullscreen(String url, Object... objects) {
super.onQuitFullscreen(url, objects);
if (orientationUtils != null) {
orientationUtils.backToProtVideo();
}
}
});
webPlayer.setLockClickListener(new LockClickListener() {
@Override
public void onClick(View view, boolean lock) {
if (orientationUtils != null) {
//配合下方的onConfigurationChanged
orientationUtils.setEnable(!lock);
}
}
});
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
webView.loadUrl("https://www.baidu.com");
webTopLayout.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (!webPlayer.isIfCurrentIsFullscreen() && scrollY >= 0 && isPlay) {
if (scrollY > webPlayer.getHeight()) {
//如果是小窗口就不需要处理
if (!isSamll) {
isSamll = true;
int size = CommonUtil.dip2px(WebDetailActivity.this, 150);
webPlayer.showSmallVideo(new Point(size, size), true, true);
orientationUtils.setEnable(false);
}
} else {
if (isSamll) {
isSamll = false;
orientationUtils.setEnable(true);
//必须
webTopLayoutVideo.postDelayed(new Runnable() {
@Override
public void run() {
webPlayer.hideSmallVideo();
}
}, 50);
}
}
webTopLayoutVideo.setTranslationY((scrollY <= webTopLayoutVideo.getHeight()) ? -scrollY : -webTopLayoutVideo.getHeight());
}
}
});
}
use of com.shuyu.gsyvideoplayer.listener.LockClickListener in project GSYVideoPlayer by CarGuo.
the class DetailPlayer method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_player);
ButterKnife.bind(this);
String url = "http://baobab.wdjcdn.com/14564977406580.mp4";
//String url = "https://res.exexm.com/cw_145225549855002";
detailPlayer.setUp(url, true, null, "测试视频");
/*VideoOptionModel videoOptionModel =
new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 50);
List<VideoOptionModel> list = new ArrayList<>();
list.add(videoOptionModel);
GSYVideoManager.instance().setOptionModelList(list);*/
//增加封面
ImageView imageView = new ImageView(this);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(R.mipmap.xxx1);
detailPlayer.setThumbImageView(imageView);
resolveNormalVideoUI();
//外部辅助的旋转,帮助全屏
orientationUtils = new OrientationUtils(this, detailPlayer);
//初始化不打开外部的旋转
orientationUtils.setEnable(false);
detailPlayer.setIsTouchWiget(true);
//关闭自动旋转
detailPlayer.setRotateViewAuto(false);
detailPlayer.setLockLand(false);
detailPlayer.setShowFullAnimation(false);
detailPlayer.setNeedLockFull(true);
detailPlayer.setOpenPreView(true);
detailPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//直接横屏
orientationUtils.resolveByClick();
//第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar
detailPlayer.startWindowFullscreen(DetailPlayer.this, true, true);
}
});
detailPlayer.setStandardVideoAllCallBack(new SampleListener() {
@Override
public void onPrepared(String url, Object... objects) {
super.onPrepared(url, objects);
//开始播放了才能旋转和全屏
orientationUtils.setEnable(true);
isPlay = true;
}
@Override
public void onAutoComplete(String url, Object... objects) {
super.onAutoComplete(url, objects);
}
@Override
public void onClickStartError(String url, Object... objects) {
super.onClickStartError(url, objects);
}
@Override
public void onQuitFullscreen(String url, Object... objects) {
super.onQuitFullscreen(url, objects);
if (orientationUtils != null) {
orientationUtils.backToProtVideo();
}
}
});
detailPlayer.setLockClickListener(new LockClickListener() {
@Override
public void onClick(View view, boolean lock) {
if (orientationUtils != null) {
//配合下方的onConfigurationChanged
orientationUtils.setEnable(!lock);
}
}
});
}
Aggregations