createVideoMessage

Introduction

create a video Message

For Android and iOS, you are supposed to provide the local absolute path of the video.

For Web, you should provide the input DOM element, with video selected.

Demo code shows here.

Please do not provide a URL on network to path.

Parameter details

Parameter name Parameter type Required Platform Description
videoFilePath String yes All The local absolute path of the video, used for Android and iOS.
duration int yes All The duration of the video, in seconds.
type String yes All The type of video.
snapshotPath String yes All The path of the snapshot.
inputElement dynamic no All The DOM element of the input, used for Web.

Returned template

V2TimValueCallback<V2TimMsgCreateInfoResult>

{
    code: int,
    desc: String,
    data: {
        id: String,
        messageInfo: V2TimMessage,
    }
}

Return value details

name type description
code int Request result: Error codes. 0 means success.
desc String The description of the failure.
data V2TimMsgCreateInfoResult The video message created.

Code example

    V2TimValueCallback<V2TimMsgCreateInfoResult> createVideoMessageRes =
        await TencentImSDKPlugin.v2TIMManager
            .getMessageManager()
            .createVideoMessage(
              videoFilePath: "The absolute path of the video file.", 
              type: "mp4", 
              duration: 10, 
              snapshotPath: "The absolute path of the snapshot of video.", 
            );
    if (createVideoMessageRes.code == 0) {
      String? id = createVideoMessageRes.data?.id;
      V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
          .v2TIMManager
          .getMessageManager()
          .sendMessage(id: id!, receiver: "userID", groupID: "groupID");
      if (sendMessageRes.code == 0) {
      }
    }

results matching ""

    No results matching ""