fix(pip): 支持系统小窗内进入画中画并修复相关播放与布局问题#100
Merged
Merged
Conversation
配合 floating 插件的修复:系统自由小窗(底部上滑挂起)内点画中画,此前会导致回到应用后页面永久停留在画中画布局(视频居中 + 上下大面积黑边,播控被状态栏遮挡),切视频也不恢复。插件侧现在小窗态改为"退后台收起小窗后显式`startPiP()`"真正拉起画中画;本侧配套: - `PageUtils.enterPip` / `PlPlayerController.enterPip` 返回 `Future<PiPStatus>` - 视频页与直播页的画中画按钮在鸿蒙上收到 `PiPStatus.unavailable`(插件被窗管拒绝时的兜底路径)时弹 toast "当前处于系统小窗,无法进入画中画" - 生命周期处理:画中画中收到 paused(进入 PiP 时退后台所致,视频仍可见)不再暂停播放器,根治未开后台播放时 PiP 以暂停态起播 / 暂停-续播闪动;PiP 关闭且留在后台时插件先推 isPipMode=false 再补发 paused,仍正常暂停 - 画中画内自动续播:未开后台播放时,系统在进入画中画的退后台过程中会直接把 mpv 置为暂停(插桩证实应用层无任何 pause 调用,武装 auto-start 亦无效),普通 play() 即可恢复。新增 `_pauseRequestedByApp` 区分应用主动暂停与系统静默暂停,在 stream.playing 监听与生命周期回调两处检测并自动续播(10 秒窗口内最多 3 次,防止与系统拉锯) - 修复画中画期间从智慧多窗应用栏以小窗打开 app 时页面滞留在画中画布局(黑边+播控被状态栏遮挡):isPipMode 是普通 bool,PiP 结束时若无视口变化则无重建时机。新增 `pipModeRx`(由 floating 新 API `onPipModeChanged`驱动),视频页与直播页监听它 setState 强制重建 依赖 floating 插件 harmony 分支的系统小窗 `startPiP` 直启支持与 `onPipModeChanged` 回调(需先合并对应 PR 并升级 pubspec 中的 floating ref)。
指向 qinshah/floating harmony 分支合并小窗画中画修复后的最新提交(cd53ec3):系统小窗内"退后台 + 显式 startPiP"直启、手动 enable 不再急切设置 isPipMode(交由 onPipChanged 推送确认)、新增 onPipModeChanged回调、stopPiP 被拒时的会话自愈。本分支的画中画修复依赖上述插件能力。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
在系统小窗(屏幕底部上滑挂起的自由窗口)内点击画中画按钮,画中画不会启动,且回到应用后页面永久停留在画中画布局(视频居中 + 上下大面积黑边,播控组件被状态栏遮挡无法点击),切换视频也不恢复。此外还存在两个关联问题:
前置依赖
配合 qinshah/floating 已合并的小窗画中画修复(系统小窗内"退后台 + 显式
startPiP()"直启、手动 enable 不再急切设置isPipMode、新增onPipModeChanged回调、stopPiP被拒自愈)。本 PR 已包含 pubspec 中 floating ref 的升级。修改
enterPip链路(PageUtils/PlPlayerController)返回Future<PiPStatus>;视频页与直播页的画中画按钮在插件被窗管拒绝(兜底路径)时弹 toast 提示isPipMode=false再补发paused,"无后台播放则后台静音"的语义不受影响_pauseRequestedByApp区分应用主动暂停与系统静默暂停,检测到后者时自动play()恢复(10 秒窗口内最多 3 次,防止与系统拉锯);用户在画中画面板手动暂停不受影响pipModeRx(由 floating 新回调onPipModeChanged驱动),视频页与直播页监听其翻转强制重建,修复PiP 结束时无视口变化则页面滞留画中画布局的问题