> ## Documentation Index
> Fetch the complete documentation index at: https://social-b97141fb-feat-user-history-moderation-detail.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Video Posts

> Create video posts with uploaded video files using the current social.plus SDKs.

Video posts combine uploaded videos with an optional text caption. Upload the videos first, then pass the uploaded video objects or file IDs to the post creation API.

<Info>
  This page focuses on the SDK call that creates the post. See [Video Handling](/social-plus-sdk/core-concepts/content-handling/files-images-and-videos/video-handling) for upload steps, supported file inputs, processing behavior, and upload constraints.
</Info>

<CardGroup cols={2}>
  <Card title="Uploaded Videos" icon="video">
    Create posts from video objects or file IDs returned by the file upload flow.
  </Card>

  <Card title="Caption Support" icon="text">
    Add text, metadata, mentions, or other SDK-supported post fields alongside the videos.
  </Card>
</CardGroup>

## Parameters

| Parameter | Required | Platforms | Description |
| - | - | - | - |
| `videos`, `uploadedVideos`, or `fileId` | Yes | TypeScript, iOS, Android, Flutter | Uploaded video objects or video file IDs, depending on SDK. |
| `text` | No | TypeScript, iOS, Android, Flutter | Caption text shown with the video post. |
| `targetType` | Yes | TypeScript, iOS, Android, Flutter | Feed target, usually `community` or `user`. |
| `targetId` | Yes | TypeScript, iOS, Android, Flutter | Community ID or user ID for the target feed. |
| `metadata` | No | TypeScript, iOS, Android, Flutter | Custom metadata stored with the post where supported. |
| `mentionees` | No | TypeScript, iOS, Android, Flutter | User mention payload where supported by the platform builder. |
| `productTags` | No | TypeScript, Android, iOS | Products tagged in the post text. Text product tag types: `Amity.TextProductTag`, `AmityTextProductTag`, `AmityProductTag.Text`. |
| `attachmentProductTags` | No | TypeScript, Android, iOS | Products tagged on individual video attachments. An `AmityAttachmentProductTags` container, keyed by each attachment's `fileId`. |

<Note>
  **Product tags (SDK API).** A video post has a text parent and a video child. `productTags` tags products mentioned in the parent **text**. `attachmentProductTags` tags products on the child **media attachment**, and is not an array: it is an `AmityAttachmentProductTags` container that maps each attachment's `fileId` to that attachment's media tags. Flutter does not expose product tags on any post builder. See [Tag Products](#tag-products) below for both. UIKit's product-tag UI is a separate surface and may support fewer post types; see [UIKit Product Tagging](/uikit/components/social/product-tagging). For tagging limits and tap-through behavior, see [Product Tagging](/uikit/components/social/posts#product-tagging).
</Note>

## Create a Video Post

The examples below create a video post in a community. Replace the target with the SDK's user-feed target when posting to a user.

<CodeGroup>
  ```swift iOS theme={null}
  func createVideoPost(
      uploadedVideos: [AmityVideoData],
      communityId: String
  ) async throws -> AmityPost {
      let postRepository = AmityPostRepository()
      let builder = AmityVideoPostBuilder()
      builder.setVideos(uploadedVideos)
      builder.setText("Video from today")

      return try await postRepository.createVideoPost(
          builder,
          targetId: communityId,
          targetType: .community,
          metadata: nil,
          mentionees: nil
      )
  }
  ```

  ```kotlin Android theme={null}
  fun createVideoPost(
      uploadedVideos: Set<AmityVideo>,
      communityId: String
  ) {
      postRepository.createVideoPost(
          targetType = AmityPost.TargetType.COMMUNITY,
          targetId = communityId,
          videos = uploadedVideos,
          text = "Video from today"
      )
          .subscribe({ post ->
              showSuccessMessage(post.getPostId())
          }, { error ->
              handleGeneralError(error)
          })
  }
  ```

  ```typescript TypeScript theme={null}
  import { PostRepository } from "@amityco/ts-sdk";

  const { data: post } = await PostRepository.createPost({
    targetType: "community",
    targetId: communityId,
    data: {
      text: "Video from today",
    },
    attachments: [
      {
        type: "video",
        fileId,
      },
    ],
  });
  ```

  ```dart Flutter theme={null}
  Future<AmityPost> createVideoPost(List<AmityVideo> uploadedVideos) {
    return AmitySocialClient.newPostRepository()
        .createPost()
        .targetCommunity(communityId)
        .video(uploadedVideos)
        .text('Video from today')
        .post();
  }
  ```
</CodeGroup>

## Tag Products

TypeScript, Android, and iOS accept two separate product inputs when creating a video post. The text tag is applied to the parent; the attachment tag is applied to the video child.

| Input | Tags what | Shape |
| - | - | - |
| `productTags` | Products named in the post text | An array of text product tags, each with a character range |
| `attachmentProductTags` | Products shown in one video | An `AmityAttachmentProductTags` container, keyed by `fileId` |

Build `attachmentProductTags` by setting the tags for each uploaded video's `fileId`. Videos you do not set tags for stay untagged.

<CodeGroup>
  ```swift iOS theme={null}
  let postRepository = AmityPostRepository()
  let builder = AmityVideoPostBuilder()
  builder.setVideos(uploadedVideos)
  builder.setText("Wearing the featured product today")

  let attachmentTags = AmityAttachmentProductTags()
  attachmentTags.set(
      fileId: uploadedVideos[0].fileId,
      tags: [AmityMediaProductTag(productId: "prod_001")]
  )

  let post = try await postRepository.createVideoPost(
      builder,
      targetId: communityId,
      targetType: .community,
      metadata: nil,
      mentionees: nil,
      productTags: [
          AmityTextProductTag(productId: "prod_001", index: 12, length: 12)
      ],
      attachmentProductTags: attachmentTags
  )
  ```

  ```kotlin Android theme={null}
  val attachmentTags = AmityAttachmentProductTags.Builder()
  attachmentTags.set(
      uploadedVideos.first().getFileId(),
      listOf(AmityProductTag.Media(productId = "prod_001"))
  )

  postRepository.createVideoPost(
      targetType = AmityPost.TargetType.COMMUNITY,
      targetId = communityId,
      videos = uploadedVideos,
      text = "Wearing the featured product today",
      productTags = listOf(
          AmityProductTag.Text(
              productId = "prod_001",
              text = "featured product",
              index = 12,
              length = 16
          )
      ),
      attachmentProductTags = attachmentTags.build()
  )
      .subscribe({ post ->
          showSuccessMessage(post.getPostId())
      }, { error ->
          handleGeneralError(error)
      })
  ```

  ```typescript TypeScript theme={null}
  import { AmityAttachmentProductTags, PostRepository } from "@amityco/ts-sdk";

  const attachmentTags = new AmityAttachmentProductTags();
  attachmentTags.set(fileId, [{ productId: "prod_001" }]);

  const { data: post } = await PostRepository.createPost({
    targetType: "community",
    targetId: communityId,
    data: {
      text: "Wearing the featured product today",
    },
    attachments: [{ type: "video", fileId }],
    productTags: [
      { productId: "prod_001", text: "featured product", index: 12, length: 16 },
    ],
    attachmentProductTags: attachmentTags,
  });
  ```
</CodeGroup>

## Notes

* TypeScript accepts video attachments as `{ type: "video", fileId }`.
* Android accepts a `Set<AmityVideo>`.
* iOS accepts `[AmityVideoData]`.
* Flutter accepts `List<AmityVideo>`.

For mixed attachment types, use [Mixed Media Posts](./mixed-media-post).

## Related Topics

<CardGroup cols={3}>
  <Card title="Video Handling" icon="upload" href="/social-plus-sdk/core-concepts/content-handling/files-images-and-videos/video-handling">
    Upload videos before creating video posts.
  </Card>

  <Card title="Clip Posts" icon="film" href="./clip-post">
    Create short-form clip posts where supported.
  </Card>

  <Card title="Mixed Media Posts" icon="layer-group" href="./mixed-media-post">
    Combine videos with other supported media attachments.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.