3

I'm trying to to airplay video even when the app is in the background. Is this possible? I've enabled Audio, AirPlay, and Picture in Picture for background modes, in app capabilities. I've also set AVAudioSession category:

do {
        try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
        try AVAudioSession.sharedInstance().setActive(true)
    } catch {
        print("error");
    }

Using Xcode 8.2.1 for iOS 8.1+ (iPhone simulator)

Alterecho
  • 665
  • 10
  • 25
  • hey are you able to solve this? please write your solution. I am also facing same issue. – Moaz Saeed Aug 10 '18 at 17:40
  • I ran into an issue where unintended code was deactivating my audio session after the AVPlayerViewController came on screen. You could set a symbolic breakpoint on `-[AVAudioSession setActive:withOptions:error:]` to see if anything else is deactivating your session. – Canucklesandwich Jan 15 '20 at 01:03

1 Answers1

-2

Have you inserted a list in .plist file?


Required background modes / itme0 : App plays audio or streams audio/video using AirPlay

enter image description here

  • Could you elaborate, just a bit? What .plist this should get into? What items in the .plist? their expected values? this answer is missing a lot. – Motti Shneor Jul 05 '17 at 09:58
  • Can hardly understand your answer. What List should be inserted in .plist file? Which .plist file? and the "Required background modes / item0: - couldn't you please explain what should go there, and provide an excerpt, or sample? at least reference to documentation? – Motti Shneor Jul 09 '17 at 10:02
  • OP already specified in post that they've added the required background mode. – Canucklesandwich Jan 15 '20 at 23:07