Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

播放器:退出全屏后再次进入全屏时,画面中央误弹「全屏播放」浮钮,点击后直接退回竖屏

Open Beginner friendly
#35 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, kotlin
Domain
frontend, mobile

Research direction

Start in PlayerControlsOverlay.kt at the floating button visibility condition around line 782; the issue identifies the missing fullscreen state check. Add the reported condition and review the surrounding control logic. Done means the button appears only in portrait windowed playback of a landscape video, and the issue’s repeat-entry steps no longer show it or return playback to portrait when tapped.

Written by the indexing model from the issue text.

Description

环境

  • 设备:红米note12tpro android12
  • 系统自动旋转:开启
  • Piko 版本:1.3
  • 来源:GitHub Release(APK)

复现步骤

  1. 竖屏状态下打开一个横版视频(正常进入竖屏播放页)
  2. 点右下角全屏按钮 → 正常横屏全屏(第一次没有问题)
  3. 退出全屏,回到竖屏播放页
  4. 再次点右下角全屏按钮进入全屏
  • 叠加条件(更容易触发):在第 3、4 步之间手动把手机横过来再转回竖屏一次
  1. 画面中央弹出「全屏播放」浮钮(此时已经在全屏中,不该出现)
  2. 点击该浮钮 → 播放器退回竖屏,行为与按钮文案完全相反

期望行为

已处于全屏状态时,「全屏播放」浮钮不应出现;它只应在"竖屏窗口 + 横版视频 + 未全屏"时作为快捷入口。

原因分析(供参考)

全屏有两套独立的状态来源,浮钮只参考了其中一套:

  • MediampVideoPlayerScreen.kt:127 用 rememberSaveable 维护 isFullscreen,:131-138 的 enter/exitFullscreen 通过 requestedOrientation = SENSOR_LANDSCAPE / resetOrientation() 控制方向;
  • PlayerControlsOverlay.kt:201 的 isLandscape 来自 LocalWindowInfo.current.containerSize 的实时测量(:197),与 isFullscreen 无关联。

浮钮的可见条件在 PlayerControlsOverlay.kt:782:

visible = !isLocked && !isLandscape && isLandscapeVideo == true && errorMessage == null && !isEditingCropRegion

其中没有检查 !isFullscreen(该参数在 :158 已经存在并传入)。第二次进入全屏时,窗口尺寸的更新滞后或方向未随 SENSOR_LANDSCAPE 立即翻转(横屏有左右两种朝向、退出全屏后方向已交还传感器),!isLandscape 短暂甚至持续成立,浮钮便在全屏画面上误弹。此时点击它走的是同一个切换入口(MediampVideoPlayerScreen.kt:461):isFullscreen == true → 执行 exitFullscreen → 退回竖屏。

PlayerControlsOverlay.kt:121-122 的注释写明「[isLandscapeVideo] 决定竖屏时是否给出全屏入口」,但该入口显然也应排除已全屏的情形。

修复建议

在 PlayerControlsOverlay.kt:782 的 visible 条件里补上 !isFullscreen:

visible = !isFullscreen && !isLocked && !isLandscape && isLandscapeVideo == true && errorMessage == null && !isEditingCropRegion

一行即可消除误弹与点击后的语义反转。顺带可以考虑:既然 Issue #30 之后全屏已由 isFullscreen 显式表达,浮钮条件里以 isFullscreen 为准比依赖窗口实测尺寸更稳(实测尺寸在旋转过渡期与传感器朝向歧义时不可靠)。

备注

问题只在第二次及以后进入全屏时出现,第一次全屏方向链路干净,两个状态源同步,故不复现。

Dominant language
Kotlin
Stars
305
Forks
3
Avg merge
9m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NihilDigit/piko

All issues in NihilDigit/piko

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.