swift: How to insert animated watermark into the video, or how to merge two videos

So I have a video from camera and array of images – result of screen capturing, basically the list of screenshots.
I want to merge them and add ability for User to save the resulted video on the phone. Let’s insert static image as a watermark as well as animated (video in video) watermark into the main video.

Continue reading “swift: How to insert animated watermark into the video, or how to merge two videos”

Social Share Toolbar

Swift: how to record a screen video, or convert images to videos

Let say we want to capture the screen of your game and have it as a video in output.
Search results on “How to record screen video in swift” will lead us to RPScreenRecorder, it’s kind of cool, but for security reasons you are no allowed to save video or even access it. The only trick how to solve it is to make number of screenshots, save them as an array of Images. Unfortunately, you can deal with some performance issues here, it could be feasible to make like 30 fps capturing but it depends on many factors. For my game I came up with 30/5 fps, here’s the whole code:
Continue reading “Swift: how to record a screen video, or convert images to videos”

Social Share Toolbar

How to add pixel-perfect physics to an SKSpriteNode

To perfect the collision detection, basically to ignore transparency during the interest we can use SKPhysicsBody. The idea here is to have two images – one is what User sees, another is very simplified version for SpriteKit engine – simplified from color and geometry standpoint. The more complex “collision body” is the more resources it will spend during each frame to calculate collisions. Just for instance here’s the actual image and it’s “mask”

Now we are ready for some code
Continue reading “How to add pixel-perfect physics to an SKSpriteNode”

Social Share Toolbar