Tencent Classroom Video Migration to Tencent Cloud: Architecture, Implementation, and Lessons Learned
Tencent Classroom migrated roughly four million videos (about 1,500 TB) to Tencent Cloud in a two‑phase rollout that integrated cloud upload, transcoding, encrypted HLS playback with anti‑leech and DRM, added AI‑based content moderation, resolved SDK and multi‑region issues, and built a custom mini‑program player, ultimately boosting upload success rates, playback reliability, and security.
Tencent Classroom provides online education through live streaming and on‑demand video. By the end of 2019 the service had migrated all live and on‑demand content to the cloud, moving roughly 4 million videos (about 1,500 TB).
The article documents the practical solution for migrating these videos to Tencent Cloud, aiming to share experience with peers.
Overall Migration Plan
The migration is divided into two phases. Phase 1 integrates Tencent Cloud’s upload, transcoding, and playback functions for newly uploaded videos while keeping a fallback to the legacy system. Phase 2 migrates the existing video library to the cloud and adds AI‑based content moderation (pornography, violence, political sensitivity). After stable operation, the legacy solution can be retired.
Video Upload Process
The upload workflow consists of three steps: (1) obtain a signature from the business backend, (2) call the cloud SDK to upload the video, and (3) let the cloud server transcode the video. The most critical part is the SDK upload, which directly affects the success rate and is sensitive to network conditions. Detailed user logs are recommended for troubleshooting.
In practice the SDK upload is performed with vod-js-sdk-v6.upload(file, options) , where the SDK automatically requests a signature before, during, and after the upload.
Playback Process and Security
After migration, encrypted HLS is used together with Key anti‑leech and DRM to protect video content. The playback flow includes obtaining a token for anti‑leech and a decryption key (DK) from Tencent Cloud KMS. The token limits URL expiration and allowed IPs, while the DK decrypts AES‑128 encrypted TS segments.
Problems Encountered
1. By default only the Chongqing storage region was enabled, causing all upload URLs to point to that region. Enabling multi‑region support in the COS console resolved the issue.
2. Two SDK‑related errors reduced the early upload success rate to 97 %: (a) time drift between client and server caused 403 errors in COS authentication, and (b) network jitter triggered signature verification failures in vod‑js‑sdk‑v6. Both issues have been fixed in the latest SDK version, raising the success rate above 99.5 %.
PC & H5 Playback
The playback architecture is simple: retrieve the m3u8 URL, invoke the player, and enforce anti‑leech and DRM. Without protection, the m3u8 URL could be freely shared, so Key anti‑leech and HLS AES encryption are applied. The encrypted m3u8 contains an EXT‑X‑KEY tag that points to a backend service providing the decryption key.
Monitoring
Playback is monitored using an internal monitor system, TDW for reporting, and BadJS for error tracing.
Mini‑Program Playback
Since Tencent Cloud does not provide a ready‑made video component for mini‑programs, a custom <cloud-player-video /> component was built. It obtains the encrypted m3u8 URL via getPlayInfo(appid, tokenObj, fileId) , appends the DRM token with formatUrlWithToken(m3u8Url, drmToken) , and passes the final URL to the native <video /> component. The component also supports future features such as bitrate and speed switching.
Overall, despite encountering several technical challenges, the migration improved video upload success rates, playback reliability, and security, demonstrating the benefits of embracing cloud services for large‑scale video platforms.
Tencent Cloud Developer
Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.