Skills

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 / GSYAnyVideoPlayerViewAndroidView 直接承载 StandardGSYVideoPlayer / 任意 NormalGSYVideoPlayer 子类,保留全部内置能力
Native(纯 Compose 控件)rememberGSYPlayerController + GSYPlayerSurface + GSYDefaultControls只承载画面,控制层完全用 Compose 自绘
通用工具LifecycleBridgeLifecycleEffect { event -> ... } 用于订阅宿主 Lifecycle

Wrapper API:GSYVideoPlayerView

见 GSYVideoPlayerView#L28-L36:

参数类型说明
modifierModifier通常 Modifier.fillMaxWidth().aspectRatio(16f/9)
setUp(StandardGSYVideoPlayer) -> Unit等价 GSYVideoOptionBuilder.build(player)
setUpKeyAny? = null非空时其变化会重新调用 setUp(典型:传 url)
autoReleaseOnDisposeBoolean = true离屏自动 player.release()
autoPauseResumeBoolean = true自动桥 Lifecycle:ON_PAUSE→GSYVideoManager.onPause()、ON_RESUME→onResume()
onPlayerCreated(StandardGSYVideoPlayer) -> Unit拿到 player 实例的回调

Wrapper API:GSYAnyVideoPlayerView<T : NormalGSYVideoPlayer>

Read the whole SKILL.md on GitHub

More in Engineering