avPlayer
The material’s video playback controller.
Declaration
@MainActor @preconcurrency var avPlayer: AVPlayer? { get set }Discussion
Use this property to control animation playback for a video texture. This property allows you to play or pause the movie, seek to (in other words, skip to) a specific part of the movie, or to change the movie’s playback rate. The following code demonstrates pausing the texture’s video and restarting it from the beginning of the movie file:
myMaterial.avPlayer.pause()
myMaterial.avPlayer.seek(to: .zero)
myMaterial.avPlayer.play()