Multiple Media Types
Combine images, videos, audio, and files in one post
Up to 10 Attachments
Mix and match up to 10 media items of any type
Overview
Mixed media posts enable creators to share diverse content without splitting into multiple posts:- Flexible Combinations: Mix images + videos + audio + files
- Single Post Structure: Keep related content together
- Unified Engagement: Users interact with one cohesive post
Post Structure Types
Every post now has astructureType field that describes its media composition:
Pure Types (Single Media Type)
Pure Types (Single Media Type)
| Structure Type | Description | Example |
|---|---|---|
text | Contains only text content, no attachments | Text-only announcement or discussion |
image | Contains only image attachments | Photo gallery with 3 images |
video | Contains only video attachments | Video post with 2 clips |
audio | Contains only audio attachments | Podcast episode or voice message |
file | Contains only file attachments | Document sharing (PDFs, docs) |
liveStream | Contains only live stream content | Live broadcast session |
poll | Contains only poll content | Survey or voting post |
clip | Contains only short-form video clips | Short video content (up to 15 min) |
Pure type posts maintain backward compatibility with existing filtering behavior.
Mixed Type (Multiple Media Types)
Mixed Type (Multiple Media Types)
Structure Type:
mixedA post is classified as mixed when it contains attachments of 2 or more distinct media types (image, video, audio, file).Examples:- Image + Video =
mixed - Image + Audio =
mixed - Video + File =
mixed - Image + Video + Audio + File =
mixed
The
structureType is automatically determined when you create or edit a post. You don’t need to specify it manually. Special post types like poll, liveStream, and clip are not combined into mixed posts.Legacy/Null Structure Type
Legacy/Null Structure Type
Structure Type:
null or absentSome older posts or text-only posts may not have a structureType value. This is equivalent to the text structure type for backward compatibility.Structure Type Determination
The system automatically determines thestructureType based on your attachments:
Requirements & Limits
| Requirement | Limit | Notes |
|---|---|---|
| Total Attachments | Maximum 10 items | All media types combined |
| Media Types | image, video, audio, file | Can mix any combination |
| File Size | Varies by type | Images: 100MB, Videos: varies, Audio: 1GB, Files: 1GB |
| Text | 10,000 characters | Optional caption |
Quick Start
1
Upload Media Files
Upload your media files using the appropriate endpoints for each type
2
Build Mixed Media Post
Use the
AmityMixedMediaPostBuilder to combine different media types3
Create Post
Create the post with all attachments in a single request
4
Handle Response
The post includes parent and child posts with automatic
structureType assignmentParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | String | ❌ | Caption text (max 10,000 characters) |
attachments | Array | ✅ | Mixed array of media items (max 10 total) |
targetType | Enum | ✅ | Target type (user or community) |
targetId | String | ✅ | Target ID (userId or communityId) |
metadata | Object | ❌ | Custom metadata |
Implementation
Attachment Order Preservation: The
AmityMixedMediaPostBuilder maintains the order in which you add attachments. Set media in the order you want them displayed.Structure Type Behavior
Automatic Classification
The system automatically classifies posts based on their attachments:- Pure Types
- Mixed Types
Single media type only
Editing Posts
When you edit a post and change its attachments, thestructureType is automatically updated:
Important: When editing posts, the
structureType is recalculated based on the final set of attachments. This includes both active and soft-deleted child posts, so removing media may not change the structure type immediately.Querying Mixed Media Posts
Use theincludeMixedStructure parameter to control whether mixed media posts appear in your query results:
Default Behavior (includeMixedStructure=false)
Default Behavior (includeMixedStructure=false)
Pure type filtering - excludes mixed postsThis preserves legacy behavior where single-type filters return only “pure” posts of that type.
Include Mixed Posts (includeMixedStructure=true)
Include Mixed Posts (includeMixedStructure=true)
Inclusive filtering - includes mixed posts containing the requested typeUseful when you want to show all posts containing a specific media type, regardless of whether they also contain other types.
Multiple Types Query
Multiple Types Query
Multi-type filtering - mixed posts automatically includedWhen querying for multiple types, mixed posts are always relevant and included.
Best Practices
Content Organization
Content Organization
- Keep related content together: Use mixed media for content that tells a single story
- Maintain logical order: Add attachments in the order users should view them
- Use appropriate combinations: Match media types to your content needs
- Consider user experience: Don’t overwhelm with too many different types
Performance Optimization
Performance Optimization
- Upload in parallel: Upload different media types simultaneously
- Validate before upload: Check file sizes and formats client-side
- Show progress: Display upload progress for each media type
- Handle failures gracefully: Implement retry logic for individual uploads
- Cache uploads: Store uploaded file IDs to avoid re-uploading
User Experience
User Experience
- Preview all media: Let users preview all attachments before posting
- Support reordering: Allow users to change attachment order
- Clear media indicators: Show media type icons/badges
- Handle missing media: Gracefully handle cases where media fails to load
- Provide editing controls: Allow users to remove/replace individual items
Attachment Strategy
Attachment Strategy
- Limit total items: Stay within 10 attachment limit
- Balance media types: Don’t overload with one type
- Consider load time: More attachments = longer load time
- Optimize file sizes: Compress media before upload
- Use appropriate quality: Match quality to content importance
Troubleshooting
Attachment Limit Exceeded
Attachment Limit Exceeded
Problem: Cannot add more than 10 attachmentsSolution:
- Remove some attachments to stay within limit
- Split content into multiple posts if needed
- Prioritize most important media
Mixed Upload Failures
Mixed Upload Failures
Problem: Some media uploads fail while others succeedSolution:
- Track upload status for each media type separately
- Retry failed uploads individually
- Allow users to post with successful uploads only
- Provide clear feedback on which uploads failed
Structure Type Issues
Structure Type Issues
Problem: Post has unexpected
structureTypeSolution:- Verify attachment types in your request
- Check if deleted children are affecting classification
- Remember: any combination with audio = mixed
- Review automatic classification rules
Query Filtering Issues
Query Filtering Issues
Problem: Mixed posts not appearing in filtered queriesSolution:
- Set
includeMixedStructure: truefor single-type queries - Understand default filtering excludes mixed posts
- Use multiple type queries to automatically include mixed posts
Backward Compatibility: Existing single-type post creation methods (createImagePost, createVideoPost, etc.) continue to work unchanged. Mixed media posts are an additive feature that doesn’t break existing functionality.
Common Use Cases
Product Showcases
Combine product photos, demo videos, spec sheets (PDFs), and audio reviews
Event Coverage
Share event photos, highlight videos, attendee interviews (audio), and schedules (files)
Educational Content
Mix tutorial images, demo videos, downloadable resources, and audio explanations
Portfolio Pieces
Showcase work with images, process videos, case study PDFs, and client testimonials (audio)
News Articles
Combine article images, video clips, interview audio, and related documents
Travel Stories
Share photos, video clips, voice narration, and travel guides (PDFs)