Player overlaying other views and swipe gesture (fix #44, #130)

This commit is contained in:
Arkadiusz Fal
2022-05-28 23:41:23 +02:00
parent 687949fbd5
commit 78d7693128
17 changed files with 187 additions and 209 deletions

View File

@@ -1,5 +1,6 @@
import AVFAudio
import CoreMedia
import Defaults
import Foundation
import Logging
import SwiftUI
@@ -247,7 +248,13 @@ final class MPVBackend: PlayerBackend {
client?.stop()
}
func enterFullScreen() {}
func enterFullScreen() {
model.toggleFullscreen(controls?.playingFullscreen ?? false)
if Defaults[.lockLandscapeWhenEnteringFullscreen] {
Orientation.lockOrientation(.landscape, andRotateTo: UIDevice.current.orientation.isLandscape ? nil : .landscapeRight)
}
}
func exitFullScreen() {}

View File

@@ -134,11 +134,11 @@ final class MPVClient: ObservableObject {
}
var currentTime: CMTime {
CMTime.secondsInDefaultTimescale(getDouble("time-pos"))
CMTime.secondsInDefaultTimescale(mpv.isNil ? -1 : getDouble("time-pos"))
}
var duration: CMTime {
CMTime.secondsInDefaultTimescale(getDouble("duration"))
CMTime.secondsInDefaultTimescale(mpv.isNil ? -1 : getDouble("duration"))
}
func seek(relative time: CMTime, completionHandler: ((Bool) -> Void)? = nil) {