I am trying to use AVPlayerLayer as SCNMaterial to be assigned to SCNSphere.
Based on:
https://developer.apple.com/library/mac/samplecode/SceneKit_Slides_WWDC2013/Listings/Scene_Kit_Session_WWDC_2013_Sources_Slides_ASCSlideMaterialLayer_m.html
I create a player, create a player layer and try with and without backgroundLayer to designate as material for my SCNSphere
The problem is that I get the same result reported here:
SCNMaterialProperty not display layer
Play audio, video is not displayed at all!
The code bit is pretty simple:
let path = NSBundle.mainBundle().pathForResource("tb", ofType: "mp4")
let url = NSURL(fileURLWithPath: path!)
let player = AVPlayer(URL: url)
player.actionAtItemEnd = .None
player.play()
let frame = CGRectMake(0, 0, 300, 300)
let playerLayer = AVPlayerLayer()
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
playerLayer.frame = frame
playerLayer.player = player
sceneMaterial = SCNMaterial()
sceneMaterial.specular.contents = UIColor.whiteColor()
sceneMaterial.shininess = 0.5
sceneMaterial.diffuse.contents = playerLayer
sphere.materials = [sceneMaterial]
, backgroundLayer: CALayer playerLayer , .