아이폰으로 음악을 듣고 있습니다. 내 애플리케이션을 실행할 때 배경 음악을 멈추지 말고 배경 음악을 멈춰야합니다. 나는 캔디 쇄파 앱과 동일하게하고 싶다. 이 문제를 해결하려면 어떻게해야합니까? 기본값은 AVAudioSessionCategorySoloAmbient이기 때문에 나에게배경 음악이 앱이 시작되면서 음악이 멈 춥니 다.
var isOtherAudioPlaying = AVAudioSession.sharedInstance().otherAudioPlaying
println("isOtherAudioPlaying>>> \(isOtherAudioPlaying)")
if(isOtherAudioPlaying == false)
{
audioPlayer1!.play()
}
앱의 오디오 세션 카테고리 및 옵션을 적절하게 설정해야합니다. https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/index.html – Palpatim
다음 코드에 의해 해결되었습니다 : - ** AVAudioSession.sharedInstance(). setCategory (AVAudioSessionCategoryAmbient, error : nil) == true ** 어디에서 movieplayercontroller를 배치 할 것인가? –