他のアプリで音楽を聴きながら自分のアプリでも音楽を同時再生できる方法を探しています。
や
を参考にして以下のようにしたのですが、他のアプリで音楽が鳴ったまま、自分のアプリの音楽を再生しても二つ同時に再生できませんでした。
AppDelegete.swift
swift
1func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 2 //バックグラウンドで音楽再生 3 do { 4 try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default) 5 try AVAudioSession.sharedInstance().setActive(true) 6 } catch { 7 print(error) 8 } 9 return true 10 }
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。