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 AmityVideoPostCreator.Builder
, 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.
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.
Create a Video Post with Mention
When creating a video post with mention, you can provide the JsonObject
for the metadata
parameter and provide the list of userId
for the mentionUsers
parameter.
To render mention, refer to Rendering Mention section.
Play Video
To play a video, SDK provides the function AmityVideo.getVideoUrl()
. This is an HTTP URL that is ready to play for most video players. It returns a video URL in the original resolution.
If you want to play a video with specific resolution, you can pass an enum of AmityVideoResolution
as a target resolution you want to AmityVideo.getVideoUrl(AmityVideoResolution)
.
Available Resolutions
After a video is uploaded, the videos will be transcoded from the original resolution. AmityVideoResolution is an enum that represents video resolution. Currently, the SDK provides one original resolution and four possible transcoded resolutions.
When you upload a video, the original resolution will be available immediately after the video is uploaded. However, the transcoded resolutions will take time, and will be available eventually. SDK provides AmityVideo.getResolutions() to retrieve all available video resolutions. This function returns a list of available resolutions of the video.
Last updated