원래 Spritekit에서 SKAudioNode를 사용하여 내 음악을 계속 시도했지만이 사이트의 다른 사용자가 AVFoundation을 사용하도록 리디렉션되었습니다. AVFoundation 프레임 워크에 익숙하지는 않습니다. 제가 알고 싶은 것은 scene1에서 scene2로 전환 할 때 음악을 계속 유지하는 것입니다. 음악은 모두 설정되어 있으며 아래 표시된 코드로 작동합니다.내 장면 전환시 AVAudioPlayer가 중지됩니다. Swift
var Music = AVAudioPlayer()
let myFilePathString = NSBundle.mainBundle().pathForResource("Verm - Explode", ofType: "mp3")
if let myFilePathString = myFilePathString {
let myFilePathURL = NSURL(fileURLWithPath: myFilePathString)
do {
try Music = AVAudioPlayer(contentsOfURL: myFilePathURL)
Music.play()
}catch
{
print("Error")
}
}
그래서 장면을 전환 할 때 어떻게 노래를 계속할 수 있습니까? 미리 감사드립니다. 샘. : p
인가하는 데 도움이'Music' (뷰 반대) 귀하의 응용 프로그램의 바르? –
나는 내 수업 GameScene : SKScene {아래에 '음악'을 선언했다. 위에 표시된 코드는 var Music = AVAudioPlayer()를 포함하지 않는 DidMoveToView 섹션에 있습니다. – SamCurry