createVideoMessage method

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createVideoMessage({
  1. required String videoFilePath,
  2. required String type,
  3. required int duration,
  4. required String snapshotPath,
  5. dynamic inputElement,
})

创建视频文件 videoFilePath 路径 type 视频类型,如 mp4 mov 等 duration 视频时长,单位 s snapshotPath 视频封面图片路径 inputElement 用于选择视频文件的 DOM 节点 (只有web端用到且必填)

Implementation

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createVideoMessage({
  required String videoFilePath,
  required String type,
  required int duration,
  required String snapshotPath,
  dynamic inputElement,
}) async {
  if (await pathExits(videoFilePath) && await pathExits(snapshotPath)) {
    return ImFlutterPlatform.instance.createVideoMessage(
      videoFilePath: videoFilePath,
      type: type,
      duration: duration,
      snapshotPath: snapshotPath,
      inputElement: inputElement,
    );
  }
  return V2TimValueCallback<V2TimMsgCreateInfoResult>.fromJson({
    "code": -5,
    "desc": "videoFilePath  or snapshotPath is not found",
    "data": V2TimMsgCreateInfoResult.fromJson(
      {
        "id": "",
        "messageInfo": V2TimMessage(
          elemType: 0,
        ),
      },
    ),
  });
}