Live Streaming: RTMP and HLS
KeyCDN supports HTTP Live Streaming (HLS) based on a normal Pull Zone. This article describes shortly each protocol and elaborates the high level concept implemented by KeyCDN how live streaming can be done.
Real Time Messaging Protocol (RTMP)
RTMP is used to stream audio, video or data and is originally a proprietary protocol introduced by Macromedia (owned by Adobe). The protocol is TCP-based and offers therefore persistent connections. In short, RTMP encapsulates MP3/AAC audio and MP4/FLV video multimedia streams.
If you do live streaming with KeyCDN, RTMP will not be used for video delivery to end users. If the streaming software is based on RTMP, you can use this protocol to initially stream your content to your server or a 3rd party service that transforms the RTMP stream to HLS. A wide range of RTMP encoders can be used to create the live stream (e.g. FMLE, OBS, WireCast, etc).
HTTP Live Streaming (HLS)
HTTP Live Streaming is known as HLS. As the name implies, it is the media streaming communications protocol based on HTTP; developed by Apple as part of their QuickTime, Safari, OS X, and iOS products. How does it work? It breaks the overall stream into a sequence of small HTTP-based files (.ts: Transport Stream). These transport stream files are indexed in the file .m3u8. It is required to download first the .m3u8 playlist to play a live stream.
Why HLS for live steaming?
iOS devices do not support RTMP and most web-based players such as JW player or Flowplayer require the Flash based version to play RTMP streams but iOS devices can not handle the Flash players. The only proper solution is HLS.
How does live streaming work with KeyCDN?
If you do live streaming with KeyCDN, video delivery to end users is based on HLS (not RTMP). The basic sequence looks like this:
RTMP encoder -> Encoding (from RTMP) to HLS -> Pull Zone (HLS feature enabled)
The HLS feature for Pull Zones (called “Optimize for HLS”) manages the different HLS files accordingly. The index file (.m3u8) will not be cached. The actual video files (.ts) will be cached for 5 minutes:
Expire: -1 (Cache-Control: no-cache) Max Expire: 5 (relevant for the .ts files) Ignore Cache Control: enabled
Example of a HLS-based Pull Zone in the KeyCDN dashboard.
In the KeyCDN dashboard, the HLS features simply needs to be enabled:
The HLS stream will then be pulled from your origin URL (either your own server or a 3rd party service that offers HLS). It’s also possible to use different ports to pull the content from your HLS source (e.g. yourorigin.com:9999 or 10.20.30.40:8080).
Here is an example of how to integrate HTTP Live Streaming (HLS) with JW Player. You can just copy and paste the following example and replace the bold marked strings with your information.