ChatMessage.createVideoSendMessage constructor

ChatMessage.createVideoSendMessage({
  1. required String targetId,
  2. required String filePath,
  3. String? displayName,
  4. int duration = 0,
  5. int? fileSize,
  6. String? thumbnailLocalPath,
  7. double? width,
  8. double? height,
  9. ChatType chatType = ChatType.Chat,
})

~english Creates a video message instance for sending.

Param targetId The ID of the message recipient.

  • For a one-to-one chat, it is the username of the peer user.
  • For a group chat, it is the group ID.
  • For a chat room, it is the chat room ID.

Param filePath The path of the video file.

Param displayName The video name.

Param duration The video duration in seconds.

Param fileSize The video file size in bytes.

Param thumbnailLocalPath The local path of the thumbnail, which is usually the first frame of video.

Param width The width of the video thumbnail, in pixels.

Param height The height of the video thumbnail, in pixels.

Param chatType The chat type, default is single chat, if it is group chat or chat room, see ChatType.

Return The message instance. ~end

~chinese 创建一条待发送的视频消息。

Param targetId 消息接收方,可以是:

  • 用户:用户 ID;
  • 群组:群组 ID;
  • 聊天室:聊天室 ID。

Param filePath 视频文件路径。

Param displayName 文件名。

Param duration 视频时长,单位是秒。

Param fileSize 视频文件大小。

Param thumbnailLocalPath 缩略图的本地路径,一般取视频第一帧作为缩略图。

Param width 缩略图宽度,单位是像素。

Param height 缩略图高度,单位是像素。

Param chatType 聊天类型, 默认为单聊,如果是群聊或者聊天室,可以参考ChatType

Return 消息体实例。 ~end

Implementation

ChatMessage.createVideoSendMessage({
  required String targetId,
  required String filePath,
  String? displayName,
  int duration = 0,
  int? fileSize,
  String? thumbnailLocalPath,
  double? width,
  double? height,
  ChatType chatType = ChatType.Chat,
}) : this.createSendMessage(
          chatType: chatType,
          to: targetId,
          body: ChatVideoMessageBody(
            localPath: filePath,
            displayName: displayName,
            duration: duration,
            fileSize: fileSize,
            thumbnailLocalPath: thumbnailLocalPath,
            width: width,
            height: height,
          ));