Community Blog Build a Live Streaming App in Four Simple Steps

Build a Live Streaming App in Four Simple Steps

Live streaming is taking off in popularity. In this blog, you'll learn how to build a live streaming app from scratch on Alibaba Cloud.

By Anthony Merrington, Technical Support Engineer at Alibaba Cloud.

Live streaming offers a novel way for businesses to expand their influence, reach new demographics, and promote their brands. It already plays an established role in scenarios such as gaming, online education, and live entertainment events. And in the Chinese market, it is becoming an essential tool in the armory of e-commerce companies. For enterprises hoping to join the trend, however, it can be challenging to build a live streaming app from scratch and without any prior experience.

App Features

First, let's go through a few essential features you'll want to consider during app design:

1.  Live Streaming

The most fundamental feature of a live streaming app, without doubt, is the live streaming functionality itself. ApsaraVideo Live is an Alibaba Cloud platform that enables live audio and video streaming services with low latency and high concurrency. It supports adaptive streaming bitrate and provides enhanced security. You can easily develop apps for Android and iPhone devices based on the official supported streaming SDK and player SDK.

2.  Instant Messaging

To keep viewers involved and boost engagement in your live streaming events, it's important that the audience can share opinions and give feedback whenever they want. With Message Queue for MQTT, your app users can send messages to ask questions and get answers in real-time. The service features the publish/subscribe pattern to implement one-to-many message delivery.

3.  Content Moderation

To protect your app users from spam messages and meet compliance requirements, you need to identify and block messages containing inappropriate content before the messages reach your other users. Alibaba Cloud Content Moderation enables you to continuously monitor user-generated messages and create custom blacklists to block messages that contain specific words and expressions.

How to Build It

The following diagram shows the architecture of a live streaming solution built based on Alibaba Cloud products and services.


To set up a solution that looks like this, follow the high-level steps listed below. If that's not enough, note that you can find complete steps, including code samples, by reading the best practice Building Live Streaming Apps Based on Alibaba Cloud Services.

Step 1: Set Up Domains in ApsaraVideo Live

To build a live streaming app with ApsaraVideo Live, you'll need to set up two domains: one streaming domain and one ingest domain. You need to prepare these two registered domains in advance and set them up in the ApsaraVideo Live console.

During the process, you will need to add two CNAME records for these two domains to your DNS hosting provider.

Note that if your audience consists of users from mainland China, you must also obtain an ICP filing or license for your domains before you release your app to the public.

Step 2: Develop a Client App Based on SDKs

The next step is to download the streaming SDK and player SDK and then import the SDKs to your selected mobile development environment. Both Android and iOS SDKs are provided. You can use the provided SDK tools to develop your client app. You can customize your app to optimize the user experience. You need to create at least three views: one where the app users can identify themselves as either a streamer or a viewer, one where the streamer can start live streaming, and one where the viewer can watch live streams.

Note: You can access the best practice Building Live Streaming Apps Based on Alibaba Cloud Services to get the SDK download links.

Step 3: Build a Server Application

You need to build a server application to enable instant messaging among your app users during live streaming. To achieve this, you can integrate Message Queue for Apache RocketMQ and Message Queue for MQTT to implement two-way communication between Alibaba Cloud and mobile devices. You can call the Content Moderation API to monitor user-generated content and block messages based on custom blacklists. Table Store provides distributed storage for moderated messages at low cost. You can also create an Elastic Compute Service instance to host the server application in a secure and reliable manner.

Step 4: Update the Client App

After you have deployed the server application to an ECS instance, you need to update the client app to implement instant messaging. Add UI elements to allow users to type and submit messages, connect to the server application to process the messages, and display moderated messages to both the streamer and the audience. You can then test the client app on real devices to see whether the app functionalities work as expected.

Learn More

To learn more about building a live streaming app, you can check out the following materials for free:

1 1 0
Share on


9 posts | 4 followers

You may also like


5974165397085703 December 5, 2022 at 7:36 am

Interesting post, thanks! Can I share your ideas in my article? With reference to you, of course. Here: https://www.cleveroad.com/blog/how-to-build-a-live-streaming-app/


9 posts | 4 followers

Related Products