Trying to run a 'Cut Scense Video' before entering into my game build. The game works great. I have created a separate scene, which I named "StartScene" to play my cut scene. The build succeeds, but when it gets to the cut scene part on the simulator I get a blank grey screen. I have searched online and get a lot of resizing issues with the video, however Apple Developer says this:
When a video node is created, its size property is initialized to the base size of the video content, but you can change it if you want. The video content is automatically stretched to the new size.
Example code I copied from Apple Developer:
let sample = SKVideoNode(fileNamed: "sample.mov")
sample.position = CGPoint(x: frame.midX,
y: frame.midY)
addChild(sample)
sample.play()
Here is my code in my StartScene.swift for playing the cut scene:
import SpriteKit
import GameplayKit
class StartScene: SKScene {
override func sceneDidLoad() {
let openingVideo = SKVideoNode(fileNamed: "MyCutScene.mp4")
openingVideo.position = CGPoint(x: frame.midX, y: frame.midY)
addChild(openingVideo)
openingVideo.play()
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let gameSceneTemp = GameScene(fileNamed: "GameScene")
self.scene?.view?.presentScene(gameSceneTemp!, transition: SKTransition.doorsCloseHorizontal(withDuration: 1.0))
}
}
Maybe its a newbie error in just formatting the scene wrong in general. I thought it would be pretty straight forward. The Video is saved in the App bundle in Assets, and yes I made sure the name matched what I put in the code string. The last bit of code is just my transition to the GameScene with the touchesBegan function.