clipVideo
Requires:
BaseKit≥3.14.2@ray-js/ray≥1.5.33
Platforms:
iOSAndroid
Method signature
clipVideo(params: )Minimum SDK versions
- iOS
ThingSmartBaseKitBizBundle - ≥ 6.0.3
- Android
com.thingclips.smart:thingsmart-bizbundle-basekit - ≥ 6.0.0
Description
Trim video
Parameters
| Property | Type | Required | Description | BaseKit Since | Minimum SDK versions |
|---|---|---|---|---|---|
filePath | string | Yes | Video file path; can be a temporary file path or a permanent file path (local path) | - | — |
startTime | number | Yes | Start time, in milliseconds | - | — |
endTime | number | Yes | End time, in milliseconds | - | — |
level | number | Yes | Target compressed resolution 1 - 480x854 Bitrate: 1572x1000 2 - 540x960 Bitrate: 2128x1000 3 - 720x1280 Bitrate: 3145x1000 4 - 1080x1920 Bitrate: 3500x1000 | - | — |
maxResolution | string | No | Maximum resolution, in a format such as "1920*1080", matching skill.resolution reported by the device. Interpreted as "long side*short side", regardless of video orientation. The output is scaled proportionally to fit within these dimensions without upscaling, up to 1920*1080. When provided, the output resolution no longer depends on level; otherwise, it is calculated based on level. | v3.42.3 | — |
maxBitrate | number | No | Maximum bitrate, in bps. The output bitrate is the lower of the recommended bitrate for the output resolution and this value. If omitted, the recommended bitrate is used. | v3.42.3 | — |
maxFps | number | No | Maximum frame rate. The output frame rate is the lowest of the source frame rate, this value, and 30. If omitted, it is fixed at 30. | v3.42.3 | — |
maxFileSize | number | No | Maximum output file size, in bytes. When provided, the video bitrate is allocated based on the trimmed duration, without exceeding maxBitrate or the recommended bitrate. The actual file size is checked after export. If the limit is exceeded, the video is exported once more at a lower bitrate. A failure is returned if the file still exceeds the limit or if the duration is too long to maintain a video bitrate of at least 300 kbps. If omitted, no file size limit is applied. | v3.42.3 | — |
complete | () => void | No | Completion callback (executed on both success and failure) | - | — |
success | (params: Object) => void | No | Callback on successful API call | - | — |
fail | (params: Object) => void | No | Failure callback | - | — |
success callback parameters
| Property | Type | Description | BaseKit Since | Minimum SDK versions |
|---|---|---|---|---|
videoClipPath | string | Trimmed video path | - | — |
width | number | Output video width, in pixels | v3.42.3 | — |
height | number | Output video height, in pixels | v3.42.3 | — |
frameRate | number | Output video frame rate | v3.42.3 | — |
bitrate | number | Target output video bitrate, in bps | v3.42.3 | — |
fileSize | number | Actual output file size, in bytes | v3.42.3 | — |
fail callback parameters
| Property | Type | Description |
|---|---|---|
errorMsg | string | Error message |
errorCode | string | number | Error code |
| Error extension |
Return Value
None