Commit 16670e9
committed
refactor(compose): P2 hardening for compose lib
P2-1 Narrow GSYComposeHostPlayer API surface
- class and 3 constructors switched from public to package-private:
only GSYPlayerController / GSYPlayerSurface inside
com.shuyu.gsyvideoplayer.compose.native_ may use it.
- Drop the redundant getCurrentStatePublic() bridge: the parent
GSYVideoView already exposes public getCurrentState(). Controller
now reads player.currentState directly.
P2-2 Fix GSYPlayerSurface side-effect anti-pattern
- rememberGSYPlayerController used remember(...) { setUp(); url } as
its calculation lambda, mixing 'state computation' with a real I/O
side-effect that may fire on each recomposition.
- Replaced with LaunchedEffect(controller, url, ...) so it runs once
per key change, on a Main-bound coroutine, with proper cancellation
on dispose / key change.
P2-3 Fix GSYDefaultControls slider seek storm
- Old impl called controller.seekTo(...) on every onValueChange tick
while dragging, which thrashed the player and caused stutter.
- New impl keeps a local 'dragging: Float?' preview state:
onValueChange only updates preview, onValueChangeFinished commits
seekTo once. Time label and slider thumb both follow the preview
while dragging, then snap back to the real position on release.
P2-4 Drop dead config composeCompilerVersion
- Removed `composeCompilerVersion = "1.5.14"` from
gradle/dependencies.gradle. Since Kotlin 2.0+, compose-compiler is
bundled with Kotlin and driven by the
org.jetbrains.kotlin.plugin.compose Gradle plugin (already applied
in gsyVideoPlayer-compose/build.gradle), so the property was unused
and could mislead future maintainers.
P2-5 Fix consumerProguardFiles dangling reference
- gradle/lib.gradle declares consumerProguardFiles "consumer-rules.pro"
but the file did not exist for the compose module, causing a
silent skip of mergeReleaseConsumerProguardFiles and a 'Missing
consumer ProGuard file' warning for downstream R8/Proguard users.
- Added an empty (commented-only) consumer-rules.pro for the compose
module. Verified mergeReleaseConsumerProguardFiles now runs.
Verified locally:
- GetDiagnostics: 0 issues
- ./gradlew :gsyVideoPlayer-compose:assembleRelease :app:assembleDebug
BUILD SUCCESSFUL
- publishToMavenLocal default channel BUILD SUCCESSFUL
-> ~/.m2/.../com/shuyu/gsyvideoplayer-compose/13.0.0/
- publishToMavenLocal -PPUBLISH_TARGET=mavenCentral BUILD SUCCESSFUL
-> ~/.m2/.../io/github/carguo/gsyvideoplayer-compose/13.0.0/1 parent a0ec158 commit 16670e9
6 files changed
Lines changed: 57 additions & 18 deletions
File tree
- gradle
- gsyVideoPlayer-compose
- src/main/java/com/shuyu/gsyvideoplayer/compose/native_
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 7 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | | - | |
| 19 | + | |
17 | 20 | | |
18 | | - | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | | - | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 109 | | |
Lines changed: 30 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
| |||
107 | 114 | | |
108 | 115 | | |
109 | 116 | | |
110 | | - | |
| 117 | + | |
111 | 118 | | |
112 | 119 | | |
113 | | - | |
| 120 | + | |
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
| 126 | + | |
| 127 | + | |
119 | 128 | | |
120 | 129 | | |
121 | 130 | | |
| |||
131 | 140 | | |
132 | 141 | | |
133 | 142 | | |
134 | | - | |
135 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
136 | 151 | | |
137 | 152 | | |
138 | 153 | | |
| |||
155 | 170 | | |
156 | 171 | | |
157 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
28 | 35 | | |
29 | | - | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| |||
0 commit comments