Message Download
Description
- The SDK provides functionalities for downloading, canceling, and pausing multimedia files.
- For sending multimedia messages, refer to the "Sending Media Messages" section in Message Sending.
Download Multimedia Message
Download multimedia files.
Method
downloadMediaMessage(
  message: RCIMIWMediaMessage, 
  listener: RCIMIWDownloadMediaMessageListener
): Promise<number>;
Parameter Description
| Parameter | Type | Description | 
|---|---|---|
| message | RCIMIWMediaMessage | The media message entity to be downloaded | 
| listener | RCIMIWDownloadMediaMessageListener | Event listener for downloading media messages | 
Return Value
| Return Value | Description | 
|---|---|
| number | Status code of the current operation. 0 indicates success, and the specific result needs to be implemented in the interface callback. Non-zero indicates failure, and the interface callback will not be triggered. Refer to the error code for detailed errors. | 
Code Example
const listener = {
    onMediaMessageDownloading: (message: RCIMIWMediaMessage, progress: number) => {
        //...
    },
    onDownloadingMediaMessageCanceled: (message: RCIMIWMediaMessage) => {
        currentDownloadingMediaMessage = null;
        //...
    },
    onMediaMessageDownloaded: (code: number, message: RCIMIWMediaMessage) => {
        currentDownloadingMediaMessage = null;
        //...
    },
};
let code = await engine.downloadMediaMessage(message, listener);
Cancel Multimedia Message
Cancel the download of a multimedia message.
Method
cancelDownloadingMediaMessage(
  message: RCIMIWMediaMessage, 
  callback: IRCIMIWCancelDownloadingMediaMessageCallback
): Promise<number>;
Parameter Description
| Parameter | Type | Description | 
|---|---|---|
| message | RCIMIWMediaMessage | The media message entity to cancel downloading | 
| callback | IRCIMIWCancelDownloadingMediaMessageCallback | Callback for the interface call result. | 
Return Value
| Return Value | Description | 
|---|---|
| number | Status code of the current operation. 0 indicates success, and the specific result needs to be implemented in the interface callback. Non-zero indicates failure, and the interface callback will not be triggered. Refer to the error code for detailed errors. | 
Code Example
| Return Value | Description | 
|---|---|
| number | Status code of the current operation. 0 indicates success, and the specific result needs to be implemented in the interface callback. Non-zero indicates failure, and the interface callback will not be triggered. Refer to the error code for detailed errors. |