I'm trying to get a video to appear on screen with SpriteKit, but can't see it. The FPS counter in the bottom of the screen is updated with around 60 FPS, which makes sense. The video's audio is also audible. Removing the line of code that changes the position of the videoNode does nothing.
guard let path = Bundle.main.path(forResource: "video", ofType: "mp4") else {
fatalError("Video does not exist")
}
let url = URL(fileURLWithPath: path)
let asset = AVURLAsset(url: url, options: nil)
self.playerItem = AVPlayerItem(asset: asset)
self.player = AVPlayer(playerItem: self.playerItem)
videoNode = SKVideoNode(avPlayer: player!)
videoNode?.position = CGPoint(x: self.frame.width / 2, y: self.frame.height / 2)
self.addChild(self.videoNode!)
videoNode?.play()
Strange. Running the application in the simulator will not allow the video to be displayed. If you run in an actual test device, the video displays properly.