diff --git a/MusicPlayer Watch App/ContentView.swift b/MusicPlayer Watch App/ContentView.swift index 118e33a..dd2b5c1 100644 --- a/MusicPlayer Watch App/ContentView.swift +++ b/MusicPlayer Watch App/ContentView.swift @@ -188,7 +188,7 @@ struct ContentView: View { print(self.player.error!) } else { - //self.player.play() + self.player.play() } } init() { @@ -202,7 +202,7 @@ struct ContentView: View { do { let session = AVAudioSession.sharedInstance() - try session.setCategory(AVAudioSession.Category.playback) + try session.setCategory(AVAudioSession.Category.playback, mode: .default, policy: .longFormAudio, options: .duckOthers) } catch { print(error) } diff --git a/MusicPlayer Watch App/PlaybackView.swift b/MusicPlayer Watch App/PlaybackView.swift index ead55d8..ccd3b62 100644 --- a/MusicPlayer Watch App/PlaybackView.swift +++ b/MusicPlayer Watch App/PlaybackView.swift @@ -69,6 +69,7 @@ struct PlaybackView: View { parent!.player.pause() self.playing = false } else { + parent!.player.audiovisualBackgroundPlaybackPolicy = .continuesIfPossible parent!.player.play() self.playing = true } diff --git a/MusicPlayer.xcodeproj/xcuserdata/bill.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/MusicPlayer.xcodeproj/xcuserdata/bill.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index bc06a78..c920a37 100644 --- a/MusicPlayer.xcodeproj/xcuserdata/bill.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/MusicPlayer.xcodeproj/xcuserdata/bill.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -36,5 +36,21 @@ landmarkType = "9"> + + + +