SKVideoNode? How to show a video in a GameScene?

I want to display a video in a SpriteKit scene.
But how?

Apple developer says:

let sample = SKVideoNode(fileNamed: "sample.mov")
sample.position = CGPoint(x: frame.midX,
                          y: frame.midY)
addChild(sample)
sample.play()

But when I insert the code I get a hole bunch of errors.
Does somebody know what I have to do?

and what are your errors?

Consecutive declarations on a line must be separated by ‘;’
Insert ‘;’

Expected ‘(’ in argument list of function declaration

Expected ‘{’ in body of function declaration

Expected ‘func’ keyword in instance method declaration
Insert 'func ’

Expected declaration

Invalid redeclaration of ‘sample()’

they seems to be programming errors that logical errors, check if all your brackets are in pairs, do you also know the basics of swift programming? cuz if not try going through the basics found here https://www.youtube.com/playlist?list=PLMRqhzcHGw1b89DXHOVA77ozWXWmuBkWX

No, it isn’t so simple…

then please post your code as we cannot determine what the problem is

import SpriteKit
import GameplayKit

class GameScene: SKScene {

let sample = SKVideoNode(fileNamed: “sample.mp4”)

override func didMove(to view: SKView) {
   
    sample.position = CGPoint(x: frame.midX,
                              y: frame.midY)
    addChild(sample)
    
    sample.play()
  
}


override func update(_ currentTime: TimeInterval) {
    // Called before each frame is rendered
}

}

i mean a screenshot so we can see the errors as it is displayed on the screen

Sorry, for the late answer. I put the code in a new project and now there aren’t errors. BUT the video isn’t displayed…

you might need to put an actual SKVideoNode in your gamescreen, then just connect it

Yes, probably but how? There is no node with the name “SKViedeoNode”.