Skip to main content
Create engaging video content with support for captions, metadata, and interactive features. Clip posts enable sharing of video moments up to 15 minutes long with rich engagement capabilities.

Video Content

Support for videos up to 15 minutes and 2GB file size

Multiple Formats

Support for 3gp, avi, f4v, flv, m4v, mov, mp4, ogv, 3g2, wmv, vob, webm, mkv

Overview

Clip posts enable sharing of video content with rich features:
  • Video Duration: Up to 15 minutes of video content
  • Rich Captions: Text descriptions with mentions and hashtags
  • Interactive Features: Users can react and comment on clips
  • Metadata Support: Custom data for enhanced functionality
RequirementLimitNotes
File SizeUp to 2GB per clipMaximum supported file size
DurationMaximum 15 minutesPer single clip
File Formats3gp, avi, f4v, flv, m4v, mov, mp4, ogv, 3g2, wmv, vob, webm, mkvMultiple format support
Clips must be uploaded first before creating the post. Prior to creating a clip post, upload the video clip to obtain the clip data that will be used in post creation.
1

Upload Clip

Use the File Repository to upload your video clip and get file ID
2

Create Post

Use the file ID in your clip post creation request
3

Handle Response

Process the response and handle any errors

Parameters

ParameterTypeRequiredDescription
textStringText content of the post (max 20,000 characters)
clipObjectClip data obtained from upload process
targetTypeEnumTarget type (user or community)
targetIdStringTarget ID (user id or community id)
metadataObjectAdditional properties for custom fields or mentions
func createClipPost(clip: AmityVideoData, text: String) async {
    do {
        let post = try await postRepository.createPost()
            .targetUser(userId: "targetUserId") // or targetCommunity for community posts
            .clip(clip: clip)
            .text(text)
            .metadata([:]) // optional metadata
            .build()
            .create()
        
        // Handle successful post creation
        print("Clip post created successfully: \(post.postId)")
    } catch {
        // Handle error
        print("Failed to create clip post: \(error)")
    }
}

Best Practices

  • Compress videos before upload to reduce file size - Use appropriate resolution for target platform - Optimize for mobile viewing experience - Implement progress indicators for uploads
  • Show video preview before posting - Provide video editing capabilities - Handle upload failures gracefully with retry options - Implement smooth playback experience
  • Preload video thumbnails - Cache uploaded clips to avoid re-uploads - Implement lazy loading for video content - Use appropriate video loading libraries

Troubleshooting

Problem: Clips fail to upload or post creation failsSolutions:
  • Check file size (must be under 2GB)
  • Verify supported format (3gp, avi, f4v, flv, m4v, mov, mp4, ogv, 3g2, wmv, vob, webm, mkv)
  • Ensure clip duration is under 15 minutes
  • Ensure stable internet connection
  • Implement retry logic with exponential backoff
try {
  const clipData = await uploadClip(clipFile);
  await createClipPost(clipData, text, targetId, targetType);
} catch (error) {
  if (error.code === 'FILE_TOO_LARGE') {
    // File exceeds 2GB limit
  } else if (error.code === 'DURATION_TOO_LONG') {
    // Clip exceeds 15 minute limit
  } else if (error.code === 'NETWORK_ERROR') {
    // Implement retry logic
  }
}
Problem: Videos don’t play or have poor qualitySolutions:
  • Use supported video codecs
  • Optimize video compression settings
  • Implement proper video player configuration
  • Test on different devices and network conditions
// Recommended video settings
const videoSettings = {
  maxFileSize: '2GB',
  maxDuration: '15 minutes',
  supportedFormats: ['3gp', 'avi', 'f4v', 'flv', 'm4v', 'mov', 'mp4', 'ogv', '3g2', 'wmv', 'vob', 'webm', 'mkv']
};
Problem: App becomes slow or crashes with video contentSolutions:
  • Implement video compression before upload
  • Use video loading libraries with memory management
  • Optimize video resolution and bitrate
  • Clear video cache periodically
// Example: Optimize video before upload
const optimizedVideo = await optimizeVideo(originalVideo, {
  maxResolution: { width: 720, height: 1280 },
  quality: 0.8,
  maxBitrate: '1500k'
});
Clip Format: Clips are optimized for short-form video content and provide enhanced engagement features compared to regular video posts.

Common Use Cases

  • Social Moments: Share engaging video moments up to 15 minutes
  • Product Demos: Detailed product demonstrations and features
  • Tutorials: Comprehensive how-to videos and educational content
  • Entertainment: Creative video content and storytelling
  • Behind-the-Scenes: Extended glimpses into processes or events
  • Presentations: Video presentations and announcements