I made an app that allows you to scan an image with an ios device and it plays a video using arKit tracking . However, once the video is finished, I can't seem to find a way to make it restart . Is there anyway I can recall all the code in the viewcontroller?
if let imageAnchor = anchor as? ARImageAnchor {
// Create a plane
let plane = SCNPlane(width: imageAnchor.referenceImage.physicalSize.width, height: imageAnchor.referenceImage.physicalSize.height)
if imageAnchor.referenceImage.name == "skateboard" {
// Set AVPlayer as the plane's texture and play
plane.firstMaterial?.diffuse.contents = self.SkateboardVideoPlayer
self.SkateboardVideoPlayer.play()
}
}