/WallStreaming

ARKit demo that streams a video on a wall

Primary LanguageSwiftMIT LicenseMIT

WallStreaming

Small example demonstrating how to play a video on a wall using ARKit.

Video on the wall

This became possible when iOS 11.3 / ARKit "1.5" added the .vertical option for the .planeDetection parameter of ARWorldTrackingConfiguration.

The only "trick" was to use SpriteKit's SKVideoNode in an standard SpriteKit SKScene:

    let playerItem = AVPlayerItem(url: streamURL)
    let player = AVPlayer(playerItem: playerItem)
    let videoNode = SKVideoNode(avPlayer: player)
    scene.addChild(videoNode)

and setting the texture of the virtual wall added where ARKit detects the vertical surface:

    guard let material = plane.materials.first else { return }
    material.diffuse.contents = scene