Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 16.0 横竖屏切换UI错乱 #532

Closed
kingstal opened this issue Jun 23, 2022 · 25 comments
Closed

iOS 16.0 横竖屏切换UI错乱 #532

kingstal opened this issue Jun 23, 2022 · 25 comments
Labels

Comments

@kingstal
Copy link

kingstal commented Jun 23, 2022

必现/偶发?
必现

描述bug
在iOS 16.0上切换横屏导致UI错乱

Demo中是否存在同样的问题?

你期望的结果是什么?
UI正确展示

运行环境

  • iPhone 12 mini
  • iOS 16
  • Xcode 13.4.1
  • Objective-C

截图

Demo测试情况如下

  • iOS 16.0 iPhone 12 mini 横屏:UI显示不正确

1

  • iOS 15.5 iPhone 12 pro 横屏:UI显示正确

2

@kingstal kingstal added the bug label Jun 23, 2022
@619455272
Copy link

是的,我也有这个问题

@LiuDeng
Copy link

LiuDeng commented Jul 9, 2022

@changsanjiang 问题+1

@changsanjiang
Copy link
Owner

这几天会有更新, 等测试完成后发布

@LiuDeng
Copy link

LiuDeng commented Jul 11, 2022

@changsanjiang 大佬,可以新建一个分支把代码传一下,我们也测试一下哈,谢谢~ 祝好~

@changsanjiang
Copy link
Owner

已上传 v3.4.0

@changsanjiang changsanjiang pinned this issue Jul 11, 2022
@kingstal
Copy link
Author

RPReplay_Final1657787544.mov

@changsanjiang 你好,发现全屏播放后退到后台,再回前台的时候播放的那个window不见了

@changsanjiang
Copy link
Owner

ok, 正在修复中

@kingstal
Copy link
Author

image

@changsanjiang iOS16 横屏以后,视频播放window没有设置为keyWindow

@changsanjiang
Copy link
Owner

changsanjiang commented Jul 15, 2022

keyWindow 的设置取消了; 新版的 Rotation_4 里面也把老模块的旋转 keyWindow的设置取消了;

@changsanjiang
Copy link
Owner

changsanjiang commented Jul 15, 2022

现在播放器不会修改 keywindow 了

@kingstal
Copy link
Author

kingstal commented Jul 28, 2022

@changsanjiang iOS16 beta4 横屏的时候,对应的视频窗口没有切换

@changsanjiang
Copy link
Owner

changsanjiang commented Aug 14, 2022

@kingstal 已修复旋转(BasePlayer v3.7.3); 需要注意: 新版本恢复了原来设置 keyWindow 的操作了, 也就是 全屏后, 全屏window 会成为 keyWindow 了;

@hstdt
Copy link

hstdt commented Sep 9, 2022

@changsanjiang 目前我们app要部分页面横屏,Device Orientation不能按照指南说的固定为portrait。导致一旦出现SJRotationFullscreenWindow导航栏就可能会和TabbarController的方向不一致。能代码配置SJRotationFullscreenWindow的方向么。

是一个仅iOS 16的问题,iOS 15通过配置TabbarController的shouldAutorotatesupportedInterfaceOrientations能搞定,但是在iOS 16中shouldAutorotate不会被调用。

@changsanjiang
Copy link
Owner

@hstdt 来个demo看看, 我看看你那边咋处理的

@hstdt
Copy link

hstdt commented Sep 13, 2022

@changsanjiang demo已传

SJVideoPlayerRotation.zip

iOS 16初始化SJVideoPlayer后,旋转手机的效果

RPReplay_Final1663057662.MP4

以及其中还有一个SJVideoPlayer强制要求AppDelegate含有window属性导致的闪退bug

是否可以考虑让SJRotationFullscreenWindow不要出现的太早,以及实时销毁?

@changsanjiang
Copy link
Owner

@hstdt 好的, 我查看一下

@changsanjiang
Copy link
Owner

changsanjiang commented Sep 15, 2022

@hstdt 尝试在 AppDelegate 配置一下这个:

import SJBaseVideoPlayer

    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
        if #available(iOS 16.0, *) {
            return window is SJRotationFullscreenWindow ? SJRotationManager.supportedInterfaceOrientations(for: window) : .all
        } else {
            return .all
        }
    }

@hstdt
Copy link

hstdt commented Sep 15, 2022

@changsanjiang 非常感谢,application(_:supportedInterfaceOrientationsFor:)这个方法能够固定住状态栏了。

发现有一个新的问题,用这个方案从iOS 16从横屏转回竖屏的时候,UITableView发生位移(一个表现是viewWillTransition被触发,但是不能完全确认联系),最终导致Player停止播放。

SJVideoPlayerRotationV2.zip

注释掉下面两行代码就可以让UITableView不发生移动(已在实际项目中确认,同时viewWillTransition不会触发),但是就会无法隐藏Window

CleanShot 2022-09-15 at 20 39 51

目前只有一个思路,不知道是否可以先把Window转成竖屏,再隐藏Window避免系统认为发生了旋转。

--- 更新一些尝试

  1. 设置window.alpha = 0不会触发viewWillTransition,同时可以让后面的window可点击
  2. 不知道新接口requestGeometryUpdateWithPreferences是否可以用在这个场景中

@hstdt
Copy link

hstdt commented Sep 16, 2022

@changsanjiang 修改了一下SJRotationManager_iOS_16_Later.m的源码,demo工程中的旋转就比较完美了,但是不知道是否会造成其他问题

CleanShot 2022-09-16 at 12 16 40

SJVideoPlayerRotationV3.zip

RPReplay_Final1663302323.MP4

补充: 第80行[self.window setHidden:NO];可以去掉,多余的代码

@changsanjiang
Copy link
Owner

@hstdt 源码暂时先不动😄, 你试试这个 playerDemo.zip, 看看符不符合你那边的需求

@hstdt
Copy link

hstdt commented Sep 16, 2022

@changsanjiang 主要是会导致UITableView产生offset位移(就是上面代码注释掉的两行),在demo中不一定必现,需要拖到一定的位置上(大概在2/5的屏幕位置)。但是在我的项目中几乎必现。

playerV2.zip

2022-09-16.14.44.03.mp4

@hstdt
Copy link

hstdt commented Sep 16, 2022

@changsanjiang 另外发现一个竖屏视频的bug(iOS 16及以下都存在)

竖屏视频,横过来的时候,点击右下角的退出全屏按钮,会触发assert而闪退。

是这段代码把usesFitOnScreen置为true导致的
CleanShot 2022-09-16 at 16 09 42

bug.mp4

playerV3.zip

@changsanjiang
Copy link
Owner

@hstdt window和usesFitOnScreen的问题, 在版本 3.4.2.1 上修复了;

我们开一个新的 issuse 吧, 不太适合在当前 issue 讨论了

@changsanjiang
Copy link
Owner

@hstdt playerDemo2.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants