tencent cloud

User Generated Short Video SDK

뉴스 및 공지사항
Release Notes
The “startPlay” API of the UGSV SDK Renamed
제품소개
Overview
Features
Use Cases
Concepts
구매 가이드
Pricing Overview
Refund Policy
라이선스 가이드
Adding and Renewing a License
Configuring and Viewing a License
SDK 다운로드
SDK Download
Release Notes (App)
UI 통합 솔루션 포함
UGSV Demo App
Source Code Description (iOS)
Source Code Description (Android)
UI 통합 솔루션 없음
SDK Integration
Capturing and Shoot
Preview, Clipping, and Splicing
Upload and Playback
Tencent Effect SDK
Advanced Features and Special Effects
API 문서
Editing
Shooting
기술적 지원
Error Codes
Feature FAQs
일반적인 문제
Upload
Android Compilation
Android
iOS
License
UGSV 정책
개인 정보 보호 정책
데이터 처리 및 보안 계약

Android

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2022-05-24 16:09:04

Connection Process

Short video release: upload a .mp4 file to Tencent Video Cloud and get the online watch URL. Tencent Video Cloud can meet various video watch needs such as nearby scheduling, instant live streaming and playback, dynamic acceleration, and global connection, delivering a smooth watch experience.



Step 1. Use the TXUGCRecord API to shoot a short video, and a .mp4 short video file will be generated after the shoot ends and be called back.
Step 2. Your application applies for an upload signature ("credential" for the application to upload the .mp4 file to VOD) to your business server. To ensure the security, upload signatures should be distributed by your business server but not generated by the client application.
Step 3. Use the TXUGCPublish API to publish the video. After the video is successfully published, the SDK will call back the watch URL to you.

Notes

You should never write the SecretID or SecretKey for upload signature calculation into the client code of the application, as their disclosure will cause security risks. If attackers get such information by cracking the application, they can misappropriate your traffic and storage service.
The correct practice is to generate a one-time upload signature by using the SecretID and SecretKey on your server and send the signature to the application.
When publishing a short video, please make sure that the Signature field is correctly passed in; otherwise, the release will fail.

Connection Directions

Integrate the short video upload feature as instructed in Upload SDK for Android.

1. Select a video


Uploa
ded a shot, edited, or spliced video or select a local video for upload.

2. Compress the video


Video
compression can reduce the short video file size but will also reduce the video definition. You can determine whether to compress videos as needed.
Use the TXVideoEditer.generateVideo(int videoCompressed, String videoOutputPath) API to compress the video. Four resolutions are supported for compression currently, and compression with customizable bitrate will be supported in the future.

3. Publish the video


Publis
h the generated .mp4 file to Tencent Cloud. The application needs to get the upload signature with a short validity period for file upload as instructed in Signature Distribution. TXUGCPublish (in TXUGCPublish.java) is used to publish .mp4 files to VOD so as to meet various video watch needs such as nearby scheduling, instant live streaming and playback, dynamic acceleration, and global connection.
mVideoPublish = new TXUGCPublish(TCVideoPublisherActivity.this.getApplicationContext());
// Checkpoint restart is used for file release by default
TXUGCPublishTypeDef.TXPublishParam param = new TXUGCPublishTypeDef.TXPublishParam();
param.signature = mCosSignature; // Enter the upload signature calculated in step 4
// Video file path generated by shoot, which can be obtained through the `onRecordComplete` callback of `ITXVideoRecordListener`
param.videoPath = mVideoPath;
// First-frame video preview generated by shoot, which can be obtained through the `onRecordComplete` callback of `ITXVideoRecordListener`
param.coverPath = mCoverPath;
mVideoPublish.publishVideo(param);
The release process and result will be returned through the TXRecordCommon.ITXVideoPublishListener API (in the TXRecordCommon.java header file):
onPublishProgress is used to return the release progress, the uploadBytes parameter indicates the number of uploaded bytes, and the totalBytes parameter indicates the total number of bytes that need to be uploaded.
void onPublishProgress(long uploadBytes, long totalBytes);
onPublishComplete is used to return the release result.
void onPublishComplete(TXPublishResult result);
The fields in the TXPublishResult parameter and their descriptions are as detailed below:
Field
Description
errCode
Error code.
descMsg
Error message.
videoURL
VOD address of short video.
coverURL
Cloud storage address of video cover.
videoId
Cloud storage ID of video file, through which you can call VOD's server APIs.
You can check the short video release result against the error code table.

4. Play back the video


After
the video is successfully uploaded in step 3, the video fileId, playback URL, and cover URL will be returned. You can directly pass in the fileId or playback URL to the VOD player for video playback.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백