mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Add basic PiP support
This commit is contained in:
@@ -23,6 +23,8 @@ final class PlayerState: ObservableObject {
|
||||
let maxResolution: Stream.Resolution?
|
||||
var timeObserver: Any?
|
||||
|
||||
var playingOutsideViewController = false
|
||||
|
||||
init(_ video: Video? = nil, maxResolution: Stream.Resolution? = nil) {
|
||||
self.video = video
|
||||
self.maxResolution = maxResolution
|
||||
@@ -222,6 +224,11 @@ final class PlayerState: ObservableObject {
|
||||
fileprivate func destroyPlayer() {
|
||||
logger.critical("destroying player")
|
||||
|
||||
guard !playingOutsideViewController else {
|
||||
logger.critical("cannot destroy, playing outside view controller")
|
||||
return
|
||||
}
|
||||
|
||||
player?.currentItem?.tracks.forEach { $0.assetTrack?.asset?.cancelLoading() }
|
||||
|
||||
player?.replaceCurrentItem(with: nil)
|
||||
|
Reference in New Issue
Block a user