ARKit

教學連結

// Load video and create video player
let videoPlayer : AVPlayer = {
    // Load cat video from bundle
    guard let url = Bundle.main.url(forResource: "video",   withExtension: "mp4") else {
        print("Could not find video file.")
        return AVPlayer()
    }
    return AVPlayer(url: url)
}()
let plane = SCNPlane(width: imageAnchor.referenceImage.physicalSize.width, height: imageAnchor.referenceImage.physicalSize.height)

plane.firstMaterial?.diffuse.contents = videoPlayer
self.videoPlayer.play()

Last updated

Was this helpful?