mirror of
				https://github.com/yattee/yattee.git
				synced 2025-11-03 22:22:02 +00:00 
			
		
		
		
	Improve setting audio session
This commit is contained in:
		@@ -285,10 +285,6 @@ final class AVPlayerBackend: PlayerBackend {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let startPlaying = {
 | 
			
		||||
            #if !os(macOS)
 | 
			
		||||
                try? AVAudioSession.sharedInstance().setActive(true)
 | 
			
		||||
            #endif
 | 
			
		||||
 | 
			
		||||
            self.setRate(self.model.currentRate)
 | 
			
		||||
 | 
			
		||||
            guard let item = self.model.playerItem, self.isAutoplaying(item) else { return }
 | 
			
		||||
 
 | 
			
		||||
@@ -192,10 +192,6 @@ final class MPVBackend: PlayerBackend {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let startPlaying = {
 | 
			
		||||
            #if !os(macOS)
 | 
			
		||||
                try? AVAudioSession.sharedInstance().setActive(true)
 | 
			
		||||
            #endif
 | 
			
		||||
 | 
			
		||||
            DispatchQueue.main.async { [weak self] in
 | 
			
		||||
                guard let self = self else {
 | 
			
		||||
                    return
 | 
			
		||||
 
 | 
			
		||||
@@ -755,11 +755,6 @@ final class PlayerModel: ObservableObject {
 | 
			
		||||
            remoteCommandCenterConfigured = true
 | 
			
		||||
 | 
			
		||||
            #if !os(macOS)
 | 
			
		||||
                try? AVAudioSession.sharedInstance().setCategory(
 | 
			
		||||
                    .playback,
 | 
			
		||||
                    mode: .moviePlayback
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
                UIApplication.shared.beginReceivingRemoteControlEvents()
 | 
			
		||||
            #endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -247,6 +247,11 @@ struct YatteeApp: App {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        #endif
 | 
			
		||||
 | 
			
		||||
        #if !os(macOS)
 | 
			
		||||
            try? AVAudioSession.sharedInstance().setCategory(.playback)
 | 
			
		||||
            try? AVAudioSession.sharedInstance().setActive(true)
 | 
			
		||||
        #endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    func migrateAccounts() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user