A node that displays video content.
- iOS 8.0+
- macOS 10.10+
- tvOS 9.0+
Like any other node, you can put the movie node anywhere inside the node tree and Sprite Kit will render it properly. For example, you might use a video node to animate some visual behaviors that would be expensive to define using a collection of textures.
A video node offers only a subset of the features available to the
A video node is always stretched uniformly.
A video node cannot be colorized.
A video node always uses an alpha blend mode.
A video node cannot use custom shaders or lighting.
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. As with a sprite node, the
anchorPoint property defines where the content is displayed relative to the node position.
SKVideoNode initializes the video node using a video file stored in the app bundle and then adds the node to the scene. It calls the node’s
play() method to start the video playback.
If you need more precise control over the video playback behavior, you can use AV Foundation to create an
AVPlayer object for your video content and then use this object to initialize the
SKVideoNode node. Then, instead of using the node’s playback methods, you use the
AVPlayer object to control playback. The video content is automatically displayed in the video node. For more information, see AVFoundation Programming Guide.