Skip to content

Commit 3137e45

Browse files
committed
update support isNeedRotateWithSystem with Detail
1 parent 9368430 commit 3137e45

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,10 @@ public void onPrepared(String url, Object... objects) {
149149
Debuger.printfError("***** onPrepared **** " + objects[1]);
150150
super.onPrepared(url, objects);
151151
//开始播放了才能旋转和全屏
152-
orientationUtils.setEnable(true);
152+
orientationUtils.setEnable(needRotateSystem());
153153
isPlay = true;
154154

155+
155156
//设置 seek 的临近帧。
156157
if (detailPlayer.getGSYVideoManager().getPlayer() instanceof Exo2PlayerManager) {
157158
((Exo2PlayerManager) detailPlayer.getGSYVideoManager().getPlayer()).setSeekParameter(SeekParameters.NEXT_SYNC);
@@ -270,7 +271,7 @@ public void onConfigurationChanged(Configuration newConfig) {
270271
super.onConfigurationChanged(newConfig);
271272
//如果旋转了就全屏
272273
if (isPlay && !isPause) {
273-
detailPlayer.onConfigurationChanged(this, newConfig, orientationUtils, true, true);
274+
detailPlayer.onConfigurationChanged(this, newConfig, needRotateSystem() ? orientationUtils : null, true, true);
274275
}
275276
}
276277

@@ -323,7 +324,8 @@ private String getUrl() {
323324
//String url = "http://video1.dgtle.com/backend%2F2020%2F3%2F0%2F%E6%88%91%E6%B2%A1%E6%9C%89%E7%BB%99%E4%B8%80%E5%8A%A08Pro%E5%81%9A%E8%AF%84%E6%B5%8B_%E5%8D%B4%E5%B8%A6%E7%9D%80%E5%AE%83%E6%BC%82%E6%B5%81.mp4_1080.mp4";
324325
//String url = "http://yongtaizx.xyz/20191230/t2Axgh3k/index.m3u8";
325326
//String url = "http://123.56.109.212:8035/users/bfe52074fba74247853caa764b522731/films/orig/aa4c3451-0468-452a-a189-bd064a1963e5-鹿鼎记下.mp4";
326-
String url = "https://pointshow.oss-cn-hangzhou.aliyuncs.com/McTk51586843620689.mp4";
327+
//String url = "http://static.hnyequ.cn/yequ_iOS/4940735da1227890e6a261937223e0d2_828x1472.mp4";
328+
String url = "https://tx.hls.huya.com/src/78941969-2579769454-11080025436149776384-3144993630-10057-A-0-1-imgplus_2000.m3u8?wsSecret=3e6b5903368d02d0c591a57a07940cca&wsTime=5f4ca52f&u=0&seqid=15987721445850596&ctype=tars_mobile&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*&t=103";
327329
//String url = "http://pointshow.oss-cn-hangzhou.aliyuncs.com/transcode/ORIGINAL/Mnbc61586842828593.mp4";
328330
//ssl error
329331
//String url = "https://file.shftz.cn:8443/filesystem/download/10/2019/3/26/ce2c7c66-e9eb-42be-adf6-f9008385ea8c.mov/play";
@@ -389,4 +391,8 @@ protected void fileSearch() {
389391
intent.setType("video/*");
390392
startActivityForResult(intent, READ_REQUEST_CODE);
391393
}
394+
395+
private boolean needRotateSystem() {
396+
return false;
397+
}
392398
}

gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/GSYBaseADActivityDetail.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ protected void onDestroy() {
137137
public void onConfigurationChanged(Configuration newConfig) {
138138
//如果旋转了就全屏
139139
boolean backUpIsPlay = isPlay;
140-
if (!isPause && getGSYADVideoPlayer().getVisibility() == View.VISIBLE && isNeedRotateWithSystem()) {
140+
if (!isPause && getGSYADVideoPlayer().getVisibility() == View.VISIBLE) {
141141
if (isADStarted()) {
142142
isPlay = false;
143-
getGSYADVideoPlayer().getCurrentPlayer().onConfigurationChanged(this, newConfig, mADOrientationUtils, hideActionBarWhenFull(), hideStatusBarWhenFull());
143+
getGSYADVideoPlayer().getCurrentPlayer().onConfigurationChanged(this, newConfig, isNeedRotateWithSystem() ? mADOrientationUtils : null, hideActionBarWhenFull(), hideStatusBarWhenFull());
144144
}
145145
}
146146
super.onConfigurationChanged(newConfig);

gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/GSYBaseActivityDetail.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ protected void onDestroy() {
118118
public void onConfigurationChanged(Configuration newConfig) {
119119
super.onConfigurationChanged(newConfig);
120120
//如果旋转了就全屏
121-
if (isPlay && !isPause && isNeedRotateWithSystem()) {
122-
getGSYVideoPlayer().onConfigurationChanged(this, newConfig, orientationUtils, hideActionBarWhenFull(), hideStatusBarWhenFull());
121+
if (isPlay && !isPause) {
122+
getGSYVideoPlayer().onConfigurationChanged(this, newConfig, isNeedRotateWithSystem() ? orientationUtils : null, hideActionBarWhenFull(), hideStatusBarWhenFull());
123123
}
124124
}
125125

0 commit comments

Comments
 (0)