WebRTC Samples > WebRTC Publish & HLS Play
The goal of this sample is to let you publish WebRTC stream to Ant Media Server from your web browser and play the stream from Ant Media Server via HLS.
Instructions
- Allow access to your camera and microphone.
- Click “Start Publishing” button below.
- Click “Play with HLS”button that should automatically appear above to play the stream in a new tab.
When do you need WebRTC Publish & HLS Play streaming?
Actually it depends on your project requirements – whether or not you want to use WebRTC or HLS for playback.
- If you don’t require ultra-low latency, you can select HLS playback with 8-12 seconds of normal latency. Check out WebRTC vs HLS video streaming sample to see the difference.
- If you need your stream to be in real time, you should use WebRTC playback with 0.5 seconds of latency. Also WebRTC is much more sensitive to network in comparison to HLS. Another reason is that, WebRTC consumes high CPU resources in comparison to HLS. If one 4 core server is able to handle 200 WebRTC viewers then same server can handle approximately 1,000 HLS viewers (x5 times) if there is no bandwidth problem.
How to create a streaming service like that?
Do you want to create a streaming service like that or simply add streaming features from this sample into your existing products?
For developers: Re-use source code by clicking on “View Source on Github”. Make sure to check out our documentation, Youtube tutorials and Github discussions. Start your 30-day trial today!
For non-technical people: If you don’t know how to code, please use our AWS Streaming Wizard. This is our tool that we create a streaming service at scale for you. It means that your streaming service will be set up to automatically scales its infrastructure up in response to increased viewer demand, ensuring optimal performance during peak times. Conversely, it can scale down efficiently during periods of lower demand, allowing for cost savings.