Insert video file into mesh in reality composer?

Has the method of inputting Videos files into Reality Composer been updated? If there is a way to insert a video file into a specific mesh using XCode, please let me know.

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()

    }

Hi Artyom - Your code here and in Dropbox was very helpful. I am trying to put a video material on an external USDZ object that I have found online and converted. But the material does not show up (the video plays - I can hear it) and I suspect that it is a faulty UV or normal map. I have found code that works with someone else's USDZ created in Blender. I am trying to simulate a planetarium, projecting into the underside of a hemisphere. I have tried every culling setting in Xcode. Do you have any ideas on what I should try now? Thanks!

hi @dpentecost Were you able to figure this out? I'm trying to do basically the same thing but with a stereo (3d) 180 half dome. Thanks!

I also need help with putting stereo video to 180 half dome. Any clue how to do this? Also how to make each eye see only part of video to achieve stereo?

Insert video file into mesh in reality composer?
 
 
Q