createVideoMessageFromFullPath
Feature Introduction
Description
Create a video message. The SDK internally extracts video information from the full path and creates a video message.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<Message> createVideoMessageFromFullPath({
required String videoPath,
required String videoType,
required int duration,
required String snapshotPath,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
videoPath | String | Yes | Absolute path |
videoType | String | Yes | Video type |
duration | int | Yes | Duration |
snapshotPath | String | Yes | Video cover path |
Return Result
Name | Type | Description |
---|---|---|
~ | Message | Successful return |
Code Example
Message msg = await OpenIM.iMManager.messageManager.createVideoMessageFromFullPath(videoPath: videoPath, videoType: videoType, duration: duration, snapshotPath: snapshotPath);
//todo
Function Prototype
+ (OIMMessageInfo *)createVideoMessageFromFullPath:(NSString *)videoPath
videoType:(NSString *)videoType
duration:(NSInteger)duration
snapshotPath:(NSString *)snapshotPath;
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
videoPath | NSString | Yes | Absolute path |
videoType | NSString | Yes | Video type |
duration | NSInteger | Yes | Duration |
snapshotPath | NSString | Yes | Video cover path |
Return Result
Name | Type | Description |
---|---|---|
message | OIMMessageInfo | Successful return |
Code Example
OIMMessageInfo *message = [OIMMessageInfo createVideoMessageFromFullPath:@"" videoType:@"" duration:1 snapshotPath:@""];
Function Prototype
public Message createVideoMessageFromFullPath(String videoPath, String videoType, long duration, String snapshotPath)
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
videoPath | String | Yes | Absolute path |
videoType | String | Yes | Video type |
duration | int | Yes | Duration |
snapshotPath | String | Yes | Video cover path |
Return Result
Name | Type | Description |
---|---|---|
~ | Message | Successful return |
Code Example
Message Message= OpenIMClient.getInstance().messageManager. createVideoMessageFromFullPath( videoPath, videoType, duration, snapshotPath)
Note
For the Web version, it's recommended to use createVideoMessageByURL or createVideoMessageByFile.
Function Prototype
IMSDK.asyncApi('createVideoMessageFromFullPath', operationID: string, {
videoPath: string,
videoType: string,
duration: number,
snapshotPath: string,
}): Promise<MessageItem>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, for problem locating, keep unique. Recommended to use current time and a random number. |
videoPath | string | Yes | Absolute path of the video file |
videoType | string | Yes | Video type, typically the file extension |
duration | number | Yes | Duration |
snapshotPath | string | Yes | Absolute path of the video cover |
Return Result
Using the
openim-uniapp-polyfill
package makes the function Promise-based. When calling, usethen
andcatch
to check and handle success and failure callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<MessageItem> | Success callback |
Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('createVideoMessageFromFullPath', IMSDK.uuid(), {
videoPath: '',
videoType: 'mp4',
duration: 12,
snapshotPath: '',
})
.then((data) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.createVideoMessageFromFullPath({
videoPath: string,
videoType: string,
duration: number,
snapshotPath: string,
}, operationID: string): Promise<MessageItem>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, for problem locating, keep unique. Recommended to use current time and a random number. |
videoPath | string | Yes | Absolute path of the video file |
videoType | string | Yes | Video type, typically the file extension |
duration | number | Yes | Duration |
snapshotPath | string | Yes | Absolute path of the video cover |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<MessageItem> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.createVideoMessageFromFullPath({
videoPath: '',
videoType: 'mp4',
duration: 12,
snapshotPath: '',
}, 'operationID')
.then((data) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static Message CreateVideoMessageFromFullPath(string videoFullPath, string videoType, long duration, string snapshotFullPath);
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
videoPath | string | Yes | Absolute path of the video file |
videoType | string | Yes | Video type, typically the file extension |
duration | long | Yes | Duration |
snapshotFullPath | string | Yes | Absolute path of the video cover |
Return Result
Parameter Name | Type | Description |
---|---|---|
message | Message | Message Struct |
Code Example
var msg = IMSDK.CreateVideoMessageFromFullPath(videoFullPath,videoType,duration,snapshotFullPath);