Skip to main content
Language

From Resources

VideoEditor SDK supports adding custom frames from the resources. In this example, we add custom static and dynamic frames.

WARNING: Be sure to put the drawables for the frames in the res/drawable-nodpi folder. Otherwise, they will be scaled by the Android system.

Static frame#

Here, we create a static frame using FrameAsset. It takes in a unique identifier (used for serialization/deserialization purposes), the resource drawable, aspect ratio supported by the frame, and group id. The group id is used to group static frames. When the aspect ratio of the video changes, a frame with the same group id that supports the new aspect ratio is used to replace the older frame.

Dynamic frame#

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 create a dynamic frame using FrameAsset. It takes in a unique identifier (used for serialization/deserialization purposes), CustomPatchFrameAsset, and relative scale. A CustomPatchFrameAsset takes in the frame layout mode (HorizontalInside or VerticalInside), and the four image groups (top, left, right, bottom). The relative scale is used to describe how big the frame should be with respect to the video it will be applied to.

Add frames to AssetConfig#

To use the frames, they must first be available in the SDK's backend. This is done by adding the frames to the AssetConfig.

Configure UiConfigFrame#

Here, we configure UiConfigFrame and add the custom FrameItems to the frameList.