Short Video Message
Users can send short video messages through the IMKit gallery (local album) or the short video plugin. The messages will appear in the message list component of the chat UI. By default, the plugin sends messages containing the short video message object RCSightMessage (type identifier: RC:SightMsg
).
Limitations
The short video feature currently has the following restrictions:
- IMKit only supports sending short video messages in one-to-one chat and group chat.
- If using the short video plugin for recording, the maximum duration is 10 seconds.
- For videos selected from the local album, note that the default server-side video duration limit is 2 minutes. To adjust this limit, contact our sales team.
- Only
H.264
+AAC
encoded video files are supported, as IMKit's short video recording and playback only implement this encoding combination. - For App Keys using IM Flagship Edition or IM Premium Edition, file storage duration defaults to 180 days (excluding short video files, which are stored for 7 days). Note that the IM Commercial Edition (discontinued) defaults to 7 days. For details about IM Flagship Edition or IM Premium Edition features and pricing, refer to the RC official pricing page and billing documentation.
Usage
We recommend integrating the IMKit short video plugin for short video messaging.
Integrate the Short Video Plugin
The IMKit short video plugin handles message registration, recording, and playback. Once integrated, the short video messaging option automatically appears in the extended panel of the input area for one-to-one and group chats.
Choose between Framework or source code integration based on your app's IMKit integration method. Do not mix Framework and source code integration.
-
Import the Short Video Plugin Framework
pod 'RongCloudIM/Sight','~> x.y.z' #Short video
-
Import the Short Video Plugin Source Code
pod 'RongCloudOpenSource/Sight','~> x.y.z' #Short video
x.y.z represents the specific version. Check the latest version on the RC official SDK download page or CocoaPods repository.
Without the Short Video Plugin
If your project doesn't use the IMKit short video plugin but still needs to support sending short videos from local storage, manually register RCSightMessage
with IMLib; otherwise, the SDK cannot send short video messages. You'll also need to implement recording and playback (handled in the chat UI message click event). For IMKit ≧ 5.2.4, override the registerCustomCellsAndMessages
method in the chat UI to register the message type and bind the display template.
- (void)registerCustomCellsAndMessages {
[super registerCustomCellsAndMessages];
///Register custom test message cell
[self registerClass:[RCSightMessageCell class] forMessageClass:[RCSightMessage class]];
}
For details, see Customize Message Display.
Select Short Videos from Local Album
Prerequisite: After integrating the IMKit short video plugin, the plugin internally registers the RCSightMessage type with IMLib. Complete plugin integration before configuring this, or the SDK won't recognize short video messages.
By default, the IMKit photo plugin excludes video files when opening the local album, preventing users from selecting videos to send.
Modify the global configuration to include video files in the local album selection.
//Enable video file inclusion in media selection
RCKitConfigCenter.message.isMediaSelectorContainVideo = YES;
Send Short Video Messages
Users can tap the +
button in the input bar to expand the extension panel, then select the Photo or Camera icon to send short video messages.
Customization
Adjust Short Video Compression Quality
Short video files are compressed to a resolution of 544 * 960
. The first frame generates a thumbnail for display in the chat UI. By default, the SDK generates thumbnails at 30% of the original quality, with the longest side not exceeding 240 px, before uploading and sending.
We generally recommend keeping the default compression settings. To adjust compression quality, refer to the knowledge base article How to Modify SDK Default Image and Video Compression Settings.
Customize Short Video Message UI
IMKit generates and sends short video messages (RC:SightMsg
) by default, displayed in the message list using RCFileMessageCell
. To modify the built-in message style, customize the message cell and provide it to the SDK.
All message templates in IMKit inherit from RCMessageCell
, so custom cells must also subclass RCMessageCell
. For details, see Customize Message Display.
Alternatively, replace the style resources, string resources, and icon resources referenced in the short video message display template within RongCloud.bundle
. Refer to the resources used in the IMKit source file RCSightMessageCell.m.
To modify recording or playback UI, review the IMKit short video plugin source code Sight.
Dynamically Hide the Short Video Option
To dynamically modify visibility, remove the specific extension item via RCConversationViewController
's chatSessionInputBarControl.pluginBoardView
before displaying the chat UI.
For details, see Input Area.