this repo has no description
0
fork

Configure Feed

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

don't preload when autoplay is disabled, ios

Hailey b8c8a99e 81d1a4f7

+17 -4
+17 -4
ios/VideoView.swift
··· 66 66 private let onError = EventDispatcher() 67 67 68 68 private var enteredFullScreenMuted = true 69 + private var ignoreAutoplay = false 69 70 70 71 required init(appContext: AppContext? = nil) { 71 72 self.pViewController = AVPlayerViewController() ··· 122 123 guard let player = self.player else { 123 124 return 124 125 } 126 + 127 + self.ignoreAutoplay = false 125 128 126 129 // Fire final events 127 130 self.mute() ··· 192 195 if keyPath == "status" { 193 196 if playerItem.status == AVPlayerItem.Status.readyToPlay { 194 197 self.isLoading = false 195 - if self.autoplay { 198 + if self.autoplay || self.ignoreAutoplay { 196 199 self.play() 197 200 } 198 201 } ··· 240 243 willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator) { 241 244 coordinator.animate(alongsideTransition: nil) { _ in 242 245 self.isFullscreen = false 243 - self.mute() 246 + if self.enteredFullScreenMuted { 247 + self.mute() 248 + } 244 249 self.play() 245 250 } 246 251 } ··· 254 259 255 260 self.isViewActive = active 256 261 if active { 257 - self.setup() 262 + if autoplay { 263 + self.setup() 264 + } 258 265 } else { 259 266 self.destroy() 260 267 } ··· 277 284 if self.isPlaying { 278 285 self.pause() 279 286 } else { 280 - self.play() 287 + if self.player == nil { 288 + self.ignoreAutoplay = true 289 + self.setup() 290 + } else { 291 + self.play() 292 + } 281 293 } 282 294 } 283 295 ··· 316 328 317 329 if pViewController.responds(to: selectorToForceFullScreenMode) { 318 330 pViewController.perform(selectorToForceFullScreenMode, with: true, with: nil) 331 + self.enteredFullScreenMuted = self.player?.isMuted ?? true 319 332 self.unmute() 320 333 self.isFullscreen = true 321 334 }