tencent cloud

Video on Demand

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Product Features
Features
Strengths
Scenarios
Solutions
Professional Edition
Introduction to Video On Demand Professional Edition
Quick Start
Console Guide
Development Guide
Purchase Guide
Billing Overview
Billing Modes
Purchase Guide
Viewing Bills
Renewal
Overdue Policy
Refund Policy
Getting Started
Console Guide
Console Overview
Service Overview
Application Management
Media Management
Package Management
License Management
Real-Time Log Analysis
Practical Tutorial
Media Upload
Smart Cold Storage of VOD Media Asset Files
Video Processing
Distribution and Playback
How to Receive Event Notification
How to Migrate Files from Origin Server to VOD
Live Recording
How to Pull from Custom Origin Servers
How to Use EdgeOne to Distribute Content in VOD
Development Guide
Media Upload
Media Processing
Video AI
Event Notification
Video Playback
Media Encryption and Copyright Protection
Broadcast Channel
CAM
Media File Download
Subapplication System
Error Codes
Player SDK
Overview
Basic Concepts
Features
Free Demo
Free Trial License
Purchase Guide
SDK Download
Licenses
Player Guide
Integration (UI Included)
Integration (No UI)
Advanced Features
API Documentation
Player Adapter
Player SDK Policy
Server APIs
History
Introduction
API Category
Other APIs
Media Processing APIs
Parameter Template APIs
Task Management APIs
Media Upload APIs
Media Management APIs
Event Notification Relevant API
Media Categorization APIs
Domain Name Management APIs
Distribution APIs
AI-based Sample Management APIs
Region Management APIs
Data Statistics APIs
Carousel-Related APIs
Just In Time Transcode APIs
No longer recommended APIs
Making API Requests
AI-based image processing APIs
Task Flow APIs
Data Types
Error Codes
Video on Demand API 2024-07-18
FAQs
Mobile Playback
Fees
Video Upload
Video Publishing
Video Playback
Web Playback
Full Screen Playback
Statistics
Access Management
Cold Storage
Agreements
Service Level Agreement
VOD Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Upload SDK for Flutter

PDF
Focus Mode
Font Size
Last updated: 2026-01-14 16:25:47
VOD provides an SDK for uploading videos from Flutter clients. For details about the upload process, see Guide.
SDK Name
Cloud Video on Demand Flutter Upload SDK
Version Number
V1.5.2
SDK Introduction
Provides a scenario for app end-users to upload local videos to the Cloud Video on Demand platform.
Download SDK
1. Click to download the Flutter Upload SDK and source code, unzip the downloaded compressed package, and you can see the vod_upload directory.
2. The upload source code is located in the vod_upload/lib directory.

Environment Setup

Flutter:
Flutter 3.0.0 and above
Dart 2.19.2 and below 4.0
Android:
Android Studio 3.5 and above
Android 4.1 and above
iOS:
Xcode 11.0 and above
iOS 9.0 and above
Make sure your project has a valid developer signature set up

Quick Integration

Add Dependencies

1. Copy the SDK source code to your project directory.
2. Add the SDK to pubspec.yaml
vod_upload_flutter:
path: ./vod_upload
3. Run the command flutter pub get in the root directory of your project to refresh the dependencies.
Note:
1. It is recommended to run flutter pub get command separately in the root directory, SDK directory, and SDK Example directory to avoid potential errors.
2. The SDK Example directory is the test project for the SDK. You can delete it if not needed.

Add Native Configurations

Android

Add the following configurations to AndroidManifest.xml.
<!-- Network permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

iOS

Add the following configuration to Info.plist in iOS.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Note:
If you want to run the provided Demo in the SDK, you should also declare permission to use the photo library.

Usage

1. Import the file.
import 'package:vod_upload_flutter/txugc_publish.dart';
2. Create an object.
var uploader = TXUGCPublish(
id: "",
);
Note:
The id can be any string as long as it is unique. The main purpose is to map the Flutter object to the native layer object.

API

Upload Video

uploader.publishVideo(TXPublishParam(
signature: "",
videoPath: "",
fileName: "",
));

Cancel Video Upload

uploader.cancelUploadVideo();

Resume Video Upload

uploader.resumeUploadVideo(TXPublishParam(
signature: "",
videoPath: "",
fileName: "",
));

Upload Media File

uploader.publishMedia(TXMediaPublishParam(
signature: "",
mediaPath: "",
fileName: "",
));

Cancel Media File Upload

uploader.cancelUploadMedia();

Resume Media File Upload

uploader.resumeUploadMedia(TXMediaPublishParam(
signature: "",
mediaPath: "",
fileName: "",
));

Prepare Upload

TXUGCPublish.prepareUpload(signature, callback);
Note:
Prepare upload is a static method.

Get Upload Information

// On Android, you can only get information during the upload process, while on iOS, you can get information throughout the process.
uploader.getStatusInfo();

Report AppId

uploader.setAppId(appId);

Set Video Upload Callback

uploader.setVideoListener(listener);

Set Media Upload Callback

uploader.setMediaListener(listener);

Callback Interfaces and Parameter Explanations

Video Upload Parameters

TXPublishParam
Field
Type
Required
Explanation
Default Value
signature
string
Yes
Signature
null
videoPath
string
Yes
Video path
null
fileName
string
Yes
File name
null
enableResume
boolean
No
Enable resumable upload
true
enableHttps
boolean
No
Enable HTTPS
false
coverPath
string
No
Cover image
null
enablePreparePublish
boolean
No
Enable prepare upload (can be manually triggered if disabled)
true
sliceSize
integer
No
Chunk size (minimum 1M, maximum 10M, default 0, which means the file size divided by 10)
0
concurrentCount
integer
No
Concurrent number of chunk uploads (if <=0, the default value of 2 will be used)
-1

Media Upload Parameters

TXMediaPublishParam
Field
Type
Required
Explanation
Default Value
signature
string
Yes
Signature
null
mediaPath
string
Yes
Media file path
null
fileName
string
Yes
File name
null
enableResume
boolean
No
Enable resumable upload
true
enableHttps
boolean
No
Enable HTTPS
false
coverPath
string
No
Cover image
null
enablePreparePublish
boolean
No
Enable prepare upload (can be manually triggered if disabled)
true
sliceSize
integer
No
Chunk size (minimum 1M, maximum 10M, default 0, which means the file size divided by 10)
0
concurrentCount
integer
No
Concurrent number of chunk uploads (if <=0, the default value of 2 will be used)
-1

Video Upload Callback

ITXVideoPublishListener
Method
Return Type
Explanation
onPublishProgress
void
Upload progress callback
onPublishComplete
void
Upload completion callback
Parameter explanation:
onPublishProgress
Parameter
Type
Explanation
uploadBytes
integer
Number of bytes uploaded
totalBytes
integer
Total number of bytes
onPublishComplete
Parameter
Type
Explanation
result
TXPublishResult
Upload result
TXPublishResult
Parameter
Type
Explanation
retCode
integer
Error code
descMsg
string
Error description
videoId
string
Video file ID
videoURL
string
Video playback URL
coverURL
string
Cover image storage URL

Media File Upload Callback

ITXMediaPublishListener
Method
Return Type
Explanation
onMediaPublishProgress
void
Upload progress callback
onMediaPublishComplete
void
Upload completion callback
Parameter explanation:
onMediaPublishProgress
Parameter
Type
Explanation
uploadBytes
integer
Number of bytes uploaded
totalBytes
integer
Total number of bytes
onMediaPublishComplete
Parameter
Type
Explanation
result
TXMediaPublishResult
Upload result
TXMediaPublishResult
Parameter
Type
Explanation
retCode
integer
Error code
descMsg
string
Error description
mediaId
string
Media file ID
mediaURL
string
Media file URL

Prepare Upload Callback

IPrepareUploadCallback
Method
Return Type
Explanation
onLoading
void
Prepare upload start callback
onFinish
void
Prepare upload completion callback

Upload Status Information

ReportInfo
Field
Type
Explanation
reqType
string
Request type, indicating the current step
errCode
string
Error code
cosErrCode
string
COS upload error code
errMsg
string
Error message
reqTime
string
Request start time for the current step
reqTimeCost
string
Time spent on the current step
fileSize
string
File size
fileType
string
File type
fileName
string
File name
fileId
string
File ID
appId
string
VOD App ID set through TXUGCPublish
reqServerIp
string
IP address accessed during the current step
reportId
string
Custom report ID provided by the customer, can be passed through the TXUGCPublish constructor
reqKey
string
Request key, usually composed of the last modification time of the file and the start time of this upload
vodSessionKey
string
Session key from the VOD server, obtained from the upload request interface
cosRegion
string
Region accessed during the current upload
requestId
string
Request ID for the current COS upload
cosVideoPath
string
Path for the current COS video upload
vodErrCode
integer
Signaling request error code
useHttpDNS
integer
Whether to use httpDns for domain name resolution
useCosAcc
integer
Whether COS domain name acceleration is enabled
tcpConnTimeCost
integer
Time spent on connecting to the server in the current step
recvRespTimeCost
integer
Time spent on receiving server response in the current step


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback