fixed player even more

This commit is contained in:
cranci1 2025-03-03 09:10:01 +01:00
parent c47d226153
commit 6397f120fc
2 changed files with 23 additions and 2 deletions

View file

@ -110,6 +110,7 @@ class CustomMediaPlayerViewController: UIViewController {
setupMenuButton()
addTimeObserver()
startUpdateTimer()
setupAudioSession()
player.play()
@ -402,7 +403,15 @@ class CustomMediaPlayerViewController: UIViewController {
&& self.currentTimeVal != self.duration
&& self.showWatchNextButton
&& self.duration != 0 {
self.watchNextButton.isHidden = false
if UserDefaults.standard.bool(forKey: "hideNextButton") {
self.watchNextButton.isHidden = false
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
self.watchNextButton.isHidden = true
}
} else {
self.watchNextButton.isHidden = false
}
} else {
self.watchNextButton.isHidden = true
}
@ -572,6 +581,18 @@ class CustomMediaPlayerViewController: UIViewController {
override var prefersStatusBarHidden: Bool {
return true
}
func setupAudioSession() {
do {
let audioSession = AVAudioSession.sharedInstance()
try audioSession.setCategory(.playback, mode: .moviePlayback, options: .mixWithOthers)
try audioSession.setActive(true)
try audioSession.overrideOutputAudioPort(.speaker)
} catch {
Logger.shared.log("Failed to set up AVAudioSession: \(error)")
}
}
}
// yes? Like the plural of the famous american rapper ye? -IBHRAD

View file

@ -18,7 +18,7 @@ struct SettingsViewPlayer: View {
var body: some View {
Form {
Section(header: Text("Media Player"), footer: Text("Some features are limited to Sora while others are limited to the Default player, such as ForceLandscape and holdSpeed. Unfortunately the ForceLandscape doesn't yet work on the Sora Player.")) {
Section(header: Text("Media Player"), footer: Text("Some features are limited to the Sora and Default player, such as ForceLandscape and holdSpeed")) {
HStack {
Text("Media Player")
Spacer()