From 8293450ecf0df905573a6cbad2a24372d338295d Mon Sep 17 00:00:00 2001 From: WindowsMEMZ Date: Wed, 21 Aug 2024 03:36:06 +0800 Subject: [PATCH] opt: Optimized Video Player --- MeowBili/Bangumi/BangumiPlayerView.swift | 1 + MeowBili/Live/LivePlayerView.swift | 1 + MeowBili/Video/VideoDownloadView.swift | 4 ++++ MeowBili/Video/VideoPlayerView.swift | 1 + 4 files changed, 7 insertions(+) diff --git a/MeowBili/Bangumi/BangumiPlayerView.swift b/MeowBili/Bangumi/BangumiPlayerView.swift index 3b9f91c81..ba374fc7f 100644 --- a/MeowBili/Bangumi/BangumiPlayerView.swift +++ b/MeowBili/Bangumi/BangumiPlayerView.swift @@ -73,6 +73,7 @@ struct BangumiPlayerView: View { .ignoresSafeArea() .navigationBarHidden(true) .tag(1) + ._statusBarHidden(true) .onAppear { hideDigitalTime(true) Timer.scheduledTimer(withTimeInterval: 15, repeats: true) { timer in diff --git a/MeowBili/Live/LivePlayerView.swift b/MeowBili/Live/LivePlayerView.swift index cb86a4c0c..7a9edbd67 100644 --- a/MeowBili/Live/LivePlayerView.swift +++ b/MeowBili/Live/LivePlayerView.swift @@ -30,6 +30,7 @@ struct LivePlayerView: View { VideoPlayer(player: livePlayer) #if os(watchOS) .ignoresSafeArea() + ._statusBarHidden(true) #endif .onAppear { let asset = AVURLAsset(url: URL(string: LiveDetailView.willPlayStreamUrl)!, options: ["AVURLAssetHTTPHeaderFieldsKey": ["User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15", "Referer": "https://www.bilibili.com"]]) diff --git a/MeowBili/Video/VideoDownloadView.swift b/MeowBili/Video/VideoDownloadView.swift index 527667856..88fe2b733 100644 --- a/MeowBili/Video/VideoDownloadView.swift +++ b/MeowBili/Video/VideoDownloadView.swift @@ -17,6 +17,7 @@ //===----------------------------------------------------------------------===// import SwiftUI +import Dynamic import DarockKit import Alamofire @@ -126,6 +127,9 @@ struct VideoDownloadView: View { } } } + #if os(watchOS) + Dynamic.PUICApplication.sharedPUICApplication().setExtendedIdleTime(3600, disablesSleepGesture: true, wantsAutorotation: false) + #endif } } } diff --git a/MeowBili/Video/VideoPlayerView.swift b/MeowBili/Video/VideoPlayerView.swift index 687affc94..59d78a18b 100644 --- a/MeowBili/Video/VideoPlayerView.swift +++ b/MeowBili/Video/VideoPlayerView.swift @@ -209,6 +209,7 @@ struct VideoPlayerView: View { .animation(.smooth, value: playerScale) .animation(.smooth, value: __playerScale) .scrollIndicators(.never) + ._statusBarHidden(true) .tag(1) List { Section {