Video Post

Create Video Post

Creating a video post is similar to creating a file and image post.
First, you need to upload the videos using AmityFileRepostory , build the post using AmityVideoPostBuilder, and then finally create the post.
AmityFileRepository class contains a method that helps in uploading videos. To upload videos, you have to specify the feedType that the video should belong.
For example, you are about to create a video post. You need to set feedType to post.
Upload a video with AmityFileRepostory
When the video is successfully uploaded, you will receive an instance of AmityVideoData which contains information about the uploaded video.
Requirements for Video
  • Supported video types are 3gp, avi, f4v, flv, m4v, mov, mp4, ogv, 3g2, wmv, vob, webm, mkv
  • The maximum file size of the video is 1 GB
  • The maximum duration of the video is 2 hours
  • Thumbnail for video post will be automatically generated
Second, create video post using AmityVideoPostBuilder.
Many videos can be added into one video post. Currently, SDK has the maximum of ten videos per post.
Build and create a video post
To know more about mentions in post, refer to Mention in Post page.

Play Video

The actual videos in the video post can be found by looking at the child posts.
SDK provides post.getVideoInfo() that return AmityVideoData.
Get video URL example
To play a video, SDK provides AmityVideoData.getVideo(resolution:) that return a ready-to-play HTTP URL.
Play video from AmityVideoData using AVKit and AVFoundation

Available Video Resolutions

After a video post is created, the videos will be transcoded from the original resolution.
AmityVideoResolution is an enum that represents video resolution.
When you create a video post, the original resolution will be available immediately after the post is created. However, the transcoded resolution will take time, and will be available eventually.
SDK provides .availableResolution() to retrieve all available resolutions.
List out all available video qualities

Video Data Attributes

SDK provides AmityVideoData.attributes that returns a dictionary containing video file properties that might be useful for your app.
Get video attributes example
Export as PDF
Copy link
Create Video Post
Play Video
Available Video Resolutions
Video Data Attributes