
TXUGCRecord API to shoot a short video, and a .mp4 short video file will be generated after the shoot ends and be called back.TXUGCPublish API to publish the video. After the video is successfully published, the SDK will call back the watch URL to you.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.SecretID and SecretKey on your server and send the signature to the application.Signature field is correctly passed in; otherwise, the release will fail.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.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 defaultTXUGCPublishTypeDef.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);
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);
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 |
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.Feedback