skvideonode

AVPlayer play SKVideoNode video ,I just can not control the playback

南笙酒味 提交于 2019-12-06 11:43:38
I am using the SpriteKit to play video,this is my code to create the SKVideoNode from AVPlayer: func CreateVideoViewWithAVPlayer(player:AVPlayer) { video = SKVideoNode(AVPlayer: player) let frameLayer=AVPlayerLayer(player: player) //video?. = CGRectMake(0, 0, 100, 100) video?.size = CGSize(width: 1024, height: 768) println(player.currentItem) video?.anchorPoint = CGPoint(x: 0, y: 0) video?.position = CGPoint(x: 0, y: 0) backgroundColor = SKColor.blackColor() self.addChild(video!) } And I create a AVPlayer give the function: let scene01 = GameScene(size: view.bounds.size) scene01

ARKit / SpriteKit - set pixelBufferAttributes to SKVideoNode or make transparent pixels in video (chroma-key effect) another way

末鹿安然 提交于 2019-12-05 02:59:53
My goal is to present 2D animated characters in the real environment using ARKit . The animated characters are part of a video at presented in the following snapshot from the video: Displaying the video itself was achieved with no problem at all using the code: func view(_ view: ARSKView, nodeFor anchor: ARAnchor) -> SKNode? { guard let urlString = Bundle.main.path(forResource: "resourceName", ofType: "mp4") else { return nil } let url = URL(fileURLWithPath: urlString) let asset = AVAsset(url: url) let item = AVPlayerItem(asset: asset) let player = AVPlayer(playerItem: item) let videoNode =

play video forever in sprite kit

∥☆過路亽.° 提交于 2019-11-30 15:01:41
i am having an issue with playing back a video in my intro scene. i have added my video to the scene and it plays fine. i just want it to repeat again and again. is there any way to set this video to playback automatically after it ends? this is how i add the video: SKVideoNode *videoNode = [SKVideoNode videoNodeWithVideoFileNamed:@"game1.m4v"]; videoNode.position = CGPointMake(150, 180); videoNode.size = CGSizeMake(150, 150); [self addChild:videoNode]; [videoNode play]; any help is appreciated. sangony Initialize your SKVideoNode with: - (instancetype)initWithAVPlayer:(AVPlayer *)player When

play video forever in sprite kit

人走茶凉 提交于 2019-11-29 21:35:54
问题 i am having an issue with playing back a video in my intro scene. i have added my video to the scene and it plays fine. i just want it to repeat again and again. is there any way to set this video to playback automatically after it ends? this is how i add the video: SKVideoNode *videoNode = [SKVideoNode videoNodeWithVideoFileNamed:@"game1.m4v"]; videoNode.position = CGPointMake(150, 180); videoNode.size = CGSizeMake(150, 150); [self addChild:videoNode]; [videoNode play]; any help is