Navigate back to the homepage

Building a modern WebRTC streaming solution using Agora

Patrick Zhao
December 3rd, 2020 · 1 min read

Background

Reading a lot of news articles such as the ones below, I am not surprised that people have changed their way of working, entertaining and living.

  • TV watching and online streaming surge during lockdown
  • Zoom’s Ridiculous Growth During COVID-19

One of SSW’s clients in the online auction domain came to us and asked for upgrading their current online streaming platform to better serve their clients (vendors and individual bidders).

WebRTC

WebRTC is one of Google’s most famous open-source projects. WebRTC enables web applications to capture audio/video and exchange data between different browsers without an intermediary. Nowadays, WebRTC has become more and more popular as it opens the window for developers to build any online chat applications they want. If you see a real time communication feature on a website, chances are it is built using WebRTC.

  • Google Meet and Google Hangout
  • Facebook Messenger
  • Discord
  • Wowza
  • Agora

WebRTC is good but …

WebRTC is a fantastic library. However, in order to build a streaming service using plain WebRTC is a challenging task.

  • WebRTC is based on peer-to-peer connection, when it scales to allow more attendants, the quality cannot keep up
  • Learning curve is high

I found a good article on Agora’s website discussing the strength and challenges of using plain WebRTC. See this link.

Agora is good

We made a decision to use Agora as our streaming service provider and we used Agora’s next generation web SDK.

Demo

  1. Create an account on Agora

  2. Log into Agora console

  3. Under feature’s generate a temporary token

  4. Go to https://agorapublisher.z26.web.core.windows.net and add the query string as below

    1https://agorapublisher.z26.web.core.windows.net/channel={channel-name}&&token={token}
  5. Go to https://agorasubscriber.z26.web.core.windows.netand add the query string as below

    1https://agorasubscriber.z26.web.core.windows.net/?channel={channel-name}&&token={token}
  6. Have fun!

Agora Console

Figure 1: Agora Console

Agora Token

Figure 2: Agora Token

Agora Token

Figure 3: Agora demo publisher

Problem

What if there is no internet connection but we still want to stream and broadcast our voice? Can we use our phone signal to stream and let others around the world to hear us?

Yes! There is a solution for this scenario. In my next blog, I will show you how we tackle the problem and work out an awesome audio only solution in a no internet connection scenario.

Resources

  1. Github Repo for Agora demo

More articles from Copyright Patrick Zhao 2021

Headless and headache-less

Headless CMS is popular now. It helps you manage your content at the backend and integrate with the data persistence of your own choice. It also leaves you the freedom to design and implement your own front end.

March 4th, 2020 · 3 min read

Build and publish your node module to private NPM registry on Azure Artifacts

Publish and manage your own NPM package and share it with your team on Azure.

January 12th, 2020 · 3 min read
© 2019–2020 Copyright Patrick Zhao 2021
Link to $https://twitter.com/paladinapayLink to $https://github.com/PatrickZhao1989Link to $https://www.linkedin.com/in/patrickzhao1989/