Unfortunately there is always a slight delay when you live stream. That is due to the steps involved in getting your ingested video out to your viewers:
Once your stream is received from the server assigned to process it, it first needs to be transcoded from its incoming format, RTMP, to a format called HLS. In addition, multiple bitrates are output. So for your one incoming stream, we may make three renditions.
HLS uses a master playlist (.m3u8) file. That references sub-manifests. Each of those reference the segment (.ts) files. For live streaming Apple currently recommends using segments that are 6 seconds however that is not a strict requirement and so we try and use a shorter 4 seecond segment where possible to reduce latency a little more. The manifest must contain at least six of those segments according to Apple’s latest specification. Unfortunately their low-latency HLS specification is not widely supported: it is something we are investigating.
Once a segment is available, that file then has to be copied from the transcoding server to the origin from where it can be globally replicated using our content delivery network (CDN).
Why not output RTMP, instead of HLS?
It is possible to reduce the live streaming delay by using the RTMP protocol for the output too. RTMP is a proprietary protocol developed by Macromedia (now owned by Adobe) and remains a standard method for input. RTMP has several problems when used for output though:
- many firewalls do not automatically allow it (it uses a different port than normal HTTP/HTTPS) and so tricks such as RTMPT need to be used to “tunnel” it through.
- it is hard to scale RTMP streaming (whereas HLS uses common text/binary files for which content delivery networks were designed to scale).
- RTMP can not be played natively by web browsers (unlike a format like HLS, which browsers such as Safari and Edge do support natively).
- RTMP is not supported within HTML5. This means you need to have a plug-in installed to play a RTMP stream. That plug-in is Adobe’s Flash player - however many devices do not support Flash. Famously Apple decided not to support it within iOS (iPad & iPhone). Also many desktops no longer support it as organisations take the decision to remove it. It has numerous security issues. Just this patch closed 23 separate security bugs: http://www.bbc.co.uk/news/technology-35783558. As it states: “A lot of web firms have now stopped using Flash in a bid to thwart attackers”.
Hence we use HLS for delivering our live streams.
If you have any more questions about our live streaming, our video CMS or business video hosting, please email [email protected].