SDKsAndroid
Create a video message from local paths
Create a video message from absolute video and thumbnail paths.
Construct a video message object using absolute filesystem paths on the local device. Provide the absolute paths for both the local video file and its thumbnail preview snapshot. When sending via Send a message, the SDK automatically uploads the video and thumbnail files.
Code example
String absoluteVideoPath = "/storage/emulated/0/DCIM/Camera/VID_20261012.mp4";
String mimeType = "video/mp4";
long durationSeconds = 15L;
String absoluteSnapshotPath = "/storage/emulated/0/DCIM/Camera/VID_thumb.jpg";
Message message = OpenIMClient.getInstance().messageManager.createVideoMessageFromFullPath(
absoluteVideoPath,
mimeType,
durationSeconds,
absoluteSnapshotPath
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
videoPath | String | Yes | Absolute filesystem path of the video file on the local device. Ensure read permissions are granted. |
mimeType | String | Yes | MIME type of the video (such as video/mp4). |
duration | long | Yes | Playback duration of the video in seconds. |
snapshotPath | String | Yes | Absolute filesystem path of the video thumbnail snapshot on the local device. |
Return value
Returns the created Message object with contentType set to MessageType.VIDEO.
State changes after the call
- Local initialization: Initializes the local
Messagestructure without starting network uploads. - Transmission: Call Send a message to deliver the message to a single user or group.
Was this page helpful?