Mobile Development 13 min read

Building a Simple Live Streaming Application on Tencent Cloud for Mini Programs

Yang Chunwen shows how developers can quickly build a low‑cost, secure live‑streaming mini‑program on Tencent Cloud by using signed streaming URLs, off‑loading video processing to the cloud, and optimizing performance through batched setData calls, lazy image loading, and pre‑loading techniques.

Tencent Cloud Developer
Tencent Cloud Developer
Tencent Cloud Developer
Building a Simple Live Streaming Application on Tencent Cloud for Mini Programs

Yang Chunwen, a former Baidu engineer now working at Tencent, shares his experience in building live‑streaming mini‑programs based on Tencent Cloud. He focuses on the practical concerns of developers and frontline engineers, such as performance, security, and cost.

He explains that developing a live‑streaming product involves many algorithms and video‑processing techniques, which can be costly in terms of time, money, and manpower. By leveraging Tencent Cloud, developers can off‑load video encoding, decoding, and transmission to the cloud, while also relying on the cloud to handle issues such as video stalling and content moderation.

Low‑Cost Construction of a Live‑Streaming Mini‑Program

From the mini‑program perspective, the core functions are push‑stream (主播端) and pull‑stream (观众端). Developers only need to obtain a streaming service from Tencent Cloud, which is inexpensive and configuration‑driven. After applying for the service, Tencent Cloud provides encrypted streaming URLs and a signature key. The backend generates a push URL for the broadcaster and a pull URL for the audience; only URLs signed with the key are accepted, preventing unauthorized streaming.

Developers can quickly deploy the backend code supplied by Tencent Cloud, obtain the streaming URLs, and integrate them into the mini‑program. For larger projects, address‑distribution logic and additional backend services may be required.

Ensuring Authorized Streaming

The signature key issued by Tencent Cloud is the critical security measure. The developer’s server signs the streaming URLs before handing them to the mini‑program. Without a valid signature, Tencent Cloud rejects the stream, protecting against misuse.

Even a simple deployment can be completed in a short time, allowing developers to test live streaming on the console. More complex scenarios may involve custom backend logic for different content types (e.g., gaming, adult content), while Tencent Cloud continues to handle video processing and moderation.

Performance Pain Points and SetData Optimization

Live‑streaming mini‑programs often suffer from performance bottlenecks caused by frequent setData calls, which trigger DOM updates in the WebView. Excessive setData leads to UI lag, high CPU usage, and device heating.

Optimization strategies include batching data updates, reducing the frequency of setData , and minimizing the amount of data transferred per update. Rendering large lists (e.g., comments, bullet‑screen messages) should be done by updating multiple items in a single setData call rather than one‑by‑one.

Additional performance issues arise from large images. High‑resolution pictures increase memory consumption and page‑switch latency. Developers are advised to keep large images out of the package, load them lazily, and destroy them when they leave the viewport.

Pre‑Loading Techniques

To reduce perceived latency during page transitions, data can be pre‑loaded from local storage while the user navigates from page A to page B. This eliminates the need for a network request during the transition, resulting in smoother navigation.

Q&A Highlights

• The lowest‑latency protocol for pull‑streaming is ATMK (≈1 s), followed by FLV (≈2 s) and HLS (several seconds). The team prefers FLV for its stability.

• Mini‑program packages should stay well below 10 MB. Code should be kept minimal, while large assets (especially images) should be fetched dynamically rather than bundled.

Overall, by leveraging Tencent Cloud’s streaming services, applying proper URL signing, and optimizing setData usage, developers can build efficient, low‑cost live‑streaming mini‑programs.

Mobile Developmentperformance optimizationlive streamingMini ProgramTencent CloudsetData
Tencent Cloud Developer
Written by

Tencent Cloud Developer

Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.