this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

android dont preload when autoplay disabled

Hailey af97cda8 6edd6745

+17 -7
+17 -7
android/src/main/java/expo/modules/blueskyvideo/BlueskyVideoView.kt
··· 38 38 var url: Uri? = null 39 39 var autoplay = false 40 40 var beginMuted = true 41 + var ignoreAutoplay = false 41 42 42 43 private var isFullscreen: Boolean = false 43 44 set(value) { ··· 143 144 private fun destroy() { 144 145 val player = this.player ?: return 145 146 147 + this.ignoreAutoplay = false 148 + 146 149 this.mute() 147 150 this.pause() 148 151 this.isLoading = true ··· 179 182 180 183 fun togglePlayback() { 181 184 if (this.isPlaying) { 182 - pause() 185 + this.pause() 183 186 } else { 184 - play() 187 + if (this.player == null) { 188 + this.ignoreAutoplay = true 189 + this.setup() 190 + } else { 191 + this.play() 192 + } 185 193 } 186 194 } 187 195 ··· 197 205 198 206 fun toggleMuted() { 199 207 if (this.isMuted) { 200 - unmute() 208 + this.unmute() 201 209 } else { 202 - mute() 210 + this.mute() 203 211 } 204 212 } 205 213 ··· 232 240 if (this.enteredFullscreenMuteState) { 233 241 this.mute() 234 242 } 235 - if (autoplay) { 243 + if (this.autoplay) { 236 244 this.play() 237 245 } else { 238 246 this.pause() ··· 249 257 250 258 this.isViewActive = isActive 251 259 if (isActive) { 252 - this.setup() 260 + if (this.autoplay) { 261 + this.setup() 262 + } 253 263 } else { 254 264 this.destroy() 255 265 } ··· 307 317 when (playbackState) { 308 318 ExoPlayer.STATE_READY -> { 309 319 val view = this@BlueskyVideoView 310 - if (view.autoplay) { 320 + if (view.autoplay || view.ignoreAutoplay) { 311 321 view.isLoading = false 312 322 view.play() 313 323 }