Message Download
Feature 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 Messages
Download multimedia files.
Method
Future<int> downloadMediaMessage(RCIMIWMediaMessage message, {RCIMIWDownloadMediaMessageListener? listener});
Parameter Description
Parameter | Type | Description |
---|---|---|
message | RCIMIWMediaMessage | The media message object to be downloaded |
listener | RCIMIWDownloadMediaMessageListener | The event listener for downloading media messages |
Return Value
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success, and the specific result needs to be implemented through the interface callback. Non-zero indicates that the current operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes. |
Code Example
RCIMIWDownloadMediaMessageListener? listener = RCIMIWDownloadMediaMessageListener(onMediaMessageDownloading: (RCIMIWMediaMessage? message, int? progress) {
//...
}, onDownloadingMediaMessageCanceled: (RCIMIWMediaMessage? message) {
//...
}, onMediaMessageDownloaded: (int? code, RCIMIWMediaMessage? message) {
//...
});
int? ret = await engine?.downloadMediaMessage(message, listener:listener);
Callback Methods
-
onMediaMessageDownloading
The listener for the interface call result.
Function(RCIMIWMediaMessage? message, int? progress)? onMediaMessageDownloading;
Parameter Description
Parameter | Type | Description |
---|---|---|
message | RCIMIWMediaMessage | The message being downloaded |
progress | int | The download progress |
Code Example
engine?.onMediaMessageDownloading = (RCIMIWMediaMessage? message, int? progress) {
//...
};
-
onMediaMessageDownloaded
The listener for the interface call result.
Function(int? code, RCIMIWMediaMessage? message)? onMediaMessageDownloaded;
Parameter Description
Parameter | Type | Description |
---|---|---|
code | int | The status code of the interface callback. 0 indicates success, and non-zero indicates an exception. |
message | RCIMIWMediaMessage | The message that was downloaded |
Code Example
engine?.onMediaMessageDownloaded = (int? code, RCIMIWMediaMessage? message) {
//...
};
Cancel Multimedia Message Download
Cancel the download of a multimedia message.
Method
Future<int> cancelDownloadingMediaMessage(RCIMIWMediaMessage message, {IRCIMIWCancelDownloadingMediaMessageCallback? callback});
Parameter Description
Parameter | Type | Description |
---|---|---|
message | RCIMIWMediaMessage | The media message object whose download is to be canceled |
callback | IRCIMIWCancelDownloadingMediaMessageCallback | The event callback for canceling the download of a media message. The SDK supports callback methods starting from version 5.3.1. Other callback methods for this interface are deprecated starting from version 5.4.0. If the callback parameter is provided, only the callback will be triggered. |
Return Value
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success, and the specific result needs to be implemented through the interface callback. Non-zero indicates that the current operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes. |
Code Example
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success, and the specific result needs to be implemented through the interface callback. Non-zero indicates that the current operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes. |
Callback Methods
- onDownloadingMediaMessageCanceled
The listener for the interface call result.
Function(int? code, RCIMIWMediaMessage? message)? onDownloadingMediaMessageCanceled;
Parameter Description
Parameter | Type | Description |
---|---|---|
code | int | The status code of the interface callback. 0 indicates success, and non-zero indicates an exception. |
message | RCIMIWMediaMessage | The message whose download was canceled |
Code Example
engine?.onDownloadingMediaMessageCanceled = (int? code, RCIMIWMediaMessage? message) {
//...
};