About HLS Streaming
This guide provides an overview on playing Apple HLS streams in Flash with JW Player 6.
Apple's HTTP Live Streaming (HLS) is a protocol for streaming video using an ordinary web server. It supports live and on-demand streaming, as well as the ability to automatically adapt the stream quality to device and network conditions. The protocol works as follows:
- An existing file or live stream is segmented before delivery into short files.
- These segments are stored on a standard webserver and individually requested by a video player.
- During playback, the player seamlessly stitches the segments together.
If multiple qualities of a stream are available, the player will continuously monitor the current bandwidth and pick the next fragment from the highest quality it can load. This is called Adaptive Streaming:
Various protocols for HTTP adaptive streaming are in the market today. JW Player supports HTTP Live Streaming, because it is currently the only protocol capable of streaming to desktop computers as well as to Apple's iPad and iPhone devices.
Support for HTTP Live Streaming is dependent upon the platform:
- On the iPhone and iPad, HLS support is built into the iOS system. Therefore, every edition of JW Player 6 supports HLS for iPad and iPhone.
- Additionally, the Premium and Enterprise editions support HLS playback for desktop browsers (using Flash). This is a unique feature of JW Player that allows publishers to deploy a single streaming format (HLS) across all devices.
- HLS for Android devices can be enabled as of JW Player 6.9. This is disabled by default and must be configured with the androidhls setting. Please note that HLS is only supported on devices running Android 4.1(Jellybean) and higher.
HLS Desktop Support
On desktops in Flash mode, JW Player supports all features of Version 5 of the HLS IETF draft. These features are included in the Premium edition:
- TS with H.264 video and/or AAC/MP3 audio, or elementary AAC/MP3 audio (as of 6.6)
- Variant playlists, both with adaptive streaming and manual quality selection support.
- Support for encoding and timeline discontinuities marked with DISCONTINUITY tags.
The following features are supported in the Enterprise edition of the JW Player.
- AES128 fragment decryption, with single or rotating keys, embedded or external key files, and custom IVs.
- CEA-608 closed captions, injected into H264 SEI messages (as supported on iOS).
- On-demand and sliding window live DVR streaming.
TS Container Support
JW Player solely supports self-initializing TS fragments, meaning they start with a PMT/PAT definitions and a full H264 IDR frame. Fragments that are setup differently will introduce rendering errors in JW Player, ranging from short stutters and macroblock artefacts to an eventual stall of the stream. Common issues are the omission of keyframes in fragments, or misalignment of keyframes across quality levels.
In practice, JW6 is compatible with HLS streams generated by the Wowza Media Server and Adobe Media Server, as well as the mediafilesegmenter and mediastreamsegmenter tools Apple provides. Many additional encoding and segmenting tools may provide compatible streams, but this is not guaranteed.
Crossdomain and 302
Note that, when playing in Flash, both the M3U8 manifests and the TS segments are subject to crossdomain security restrictions. See Crossdomain File Loading for more info and a workaround.
An additional limitation to keep in mind is that JW Player does not support 302 redirects on the M3U8 manifest/playlist files, since the Adobe Flash player does not support the combination of crossdomain loading and redirects. We advise to instead use DNS load-balancing or serve up a dynamic M3U8 manifest, containing direct links to the M3U8 playlists on the target servers.