mirror of
https://github.com/yattee/yattee.git
synced 2025-11-22 06:31:26 +00:00
Previously, the audio session was initialized immediately when the app launched, causing audio from other apps (like Music) to stop even when no video was playing in Yattee. Changes: - Remove audio session initialization from AppDelegate launch - Remove audio session setup from MPVClient initialization - Update setAudioSessionActive() to configure audio session category before activation The audio session is now lazily initialized only when playback actually starts: - For MPV backend: triggered by FILE_LOADED, PLAYBACK_RESTART, AUDIO_RECONFIG events - For AVPlayer backend: triggered when play() is called This allows music from other apps to continue playing until a video is actually played in Yattee.
39 lines
1.3 KiB
Swift
39 lines
1.3 KiB
Swift
import AVFoundation
|
|
import Defaults
|
|
import Foundation
|
|
import Logging
|
|
import UIKit
|
|
|
|
final class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
var orientationLock = UIInterfaceOrientationMask.all
|
|
|
|
private var logger = Logger(label: "stream.yattee.app.delegate")
|
|
private(set) static var instance: AppDelegate!
|
|
|
|
func application(_: UIApplication, supportedInterfaceOrientationsFor _: UIWindow?) -> UIInterfaceOrientationMask {
|
|
return orientationLock
|
|
}
|
|
|
|
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { // swiftlint:disable:this discouraged_optional_collection
|
|
Self.instance = self
|
|
|
|
#if !os(macOS)
|
|
UIViewController.swizzleHomeIndicatorProperty()
|
|
OrientationTracker.shared.startDeviceOrientationTracking()
|
|
OrientationModel.shared.startOrientationUpdates()
|
|
|
|
UIApplication.shared.beginReceivingRemoteControlEvents()
|
|
#endif
|
|
|
|
return true
|
|
}
|
|
|
|
func application(_: UIApplication, open url: URL, options _: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
|
|
if url.scheme == "yattee" {
|
|
OpenURLHandler(navigationStyle: Constants.defaultNavigationStyle).handle(url)
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
}
|