Cancel a video upload session under the media module
Parameters for cancelling video upload
Response indicating cancellation
Cancel a video upload session
Parameters for cancelling video upload
Parameters for v2.media_space.cancel_video_upload
The ID of this upload session, returned in init_video_upload
Response indicating cancellation
Complete the video upload under the media module
Parameters for completing video upload
Response indicating completion
Complete the video upload and start transcoding
Parameters for completing video upload
Parameters for v2.media_space.complete_video_upload
All uploaded sequence numbers
Upload performance tracking data
The ID of this upload session, returned in init_video_upload
Response indicating completion
const startTime = Date.now();
// ... upload all parts ...
const uploadCost = Date.now() - startTime;
await sdk.media.completeVideoUpload({
video_upload_id: videoUploadId,
part_seq_list: [0, 1, 2, 3],
report_data: {
upload_cost: uploadCost
}
});
Notes:
Query the upload status and result of a video upload under the media module
Parameters for querying video status
Response containing upload status and video info
Query the upload status and result of a video upload
Parameters for querying video status
Parameters for v2.media_space.get_video_upload_result
The video_upload_id returned by init_video_upload
Response containing upload status and video info
const result = await sdk.media.getVideoUploadResult({
video_upload_id: videoUploadId
});
if (result.response.status === 'SUCCEEDED') {
console.log('Video URL:', result.response.video_info.video_url_list);
console.log('Duration:', result.response.video_info.duration);
} else if (result.response.status === 'FAILED') {
console.error('Upload failed:', result.response.message);
}
Upload Status:
Initiate a video upload session under the media module
Parameters for initiating video upload
Response containing video_upload_id and part_size
Initiate a video upload session
Parameters for initiating video upload
Parameters for v2.media_space.init_video_upload
MD5 of video file
Size of video file in bytes (maximum 30MB)
Response containing video_upload_id
Upload multiple image files for general use
Parameters for uploading images
Parameters for v2.media_space.upload_image
The image files to be uploaded as buffers (up to 9 images)
Optionalratio?: MediaSpaceImageRatioImage ratio (only for whitelisted sellers)
Optionalscene?: MediaSpaceImageSceneScene where the picture is used
Response containing uploaded image information
// Upload product images (square processing)
const result = await sdk.media.uploadImage({
image: [Buffer.from('image-1'), Buffer.from('image-2')],
scene: 'normal',
ratio: '1:1'
});
// Upload description images (no processing)
const descResult = await sdk.media.uploadImage({
image: Buffer.from('desc-image-bytes'),
scene: 'desc'
});
Image Requirements:
Upload images for specific business scenarios (e.g., returns)
Parameters for uploading images
Parameters for v2.media.upload_image
Defines the business type of the uploaded image
The image files to be uploaded as buffers
Defines the purpose of the uploaded image under the specified business type
Response containing uploaded image information
Upload a video part under the media module
Parameters for uploading video part
Response indicating upload success
Upload a video file by parts
Parameters for uploading video part
Parameters for v2.media_space.upload_video_part
MD5 of this part
The content of this part of file as a buffer (exactly 4MB except last part)
Sequence of the current part, starts from 0
The video_upload_id returned by init_video_upload
Response indicating upload success
// Upload video parts sequentially
for (let i = 0; i < partCount; i++) {
await sdk.media.uploadVideoPart({
video_upload_id: videoUploadId,
part_seq: i,
content_md5: partMd5,
part_content: Buffer.from('part-bytes')
});
}
Part Requirements:
MediaManager handles media upload operations for the Shopee API
Provides methods for: