Skip to main content
Language

From App Bundle

VideoEditor SDK supports adding custom frames from the app bundle. In this example, we add dynamic frames. However, it is also possible to add static frames with a fixed aspect ratio in an analogous fashion.

In order to add custom frames, we need to create a CustomPatchConfiguration object which will hold the data necessary for the CustomPatchFrameBuilder to render a frame.

Image Groups#

Dynamic frames consist of four groups, corresponding to each side of the frame. In our example, we opt for the "horizontal inside" mode of arranging image tiles providing only a middle image for the left and right parts of the frame and a start, middle and end image for the top and bottom parts. Refer to the guide on dynamic frames for an in-depth explanation. We construct image URLs to the resources located in the app bundle and initialize the respective group object. These groups are then added to the CustomPatchConfiguration initialized above.

Image Modes#

By default, the midImageMode is set to .repeat which repeats the middle image to fill out the entire space. For this example, it is set to .stretch for all image groups to keep the correct pattern. In this mode, the middle image is stretched to fill out the entire space.

Initialize Frame#

Next, we pass the frame configuration to a CustomPatchFrameBuilder responsible for rendering the frame. The builder in turn is passed to the Frame constructor, as well as a thumbnailURL for display in the UI and an identifier. The frame identifier needs to be unique since it is used during the (de)serialization process.

Add to Asset Catalog#

Finally, we add the custom frame to the assetCatalog by appending it to the frames property.