Question

Looking for an appropriate method to play a mp4 or m4v within a CCSprite in IOS 7.

I found something here (link below). But it adds video to cocos2d active scene not into CCsprite.

and I couldnt parent it into a CCSprite.

stackoverflow.com/questions/12000379/cocos2d-how-to-play-a-video-in-the-background-of-a-cclayer

(and no.CCVideoPlayer is not what I am looknig for because is not parentable or it is not a CCNode descendant to move or parenting)

got any brilliant idea ? thanks.

Was it helpful?

Solution

There's no such thing for cocos2d-iphone. Try having a closer look at how CCVideoPlayer works, because perhaps you really only need to adjust position and size of the video to match your needs. And if you want to move the video, simply have a dummy node contain the CCVideoPlayer instance and apply the node's position to the video player's position every frame.

But since CCVideoPlayer is a UIView subclass it will not allow you to draw other nodes on top of it.

If you aren't too far into development you could switch over to Sprite Kit which has a SKVideoNode that does exactly what you want. Including drawing other nodes both over and under the video node.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top