---
title: VideoMaterial
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/videomaterial
---

# VideoMaterial

A material that supports animated textures.

## Declaration

```swift
struct VideoMaterial
```

## Overview

Overview In RealityKit, a material is an object that defines the surface properties of a rendered 3D object. A VideoMaterial is a material that maps a movie file on to the surface of an entity. Video materials are unlit, which means that scene lighting doesn’t affect them. Video materials support transparency if the source video’s file format also supports transparency. Video materials use an AVPlayer instance to control movie playback. You can use any movie file format that AVPlayer supports to create a video material. To control playback of the material’s video, use the avPlayer property, which offers methods like play() and pause(). The following code demonstrates how to create and start playing a video material using a movie file from your application bundle. // Create a URL that points to the movie file. if let url = Bundle.main.url(forResource: "MyMovie", withExtension: "mp4") {

// Create an AVPlayer instance to control playback of that movie.     let player = AVPlayer(url: url)

// Instantiate and configure the video material.     let material = VideoMaterial(avPlayer: player)

// Configure audio playback mode.     material.controller.audioInputMode = .spatial

// Create a new model entity using the video material.     let modelEntity = ModelEntity(mesh: cube, materials: [material])

// Start playing the video.     player.play() } To see an example of using a video texture in RealityKit, see Creating a game with scene understanding.

## Topics

### Creating a video material

- [init(avPlayer:)](realitykit/videomaterial/init(avplayer:).md)

### Controlling playback

- [avPlayer](realitykit/videomaterial/avplayer.md)
- [controller](realitykit/videomaterial/controller.md)

### Initializers

- [init(videoRenderer:)](realitykit/videomaterial/init(videorenderer:).md)

### Instance Properties

- [faceCulling](realitykit/videomaterial/faceculling-swift.property.md)
- [readsDepth](realitykit/videomaterial/readsdepth.md)
- [triangleFillMode](realitykit/videomaterial/trianglefillmode-swift.property.md)
- [videoRenderer](realitykit/videomaterial/videorenderer.md)
- [writesDepth](realitykit/videomaterial/writesdepth.md)

### Type Aliases

- [VideoMaterial.FaceCulling](realitykit/videomaterial/faceculling-swift.typealias.md)
- [VideoMaterial.TriangleFillMode](realitykit/videomaterial/trianglefillmode-swift.typealias.md)

## Relationships

### Conforms To

- [Material](realitykit/material.md)

## See Also

### Video materials

- [VideoMaterial.FaceCulling](realitykit/videomaterial/faceculling-swift.typealias.md)
- [VideoMaterial.TriangleFillMode](realitykit/videomaterial/trianglefillmode-swift.typealias.md)
