createSoundMessage method

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createSoundMessage({
  1. required String soundPath,
  2. required int duration,
})

创建音频文件 soundPath 音频文件地址 duration 时长

Implementation

Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createSoundMessage({
  required String soundPath,
  required int duration,
}) async {
  if (await pathExits(soundPath)) {
    return ImFlutterPlatform.instance.createSoundMessage(
      soundPath: soundPath,
      duration: duration,
    );
  }
  return V2TimValueCallback<V2TimMsgCreateInfoResult>.fromJson({
    "code": -5,
    "desc": "soundPath is not found",
    "data": V2TimMsgCreateInfoResult.fromJson(
      {
        "id": "",
        "messageInfo": V2TimMessage(
          elemType: 0,
        ),
      },
    ),
  });
}