About HLS Streaming
This guide provides an overview on playing Apple HLS streams in Flash with JW Player.
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.
JW Player Support
Support for HTTP Live Streaming is dependent upon the platform:
- On the iPhone and iPad, HLS support is built into the iOS system. Since this is using iOS's native handling and not our Flash provider, every edition of JW Player 7 supports HLS for iPad and iPhone.
- The Premium and higher editions of JW7 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. Note: AES Encryption requires JW Player Enterprise.
- Due to inconsistent playback across devices, HLS for Android is disabled by default. Enabling HLS on Android is 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 a subset of features from Protocol 6 Version 13 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.
- Variant playlists, both with adaptive streaming and manual quality selection support.
- Alternate audio renditions through #EXT-X-TYPE=AUDIO
- WebVTT subtitle tracks through #EXT-X-TYPE=SUBTITLES
- Support for encoding and timeline discontinuities marked with DISCONTINUITY tags.
- Support for synchronization between different renditions of the same or different variant streams that contain #EXT-X-DISCONTINUITY tags
- Inclusion of timed metadata in ID3 format, carried in the MPEG-2 transport stream.
- CEA-608 closed captions, injected into H264 SEI messages (as supported on iOS).
- On-demand and sliding window live DVR streaming.
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.
The following HLS features are not supported in JW Player.
- Decryption of encrypted streams with SAMPLE-AES.
- Alternate video renditions through #EXT-X-TYPE="VIDEO".
- Support for presentation of streams containing just the I-frames, #EXT-X-I-FRAME-INF.
- Any stream that requires byte range mapping.
- Streams that do not have consistent timestamps throughout the stream.
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 artifacts 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, JW Player 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 information.
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.