mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Minor fixes
This commit is contained in:
parent
748dd02034
commit
4f8ac1eadb
@ -268,15 +268,15 @@ final class MPVClient: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self, let model = self.backend.model else { return }
|
||||||
UIView.animate(withDuration: 0.2, animations: {
|
UIView.animate(withDuration: 0.2, animations: {
|
||||||
let aspectRatio = self.aspectRatio > 0 && self.aspectRatio < VideoPlayerView.defaultAspectRatio ? self.aspectRatio : VideoPlayerView.defaultAspectRatio
|
let aspectRatio = self.aspectRatio > 0 && self.aspectRatio < VideoPlayerView.defaultAspectRatio ? self.aspectRatio : VideoPlayerView.defaultAspectRatio
|
||||||
let height = [self.backend.model.playerSize.height, self.backend.model.playerSize.width / aspectRatio].min()!
|
let height = [model.playerSize.height, model.playerSize.width / aspectRatio].min()!
|
||||||
var insets = 0.0
|
var insets = 0.0
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
insets = OrientationTracker.shared.currentInterfaceOrientation.isPortrait ? SafeArea.insets.bottom : 0
|
insets = OrientationTracker.shared.currentInterfaceOrientation.isPortrait ? SafeArea.insets.bottom : 0
|
||||||
#endif
|
#endif
|
||||||
let offsetY = self.backend.model.playingFullScreen ? ((self.backend.model.playerSize.height / 2.0) - ((height + insets) / 2)) : 0
|
let offsetY = model.playingFullScreen ? ((model.playerSize.height / 2.0) - ((height + insets) / 2)) : 0
|
||||||
self.glView?.frame = CGRect(x: 0, y: offsetY, width: roundedWidth, height: height)
|
self.glView?.frame = CGRect(x: 0, y: offsetY, width: roundedWidth, height: height)
|
||||||
}) { completion in
|
}) { completion in
|
||||||
if completion {
|
if completion {
|
||||||
@ -296,7 +296,7 @@ final class MPVClient: ObservableObject {
|
|||||||
func setNeedsDrawing(_ needsDrawing: Bool) {
|
func setNeedsDrawing(_ needsDrawing: Bool) {
|
||||||
logger.info("needs drawing: \(needsDrawing)")
|
logger.info("needs drawing: \(needsDrawing)")
|
||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
glView.needsDrawing = needsDrawing
|
glView?.needsDrawing = needsDrawing
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +356,7 @@ final class MPVClient: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func setFlagAsync(_ name: String, _ flag: Bool) {
|
private func setFlagAsync(_ name: String, _ flag: Bool) {
|
||||||
|
guard mpv != nil else { return }
|
||||||
var data: Int = flag ? 1 : 0
|
var data: Int = flag ? 1 : 0
|
||||||
mpv_set_property_async(mpv, 0, name, MPV_FORMAT_FLAG, &data)
|
mpv_set_property_async(mpv, 0, name, MPV_FORMAT_FLAG, &data)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user