createSoundMessage method
创建音频文件
soundPath
音频文件地址
duration
时长
Implementation
Future<V2TimValueCallback<V2TimMsgCreateInfoResult>> createSoundMessage({
required String soundPath,
required int duration,
}) async {
if (await pathExits(soundPath)) {
if (kIsWeb) {
return TencentCloudChatSdkPlatform.instance.createSoundMessage(
soundPath: soundPath,
duration: duration,
);
}
V2TimMsgCreateInfoResult result = TIMMessageManager.instance.createSoundMessage(
soundPath: soundPath,
duration: duration,
);
return V2TimValueCallback<V2TimMsgCreateInfoResult>.fromObject(result);
}
return V2TimValueCallback<V2TimMsgCreateInfoResult>.fromJson({
"code": -5,
"desc": "soundPath is not found",
"data": V2TimMsgCreateInfoResult.fromJson(
{},
),
});
}