我需要循环播放视频。如何在视频结束时获得回调。我需要循环它直到用户跟踪该视频
private func addVideoNode(bundleFileName: String, forTrackableImage imageTrackable: ARImageTrackable?){
// Initialise video node
let videoNode = ARVideoNode(bundledFile: bundleFileName)
// Add video node to image trackable
imageTrackable?.world.addChild(videoNode)
// Video scale
let scale = Float(imageTrackable?.width ?? 0) / Float(videoNode?.videoTexture.width ?? 0)
videoNode?.scale(byUniform: scale)
videoNode?.visible = false
videoNode?.play()
}
答案 0 :(得分:1)
在视频节点的ARPlayableTexture属性上注册为委托。
视频播放结束后,代理人会收到回电:https://www.kudan.eu/docs-reference/iOSDocs/protocol_a_r_playable_texture_delegate_01-p.html。
答案 1 :(得分:0)
必须像这样在videoNode上设置委托。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSHumanReadableCopyright</key> <!-- developer name key -->
<string>Developer Name</string> <!-- developer name value -->
<!-- ... and further ... -->
然后
videoNode?.videoTextureMaterial.texture.delegate = self