处理bug
This commit is contained in:
@@ -135,9 +135,13 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) {
|
|||||||
|
|
||||||
[self kb_preparePermissionOverlayIfNeeded];
|
[self kb_preparePermissionOverlayIfNeeded];
|
||||||
BOOL show = needGuide;
|
BOOL show = needGuide;
|
||||||
// [UIView performWithoutAnimation:^{
|
// 同步控制引导页视频的播放/暂停:仅在显示时播放
|
||||||
self.permVC.view.hidden = !show;
|
self.permVC.view.hidden = !show;
|
||||||
// }];
|
if (show) {
|
||||||
|
[self.permVC kb_resumeGuideVideoIfNeeded];
|
||||||
|
} else {
|
||||||
|
[self.permVC kb_pauseGuideVideo];
|
||||||
|
}
|
||||||
|
|
||||||
// 若权限已满足(引导未显示),从设置返回时尝试让输入框成为第一响应者,
|
// 若权限已满足(引导未显示),从设置返回时尝试让输入框成为第一响应者,
|
||||||
// 以便立刻触发键盘挂载并检测是否为自家键盘/是否已开启完全访问
|
// 以便立刻触发键盘挂载并检测是否为自家键盘/是否已开启完全访问
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic, copy, nullable) void (^backHandler)(void);
|
@property (nonatomic, copy, nullable) void (^backHandler)(void);
|
||||||
@property (nonatomic, strong) UIButton *backButton; // 左上角返回
|
@property (nonatomic, strong) UIButton *backButton; // 左上角返回
|
||||||
|
|
||||||
|
/// 外部(如 KBGuideVC)根据引导页是否显示,控制视频播放/暂停
|
||||||
|
- (void)kb_resumeGuideVideoIfNeeded;
|
||||||
|
- (void)kb_pauseGuideVideo;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -108,8 +108,10 @@ static void *KBPermPlayerPresentationSizeContext = &KBPermPlayerPresentationSize
|
|||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
// 进入页面时自动开始播放
|
// 进入页面时自动开始播放;若当前被隐藏,则由外部显式控制
|
||||||
|
if (!self.view.hidden) {
|
||||||
[self kb_setupPermissionVideoPlayer];
|
[self kb_setupPermissionVideoPlayer];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidDisappear:(BOOL)animated {
|
- (void)viewDidDisappear:(BOOL)animated {
|
||||||
@@ -249,6 +251,15 @@ static void *KBPermPlayerPresentationSizeContext = &KBPermPlayerPresentationSize
|
|||||||
[self.kb_permPlayer play];
|
[self.kb_permPlayer play];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)kb_resumeGuideVideoIfNeeded {
|
||||||
|
// 若已初始化,则直接播放;否则按统一逻辑创建并播放
|
||||||
|
[self kb_setupPermissionVideoPlayer];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)kb_pauseGuideVideo {
|
||||||
|
[self.kb_permPlayer pause];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)kb_playerItemDidReachEnd:(NSNotification *)note {
|
- (void)kb_playerItemDidReachEnd:(NSNotification *)note {
|
||||||
AVPlayerItem *item = (AVPlayerItem *)note.object;
|
AVPlayerItem *item = (AVPlayerItem *)note.object;
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user