# Gsy Fullscreen Orientation

处理进入/退出全屏、屏幕旋转、竖屏视频自适应、系统旋转设置联动、反向横屏。

- Repository: https://github.com/CarGuo/GSYVideoPlayer (21524 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-10
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add CarGuo/GSYVideoPlayer --skill gsy-fullscreen-orientation -g -a claude-code -y`
Codex: `npx skills add CarGuo/GSYVideoPlayer --skill gsy-fullscreen-orientation -g -a codex -y`
Cursor: `npx skills add CarGuo/GSYVideoPlayer --skill gsy-fullscreen-orientation -g -a cursor -y`
Gemini CLI: `npx skills add CarGuo/GSYVideoPlayer --skill gsy-fullscreen-orientation -g -a gemini-cli -y`

## Description

处理进入/退出全屏、屏幕旋转、竖屏视频自适应、系统旋转设置联动、反向横屏。

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# gsy-fullscreen-orientation

## 概念

- **视觉全屏**：`player.startWindowFullscreen(context, hideActionBar, hideStatusBar)`，会用反射克隆一个同类 player 塞进 `android.R.id.content` 顶部，返回原实例。
- **屏幕方向**：`OrientationUtils` 监听 `OrientationEventListener` + `Settings.System.ACCELEROMETER_ROTATION`，负责旋转 Activity 方向。
- **两者可解耦**：只想旋转不切副本 → `setNeedOrientationUtils(false)` + 自建 `OrientationUtils`；只想切副本不旋转 → 不构造 `OrientationUtils`，`player` 保持默认 `setRotateViewAuto(false)`。

## 核心 API

| 类 / 方法 | 位置 | 说明 |
|---|---|---|
| `OrientationUtils(Activity, GSYBaseVideoPlayer)` | [OrientationUtils#L50-L52](../../gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/utils/OrientationUtils.java) | 主构造 |
| `OrientationUtils(Activity, player, OrientationOption)` | [OrientationUtils#L54-L64](../../gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/utils/OrientationUtils.java) | 支持自定义旋转角度阈值 |
| `setEnable(boolean)` | `OrientationUtils` | 使能/失能自动旋转 |
| `setRotateWithSystem(boolean)` | `OrientationUtils` | 是否跟随系统"旋转开关" |
| `setIsOnlyRotateLand(boolean)` | `OrientationUtils` | true 时仅在横屏方向变化时响应 |
| `resolveByClick()` | `OrientationUtils` | 用户点全屏按钮时手动触发一次旋转 |
| `backToProtVideo()` | `OrientationUtils` | 返回键触发时把方向复位竖屏 |
| `setIsPause(boolean)` | `OrientationUtils` | 生命周期 pause/resume 桥接 |
| `releaseListener()` | `OrientationUtils` | `onDestroy` 释放监听 |
| `startWindowFullscreen(Context, boolean, boolean)` | [GSYBaseVideoPlayer](../../gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/base/GSYBaseVideoPlayer.java) | 进入 window 全屏，返回克隆体 |
| `GSYVideoManager.backFromWindowFull(Context)` | [GSYVideoManager#L82-L94](../../gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoManager.java) | 返回键统一处理 |
| `GSYVideoManager.isFullState(Activity)` | [GSYVideoManager#L143-L151](../../gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoManager.java) | 当前是否全屏 |

## `OrientationOption` 参数

The rest: https://github.com/CarGuo/GSYVideoPlayer/blob/HEAD/skills/03-gsy-fullscreen-orientation/SKILL.md
