createVideoMessage
Introduction
create a video Message
Please do not provide a URL on network to path.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
videoFilePath | string | yes | The local absolute path of the video |
duration | number | yes | The duration of the video, in seconds. |
type | string | yes | The type of video. |
snapshotPath | string | yes | The path of the snapshot. |
Returned template
V2TimValueCallback<V2TimMsgCreateInfoResult>
{
code: number,
desc: string,
data: {
id: string,
messageInfo: V2TimMessage,
}
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
data | V2TimMsgCreateInfoResult | The video message created. |
Code example
import { TencentImSDKPlugin } from 'react-native-tim-js';
const createVideoMessageRes = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.createVideoMessage(
'本地视频文件绝对路径',
'mp4',
10,
'本地视频封面文件绝对路径'
);
if (createVideoMessageRes.code === 0) {
const id = createVideoMessageRes.data?.id;
const sendMessageRes = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.sendMessage({ id: id!, receiver: 'userID', groupID: 'groupID' });
if (sendMessageRes.code === 0) {
}
}