// Load video and create video player
let videoPlayer : AVPlayer = {
// Load cat video from bundle
guard let url = Bundle.main.url(forResource: "video", withExtension: "mp4") else {
print("Could not find video file.")
return AVPlayer()
}
return AVPlayer(url: url)
}()
// Instantiate the audio source
audioSource = SCNAudioSource(fileNamed: "fireplace.mp3")!
// As an environmental sound layer, audio should play indefinitely
audioSource.loops = true
// Decode the audio from disk ahead of time to prevent a delay in playback
audioSource.load()
// Create a player from the source and add it to `objectNode`
objectNode.addAudioPlayer(SCNAudioPlayer(source: audioSource))