Hi friend! I hope I correctly understood your question.
I don't know the possibility of doing it through a RealityComposer ,but I have a solution to how to do it through Xcode, like this.
1
Add your video file to Bundle
2
Add video player, and import AVKit
private var videoPlayer: AVPlayer!
3
Something like that
func obtainEntity() {
guard let path = Bundle.main.path(forResource: "Texture", ofType: "mp4") else { return }
let url = URL(fileURLWithPath: path)
let playerItem = AVPlayerItem(url: url)
videoPlayer = AVPlayer(playerItem: playerItem)
let mesh = MeshResource.generateSphere(radius: 0.03)
let material = VideoMaterial(avPlayer: videoPlayer)
entity = ModelEntity(mesh: mesh, materials: [material])
entity.generateCollisionShapes(recursive: true)
entity.setParent(anchorEntity)
videoPlayer.play()
arView.installGestures(.all, for: entity)
arView.scene.anchors.append(anchorEntity)
NotificationCenter.default.addObserver(self, selector: #selector(loopVideo), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: playerItem)
}
@objc
func loopVideo(notification: Notification) {
guard let playerItem = notification.object as? AVPlayerItem else { return }
playerItem.seek(to: CMTime.zero, completionHandler: nil)
videoPlayer.play()
}