From 5c89ae9c6680deeb3f79e81c3066e2ecef970acf Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 21 Feb 2022 21:57:12 +0100 Subject: [PATCH] Minor improvements --- ISSUE_TEMPLATE.md | 0 Model/Player/PlayerControlsModel.swift | 11 ++++++----- Model/Player/PlayerModel.swift | 3 +++ Shared/Player/Controls/PlayerControls.swift | 12 ++++-------- Shared/Player/MPV/MPVOGLView.swift | 6 +++--- Shared/Player/VideoPlayerView.swift | 1 + Yattee.xcodeproj/project.pbxproj | 14 +++++++------- 7 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 ISSUE_TEMPLATE.md diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..e69de29b diff --git a/Model/Player/PlayerControlsModel.swift b/Model/Player/PlayerControlsModel.swift index fcac2062..8a550eb7 100644 --- a/Model/Player/PlayerControlsModel.swift +++ b/Model/Player/PlayerControlsModel.swift @@ -52,8 +52,9 @@ final class PlayerControlsModel: ObservableObject { } func show() { + player.backend.updateControls() + withAnimation(PlayerControls.animation) { - player.backend.updateControls() presentingControls = true } } @@ -65,11 +66,11 @@ final class PlayerControlsModel: ObservableObject { } func toggle() { - withAnimation(PlayerControls.animation) { - if !presentingControls { - player.backend.updateControls() - } + if !presentingControls { + player.backend.updateControls() + } + withAnimation(PlayerControls.animation) { presentingControls.toggle() } } diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index 5e39ea2c..9da999c4 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -302,6 +302,9 @@ final class PlayerModel: ObservableObject { } private func handleNavigationViewPlayerPresentationChange() { + backend.setNeedsDrawing(playerNavigationLinkActive) + controls.hide() + if pauseOnHidingPlayer, !playingInPictureInPicture, !playerNavigationLinkActive { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { self.pause() diff --git a/Shared/Player/Controls/PlayerControls.swift b/Shared/Player/Controls/PlayerControls.swift index 162c5594..1721163d 100644 --- a/Shared/Player/Controls/PlayerControls.swift +++ b/Shared/Player/Controls/PlayerControls.swift @@ -2,7 +2,7 @@ import Foundation import SwiftUI struct PlayerControls: View { - static let animation = Animation.easeInOut(duration: 0) + static let animation = Animation.easeInOut(duration: 0.2) private var player: PlayerModel! @@ -60,12 +60,8 @@ struct PlayerControls: View { } var controlsBackground: some View { - model.presentingControls ? - AnyView( - PlayerGestures() - .background(Color.black.opacity(0.5)) - ) : - AnyView(Color.clear) + PlayerGestures() + .background(Color.black.opacity(model.presentingControls ? 0.5 : 0)) } var timeline: some View { @@ -145,7 +141,7 @@ struct PlayerControls: View { HStack { fullscreenButton Spacer() - button("Music Mode", systemImage: "music.note") +// button("Music Mode", systemImage: "music.note") } } diff --git a/Shared/Player/MPV/MPVOGLView.swift b/Shared/Player/MPV/MPVOGLView.swift index 1f5a866b..8fadf311 100644 --- a/Shared/Player/MPV/MPVOGLView.swift +++ b/Shared/Player/MPV/MPVOGLView.swift @@ -33,14 +33,14 @@ final class MPVOGLView: GLKView { glClear(UInt32(GL_COLOR_BUFFER_BIT)) } - override func draw(_: CGRect) { + override func draw(_ rect: CGRect) { glGetIntegerv(UInt32(GL_FRAMEBUFFER_BINDING), &defaultFBO!) if mpvGL != nil { var data = mpv_opengl_fbo( fbo: Int32(defaultFBO!), - w: Int32(bounds.size.width) * Int32(contentScaleFactor), - h: Int32(bounds.size.height) * Int32(contentScaleFactor), + w: Int32(rect.size.width) * Int32(contentScaleFactor), + h: Int32(rect.size.height) * Int32(contentScaleFactor), internal_format: 0 ) var flip: CInt = 1 diff --git a/Shared/Player/VideoPlayerView.swift b/Shared/Player/VideoPlayerView.swift index d8a967c1..5ceb9fe0 100644 --- a/Shared/Player/VideoPlayerView.swift +++ b/Shared/Player/VideoPlayerView.swift @@ -114,6 +114,7 @@ struct VideoPlayerView: View { Color.clear .onAppear { player.playerSize = proxy.size + // TODO move to backend method player.mpvBackend.client?.setSize(proxy.size.width, proxy.size.height) } .onChange(of: proxy.size) { _ in diff --git a/Yattee.xcodeproj/project.pbxproj b/Yattee.xcodeproj/project.pbxproj index cb794287..2edaafcd 100644 --- a/Yattee.xcodeproj/project.pbxproj +++ b/Yattee.xcodeproj/project.pbxproj @@ -3002,8 +3002,8 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 20; - DEVELOPMENT_TEAM = ""; + CURRENT_PROJECT_VERSION = 22; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; ENABLE_PREVIEWS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -3026,9 +3026,9 @@ "$(inherited)", "$(PROJECT_DIR)/Vendor/mpv/iOS/lib", ); - MARKETING_VERSION = 1.3.2; + MARKETING_VERSION = 1.4; OTHER_LDFLAGS = "-lstdc++"; - PRODUCT_BUNDLE_IDENTIFIER = stream.yattee.app; + PRODUCT_BUNDLE_IDENTIFIER = stream.yattee.app.alpha; PRODUCT_NAME = Yattee; SDKROOT = iphoneos; SWIFT_EMIT_LOC_STRINGS = YES; @@ -3044,7 +3044,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 19; + CURRENT_PROJECT_VERSION = 22; DEVELOPMENT_TEAM = 78Z5H3M6RJ; ENABLE_PREVIEWS = YES; GCC_PREPROCESSOR_DEFINITIONS = "GLES_SILENCE_DEPRECATION=1"; @@ -3064,9 +3064,9 @@ "$(inherited)", "$(PROJECT_DIR)/Vendor/mpv/iOS/lib", ); - MARKETING_VERSION = 1.3.2; + MARKETING_VERSION = 1.4; OTHER_LDFLAGS = "-lstdc++"; - PRODUCT_BUNDLE_IDENTIFIER = stream.yattee.app; + PRODUCT_BUNDLE_IDENTIFIER = stream.yattee.app.alpha; PRODUCT_NAME = Yattee; SDKROOT = iphoneos; SWIFT_EMIT_LOC_STRINGS = YES;