ios player

autoplay after recycle

remove all items from AVPlayer queue

recurururururursion

use managers in the view

add prefetch

make sure player items stay in order

add controller and item managers

start of the view

create module, ios
This commit is contained in:
Hailey
2024-04-17 17:59:34 -07:00
parent 7e16276c04
commit 4cb5f8a005
13 changed files with 385 additions and 0 deletions
@@ -0,0 +1,48 @@
import ExpoModulesCore
public class ExpoBlueskyVideoPlayerView: ExpoView, AVPlayerViewControllerDelegate {
public var source: String? = nil
public var isPlaying: Bool = true
private var controller: PlayerController? = nil
public override var bounds: CGRect {
didSet {
if let controller = controller {
controller.setFrame(rect: bounds)
}
}
}
public required init(appContext: AppContext? = nil) {
super.init(appContext: appContext)
self.clipsToBounds = true
}
public override func willMove(toWindow newWindow: UIWindow?) {
if newWindow != nil {
guard let source = self.source else {
return
}
if let controller = PlayerControllerManager.shared.getPlayer() {
controller.setFrame(rect: bounds)
controller.initForView(source, view: self)
self.addSubview(controller.view)
self.controller = controller
}
} else {
self.controller?.release()
}
}
func play() {
self.isPlaying = true
self.controller?.play()
}
func pause() {
self.isPlaying = false
self.controller?.pause()
}
}