android player

smoother

basic caching

prep cache

somewhat works

backup

other files

android impl

blegh

lets go

touchup

add prefetch to js

use caching
This commit is contained in:
Hailey
2024-04-18 03:25:24 -07:00
parent 4cb5f8a005
commit faae20939e
13 changed files with 443 additions and 99 deletions
@@ -1,8 +1,15 @@
import ExpoModulesCore
public class ExpoBlueskyVideoPlayerView: ExpoView, AVPlayerViewControllerDelegate {
public var source: String? = nil
public var isPlaying: Bool = true
public var source: String? = nil {
didSet {
if self.controller != nil, let source = source {
self.controller?.initForView(source, view: self)
}
}
}
public var isPlaying = true
public var autoplay = true
private var controller: PlayerController? = nil
@@ -25,12 +32,11 @@ public class ExpoBlueskyVideoPlayerView: ExpoView, AVPlayerViewControllerDelegat
return
}
if let controller = PlayerControllerManager.shared.getPlayer() {
controller.setFrame(rect: bounds)
controller.initForView(source, view: self)
self.addSubview(controller.view)
self.controller = controller
}
let controller = PlayerControllerManager.shared.getController()
controller.setFrame(rect: bounds)
controller.initForView(source, view: self)
self.addSubview(controller.view)
self.controller = controller
} else {
self.controller?.release()
}
@@ -45,4 +51,12 @@ public class ExpoBlueskyVideoPlayerView: ExpoView, AVPlayerViewControllerDelegat
self.isPlaying = false
self.controller?.pause()
}
func toggle() {
if self.isPlaying {
self.pause()
} else {
self.play()
}
}
}