
Gsy Compose Integration
在 Jetpack Compose 中通过 AndroidView 桥接 GSYVideoPlayer,覆盖列表、竖直短视频、生命周期管控。
Install
npx skills add CarGuo/GSYVideoPlayer --skill gsy-compose-integration -g -a claude-code -y- Repository
- CarGuo/GSYVideoPlayer21.5k
- Category
- Engineering
- Updated
- 26d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 2,150 tokens
- Runs scripts
- No, instructions only
What it does
在 Jetpack Compose 中通过 AndroidView 桥接 GSYVideoPlayer,覆盖列表、竖直短视频、生命周期管控。
gsy-compose-integration
模块
gsyVideoPlayer-compose 是 Compose 桥接层,两种模式并存:
| 模式 | 入口 | 说明 |
|---|---|---|
| Wrapper(推荐上手) | GSYVideoPlayerView / GSYAnyVideoPlayerView | AndroidView 直接承载 StandardGSYVideoPlayer / 任意 NormalGSYVideoPlayer 子类,保留全部内置能力 |
| Native(纯 Compose 控件) | rememberGSYPlayerController + GSYPlayerSurface + GSYDefaultControls | 只承载画面,控制层完全用 Compose 自绘 |
| 通用工具 | LifecycleBridge | LifecycleEffect { event -> ... } 用于订阅宿主 Lifecycle |
Wrapper API:GSYVideoPlayerView
| 参数 | 类型 | 说明 |
|---|---|---|
modifier | Modifier | 通常 Modifier.fillMaxWidth().aspectRatio(16f/9) |
setUp | (StandardGSYVideoPlayer) -> Unit | 等价 GSYVideoOptionBuilder.build(player) |
setUpKey | Any? = null | 非空时其变化会重新调用 setUp(典型:传 url) |
autoReleaseOnDispose | Boolean = true | 离屏自动 player.release() |
autoPauseResume | Boolean = true | 自动桥 Lifecycle:ON_PAUSE→GSYVideoManager.onPause()、ON_RESUME→onResume() |
onPlayerCreated | (StandardGSYVideoPlayer) -> Unit | 拿到 player 实例的回调 |
