I've added an SKVideoNode to my GameScene. When I try to remove the video, the video image disappears, but the audio continues to play. I've tried to stop and pause the video before removing, but the audio continues to play regardless.
var introVideoIsPlaying = false
var introVideo: SKVideoNode!
func playIntroVideo() {
introVideoIsPlaying = true
if let videoURL = Bundle.main.url(forResource: "video", withExtension: "mp4") {
introVideo = SKVideoNode(url: videoURL)
introVideo.position = CGPoint(x: frame.midX, y: frame.midY)
introVideo.size = self.frame.size
self.addChild(introVideo)
introVideo.play()
}
}
Then I remove the video in my touchesBegan -
if introVideoIsPlaying == true {
introVideo.removeFromParent()
}
What could I be missing? Is there a way to independently stop the audio in an SKVideoNode?