// Load video and create video playerlet videoPlayer : AVPlayer = {// Load cat video from bundleguardlet url = Bundle.main.url(forResource:"video", withExtension:"mp4")else {print("Could not find video file.")returnAVPlayer() }returnAVPlayer(url: url)}()
let plane =SCNPlane(width: imageAnchor.referenceImage.physicalSize.width, height: imageAnchor.referenceImage.physicalSize.height)plane.firstMaterial?.diffuse.contents = videoPlayerself.videoPlayer.play()
// Instantiate the audio sourceaudioSource =SCNAudioSource(fileNamed:"fireplace.mp3")!
// As an environmental sound layer, audio should play indefinitelyaudioSource.loops =true// Decode the audio from disk ahead of time to prevent a delay in playbackaudioSource.load()
// Create a player from the source and add it to `objectNode`objectNode.addAudioPlayer(SCNAudioPlayer(source: audioSource))