idnits 2.17.1 draft-pantos-hls-rfc8216bis-07.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- -- The document has an IETF Trust Provisions (28 Dec 2009) Section 6.c(i) Publication Limitation clause. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 2 instances of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (April 30, 2020) is 1456 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Informational ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 2 errors (**), 0 flaws (~~), 2 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Informational R. Pantos, Ed. 3 Internet-Draft Apple Inc. 4 Obsoletes: 8216 (if approved) April 30, 2020 5 Intended status: Informational 6 Expires: November 1, 2020 8 HTTP Live Streaming 2nd Edition 9 draft-pantos-hls-rfc8216bis-07 11 Abstract 13 This document obsoletes RFC 8216. It describes a protocol for 14 transferring unbounded streams of multimedia data. It specifies the 15 data format of the files and the actions to be taken by the server 16 (sender) and the clients (receivers) of the streams. It describes 17 version 10 of this protocol. 19 Status of This Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at https://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on November 1, 2020. 36 Copyright Notice 38 Copyright (c) 2020 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (https://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. 48 This document may not be modified, and derivative works of it may not 49 be created, except to format it for publication as an RFC or to 50 translate it into languages other than English. 52 This Informational Internet Draft is submitted as an RFC Editor 53 Contribution and/or non-IETF Document (not as a Contribution, IETF 54 Contribution, nor IETF Document) in accordance with BCP 78 and BCP 55 79. 57 Table of Contents 59 1. Introduction to HTTP Live Streaming . . . . . . . . . . . . . 5 60 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 5 61 3. Media Segments . . . . . . . . . . . . . . . . . . . . . . . 7 62 3.1. Supported Media Segment Formats . . . . . . . . . . . . . 7 63 3.1.1. MPEG-2 Transport Streams . . . . . . . . . . . . . . 8 64 3.1.2. Fragmented MPEG-4 . . . . . . . . . . . . . . . . . . 8 65 3.1.3. Packed Audio . . . . . . . . . . . . . . . . . . . . 9 66 3.1.4. WebVTT . . . . . . . . . . . . . . . . . . . . . . . 9 67 3.1.5. IMSC Subtitles . . . . . . . . . . . . . . . . . . . 10 68 3.2. Partial Segments . . . . . . . . . . . . . . . . . . . . 11 69 4. Playlists . . . . . . . . . . . . . . . . . . . . . . . . . . 11 70 4.1. Definition of a Playlist . . . . . . . . . . . . . . . . 12 71 4.2. Attribute Lists . . . . . . . . . . . . . . . . . . . . . 13 72 4.3. Variable Substitution . . . . . . . . . . . . . . . . . . 14 73 4.4. Playlist Tags . . . . . . . . . . . . . . . . . . . . . . 14 74 4.4.1. Basic Tags . . . . . . . . . . . . . . . . . . . . . 15 75 4.4.1.1. EXTM3U . . . . . . . . . . . . . . . . . . . . . 15 76 4.4.1.2. EXT-X-VERSION . . . . . . . . . . . . . . . . . . 15 77 4.4.2. Media or Master Playlist Tags . . . . . . . . . . . . 15 78 4.4.2.1. EXT-X-INDEPENDENT-SEGMENTS . . . . . . . . . . . 16 79 4.4.2.2. EXT-X-START . . . . . . . . . . . . . . . . . . . 16 80 4.4.2.3. EXT-X-DEFINE . . . . . . . . . . . . . . . . . . 17 81 4.4.3. Media Playlist Tags . . . . . . . . . . . . . . . . . 18 82 4.4.3.1. EXT-X-TARGETDURATION . . . . . . . . . . . . . . 18 83 4.4.3.2. EXT-X-MEDIA-SEQUENCE . . . . . . . . . . . . . . 18 84 4.4.3.3. EXT-X-DISCONTINUITY-SEQUENCE . . . . . . . . . . 19 85 4.4.3.4. EXT-X-ENDLIST . . . . . . . . . . . . . . . . . . 19 86 4.4.3.5. EXT-X-PLAYLIST-TYPE . . . . . . . . . . . . . . . 19 87 4.4.3.6. EXT-X-I-FRAMES-ONLY . . . . . . . . . . . . . . . 20 88 4.4.3.7. EXT-X-PART-INF . . . . . . . . . . . . . . . . . 20 89 4.4.3.8. EXT-X-SERVER-CONTROL . . . . . . . . . . . . . . 21 90 4.4.4. Media Segment Tags . . . . . . . . . . . . . . . . . 22 91 4.4.4.1. EXTINF . . . . . . . . . . . . . . . . . . . . . 22 92 4.4.4.2. EXT-X-BYTERANGE . . . . . . . . . . . . . . . . . 23 93 4.4.4.3. EXT-X-DISCONTINUITY . . . . . . . . . . . . . . . 23 94 4.4.4.4. EXT-X-KEY . . . . . . . . . . . . . . . . . . . . 24 95 4.4.4.5. EXT-X-MAP . . . . . . . . . . . . . . . . . . . . 26 96 4.4.4.6. EXT-X-PROGRAM-DATE-TIME . . . . . . . . . . . . . 27 97 4.4.4.7. EXT-X-GAP . . . . . . . . . . . . . . . . . . . . 27 98 4.4.4.8. EXT-X-BITRATE . . . . . . . . . . . . . . . . . . 27 99 4.4.4.9. EXT-X-PART . . . . . . . . . . . . . . . . . . . 28 100 4.4.5. Media Metadata Tags . . . . . . . . . . . . . . . . . 29 101 4.4.5.1. EXT-X-DATERANGE . . . . . . . . . . . . . . . . . 29 102 4.4.5.1.1. Mapping SCTE-35 into EXT-X-DATERANGE . . . . 31 103 4.4.5.1.2. EXT-X-SKIP . . . . . . . . . . . . . . . . . 32 104 4.4.5.1.3. EXT-X-PRELOAD-HINT . . . . . . . . . . . . . 33 105 4.4.5.1.4. EXT-X-RENDITION-REPORT . . . . . . . . . . . 34 106 4.4.6. Master Playlist Tags . . . . . . . . . . . . . . . . 35 107 4.4.6.1. EXT-X-MEDIA . . . . . . . . . . . . . . . . . . . 35 108 4.4.6.1.1. Rendition Groups . . . . . . . . . . . . . . 38 109 4.4.6.2. EXT-X-STREAM-INF . . . . . . . . . . . . . . . . 39 110 4.4.6.2.1. Alternative Renditions . . . . . . . . . . . 44 111 4.4.6.3. EXT-X-I-FRAME-STREAM-INF . . . . . . . . . . . . 45 112 4.4.6.4. EXT-X-SESSION-DATA . . . . . . . . . . . . . . . 45 113 4.4.6.5. EXT-X-SESSION-KEY . . . . . . . . . . . . . . . . 46 114 5. Key Files . . . . . . . . . . . . . . . . . . . . . . . . . . 47 115 5.1. Structure of Key Files . . . . . . . . . . . . . . . . . 47 116 5.2. IV for AES-128 . . . . . . . . . . . . . . . . . . . . . 47 117 6. Client/Server Responsibilities . . . . . . . . . . . . . . . 47 118 6.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 47 119 6.2. Server Responsibilities . . . . . . . . . . . . . . . . . 48 120 6.2.1. General Server Responsibilities . . . . . . . . . . . 48 121 6.2.2. Live Playlists . . . . . . . . . . . . . . . . . . . 51 122 6.2.3. Encrypting Media Segments . . . . . . . . . . . . . . 52 123 6.2.4. Providing Variant Streams . . . . . . . . . . . . . . 53 124 6.2.5. Delivery Directives Interface . . . . . . . . . . . . 54 125 6.2.5.1. Playlist Delta Updates . . . . . . . . . . . . . 54 126 6.2.5.2. Blocking Playlist Reload . . . . . . . . . . . . 55 127 6.2.6. Providing Preload Hints . . . . . . . . . . . . . . . 56 128 6.3. Client Responsibilities . . . . . . . . . . . . . . . . . 57 129 6.3.1. General Client Responsibilities . . . . . . . . . . . 57 130 6.3.2. Loading the Media Playlist File . . . . . . . . . . . 58 131 6.3.3. Playing the Media Playlist File . . . . . . . . . . . 59 132 6.3.4. Reloading the Media Playlist File . . . . . . . . . . 60 133 6.3.5. Determining the Next Segment to Load . . . . . . . . 61 134 6.3.6. Decrypting Encrypted Media Segments . . . . . . . . . 62 135 6.3.7. Requesting Playlist Delta Updates . . . . . . . . . . 63 136 6.3.8. Issuing Blocking Requests . . . . . . . . . . . . . . 63 137 7. Protocol Version Compatibility . . . . . . . . . . . . . . . 64 138 8. Playlist Examples . . . . . . . . . . . . . . . . . . . . . . 66 139 8.1. Simple Media Playlist . . . . . . . . . . . . . . . . . . 66 140 8.2. Live Media Playlist Using HTTPS . . . . . . . . . . . . . 66 141 8.3. Playlist with Encrypted Media Segments . . . . . . . . . 66 142 8.4. Master Playlist . . . . . . . . . . . . . . . . . . . . . 67 143 8.5. Master Playlist with I-Frames . . . . . . . . . . . . . . 67 144 8.6. Master Playlist with Alternative Audio . . . . . . . . . 68 145 8.7. Master Playlist with Alternative Video . . . . . . . . . 68 146 8.8. Session Data in a Master Playlist . . . . . . . . . . . . 69 147 8.9. CHARACTERISTICS Attribute Containing Multiple 148 Characteristics . . . . . . . . . . . . . . . . . . . . . 69 149 8.10. EXT-X-DATERANGE Carrying SCTE-35 Tags . . . . . . . . . . 70 150 8.11. Low-Latency Playlist . . . . . . . . . . . . . . . . . . 70 151 9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 71 152 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 71 153 11. Security Considerations . . . . . . . . . . . . . . . . . . . 73 154 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 73 155 12.1. Normative References . . . . . . . . . . . . . . . . . . 73 156 12.2. Informative References . . . . . . . . . . . . . . . . . 77 157 Appendix A. Changes from RFC 8216 . . . . . . . . . . . . . . . 78 158 Appendix B. Server Configuration Profiles . . . . . . . . . . . 79 159 B.1. Low-Latency Server Configuration Profile . . . . . . . . 79 160 Appendix C. Low-Latency CDN Tune-in . . . . . . . . . . . . . . 81 161 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 82 163 1. Introduction to HTTP Live Streaming 165 HTTP Live Streaming provides a reliable, cost-effective means of 166 delivering continuous and long-form video over the Internet. It 167 allows a receiver to adapt the bit rate of the media to the current 168 network conditions in order to maintain uninterrupted playback at the 169 best possible quality. It supports interstitial content boundaries. 170 It provides a flexible framework for media encryption. It can 171 efficiently offer multiple renditions of the same content, such as 172 audio translations. It offers compatibility with large-scale HTTP 173 caching infrastructure to support delivery to large audiences. It 174 supports low-latency playback at scale. 176 Since its first draft publication in 2009, HTTP Live Streaming has 177 been implemented and deployed by a wide array of content producers, 178 tools vendors, distributors, and device manufacturers. In the 179 subsequent ten years the protocol has been refined by extensive 180 review and discussion with a variety of media streaming implementors. 182 The purpose of this document is to facilitate interoperability 183 between HTTP Live Streaming implementations by describing the media 184 transmission protocol. Using this protocol, a client can receive a 185 continuous stream of media from a server for concurrent presentation. 187 This document describes version 10 of the protocol. 189 2. Overview 191 A multimedia presentation is specified by a Uniform Resource 192 Identifier (URI) [RFC3986] to a Playlist. 194 A Playlist is either a Media Playlist or a Master Playlist. Both are 195 UTF-8 text files containing URIs and descriptive tags. 197 A Media Playlist contains a list of Media Segments, which, when 198 played sequentially, will play the multimedia presentation. 200 Here is an example of a Media Playlist: 202 #EXTM3U 203 #EXT-X-TARGETDURATION:10 205 #EXTINF:9.009, 206 http://media.example.com/first.ts 207 #EXTINF:9.009, 208 http://media.example.com/second.ts 209 #EXTINF:3.003, 210 http://media.example.com/third.ts 212 The first line is the format identifier tag #EXTM3U. The line 213 containing #EXT-X-TARGETDURATION says that all Media Segments will be 214 10 seconds long or less. Then, three Media Segments are declared. 215 The first and second are 9.009 seconds long; the third is 3.003 216 seconds. 218 To play this Playlist, the client first downloads it and then 219 downloads and plays each Media Segment declared within it. The 220 client reloads the Playlist as described in this document to discover 221 any added segments. Data SHOULD be carried over HTTP [RFC7230], but, 222 in general, a URI can specify any protocol that can reliably transfer 223 the specified resource on demand. 225 A more complex presentation can be described by a Master Playlist. A 226 Master Playlist provides a set of Variant Streams, each of which 227 describes a different version of the same content. 229 A Variant Stream includes a Media Playlist that specifies media 230 encoded at a particular bit rate, in a particular format, and at a 231 particular resolution for media containing video. 233 A Variant Stream can also specify a set of Renditions. Renditions 234 are alternate versions of the content, such as audio produced in 235 different languages or video recorded from different camera angles. 237 Clients should switch between different Variant Streams to adapt to 238 network conditions. Clients should choose Renditions based on user 239 preferences. 241 Certain streams can be played in Low-Latency Mode. Low-Latency Mode 242 refers to the combined use of Partial Segments, Blocking Playlist 243 Reload and preload hinting to enable playback at a reduced delay from 244 live. 246 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 247 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 248 "OPTIONAL" in this document are to be interpreted as described in BCP 249 14 [RFC2119] [RFC8174] when, and only when, they appear in all 250 capitals, as shown here. 252 3. Media Segments 254 A Media Playlist contains a series of Media Segments that make up the 255 overall presentation. A Media Segment is specified by a URI and 256 optionally a byte range. 258 The duration of each Media Segment is indicated in the Media Playlist 259 by its EXTINF tag (Section 4.4.4.1). 261 Each segment in a Media Playlist has a unique integer Media Sequence 262 Number. The Media Sequence Number of the first segment in the Media 263 Playlist is either 0 or declared in the Playlist (Section 4.4.3.2). 264 The Media Sequence Number of every other segment is equal to the 265 Media Sequence Number of the segment that precedes it plus one. 267 Each Media Segment MUST carry the continuation of the encoded 268 bitstream from the end of the segment with the previous Media 269 Sequence Number, where values in a series such as timestamps and 270 Continuity Counters MUST continue uninterrupted. The only exceptions 271 are the first Media Segment ever to appear in a Media Playlist and 272 Media Segments that are explicitly signaled as discontinuities 273 (Section 4.4.4.3). Unmarked media discontinuities can trigger 274 playback errors. 276 Any Media Segment that contains video SHOULD include enough 277 information to initialize a video decoder and decode a continuous set 278 of frames that includes the final frame in the Segment; network 279 efficiency is optimized if there is enough information in the Segment 280 to decode all frames in the Segment. For example, any Media Segment 281 containing H.264 video SHOULD contain an Instantaneous Decoding 282 Refresh (IDR); frames prior to the first IDR will be downloaded but 283 possibly discarded. 285 3.1. Supported Media Segment Formats 287 All Media Segments MUST be in a format described in this section. 288 Transport of other media file formats is not defined. 290 Some media formats require a common sequence of bytes to initialize a 291 parser before a Media Segment can be parsed. This format-specific 292 sequence is called the Media Initialization Section. The Media 293 Initialization Section can be specified by an EXT-X-MAP tag 294 (Section 4.4.4.5). The Media Initialization Section MUST NOT contain 295 sample data. 297 3.1.1. MPEG-2 Transport Streams 299 MPEG-2 Transport Streams are specified by [ISO_13818]. 301 The Media Initialization Section of an MPEG-2 Transport Stream 302 Segment is a Program Association Table (PAT) followed by a Program 303 Map Table (PMT). 305 Transport Stream Segments MUST contain a single MPEG-2 Program; 306 playback of Multi-Program Transport Streams is not defined. Each 307 Transport Stream Segment MUST contain a PAT and a PMT, or have an 308 EXT-X-MAP tag (Section 4.4.4.5) applied to it. The first two 309 Transport Stream packets in a Segment without an EXT-X-MAP tag SHOULD 310 be a PAT and a PMT. 312 3.1.2. Fragmented MPEG-4 314 MPEG-4 Fragments are specified by the ISO Base Media File Format 315 [ISOBMFF]. Unlike regular MPEG-4 files that have a Movie Box 316 ('moov') that contains sample tables and a Media Data Box ('mdat') 317 containing the corresponding samples, an MPEG-4 Fragment consists of 318 a Movie Fragment Box ('moof') containing a subset of the sample table 319 and a Media Data Box containing those samples. Use of MPEG-4 320 Fragments does require a Movie Box for initialization, but that Movie 321 Box contains only non-sample-specific information such as track and 322 sample descriptions. 324 A Fragmented MPEG-4 (fMP4) Segment is a "segment" as defined by 325 Section 3 of [ISOBMFF], including the constraints on Media Data Boxes 326 in Section 8.16 of [ISOBMFF]. 328 The Media Initialization Section for an fMP4 Segment is an ISO Base 329 Media File that can initialize a parser for that Segment. 331 Broadly speaking, fMP4 Segments and Media Initialization Sections are 332 [ISOBMFF] files that also satisfy the constraints described in this 333 section. 335 The Media Initialization Section for an fMP4 Segment MUST contain a 336 File Type Box ('ftyp') containing a brand that is compatible with 337 'iso6' or higher. The File Type Box MUST be followed by a Movie Box. 338 The Movie Box MUST contain a Track Box ('trak') for every Track 339 Fragment Box ('traf') in the fMP4 Segment, with matching track_ID. 340 Each Track Box SHOULD contain a sample table, but its sample count 341 MUST be zero. Movie Header Boxes ('mvhd') and Track Header Boxes 342 ('tkhd') MUST have durations of zero. The Movie Box MUST contain a 343 Movie Extends Box ('mvex'); it SHOULD follow the last Track Box. 345 Note that a Common Media Application Format [CMAF] Header meets all 346 these requirements. 348 In an fMP4 Segment, every Track Fragment Box MUST contain a Track 349 Fragment Decode Time Box ('tfdt'). fMP4 Segments MUST use movie- 350 fragment-relative addressing. fMP4 Segments MUST NOT use external 351 data references. Note that a CMAF Segment meets these requirements. 353 An fMP4 Segment in a Playlist containing the EXT-X-I-FRAMES-ONLY tag 354 (Section 4.4.3.6) MAY omit the portion of the Media Data Box 355 following the intra-coded frame (I-frame) sample data. 357 Each fMP4 Segment in a Media Playlist MUST have an EXT-X-MAP tag 358 applied to it. 360 3.1.3. Packed Audio 362 A Packed Audio Segment contains encoded audio samples and ID3 tags 363 that are simply packed together with minimal framing and no per- 364 sample timestamps. Supported Packed Audio formats are Advanced Audio 365 Coding (AAC) with Audio Data Transport Stream (ADTS) framing 366 [ISO_13818_7], MP3 [ISO_13818_3], AC-3 [AC_3], and Enhanced AC-3 367 [AC_3]. 369 A Packed Audio Segment has no Media Initialization Section. 371 Each Packed Audio Segment MUST signal the timestamp of its first 372 sample with an ID3 Private frame (PRIV) tag [ID3] at the beginning of 373 the segment. The ID3 PRIV owner identifier MUST be 374 "com.apple.streaming.transportStreamTimestamp". The ID3 payload MUST 375 be a 33-bit MPEG-2 Program Elementary Stream timestamp expressed as a 376 big-endian eight-octet number, with the upper 31 bits set to zero. 377 Clients SHOULD NOT play Packed Audio Segments without this ID3 tag. 379 3.1.4. WebVTT 381 A WebVTT Segment is a section of a WebVTT [WebVTT] file. WebVTT 382 Segments carry subtitles. 384 The Media Initialization Section of a WebVTT Segment is the WebVTT 385 header. 387 Each WebVTT Segment MUST contain all subtitle cues that are intended 388 to be displayed during the period indicated by the segment EXTINF 389 duration. The start time offset and end time offset of each cue MUST 390 indicate the total display time for that cue, even if part of the cue 391 time range is outside the Segment period. A WebVTT Segment MAY 392 contain no cues; this indicates that no subtitles are to be displayed 393 during that period. 395 Each WebVTT Segment MUST either start with a WebVTT header or have an 396 EXT-X-MAP tag applied to it. 398 In order to synchronize timestamps between audio/video and subtitles, 399 an X-TIMESTAMP-MAP metadata header SHOULD be added to each WebVTT 400 header. This header maps WebVTT cue timestamps to media timestamps 401 in other Renditions of the Variant Stream. Its format is: 403 X-TIMESTAMP-MAP=LOCAL:,MPEGTS: 404 e.g., X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000 406 indicating the media time to which the cue time MUST be mapped. The 407 cue timestamp in the LOCAL attribute MAY fall outside the range of 408 time covered by the segment. 410 The MPEGTS media timestamp MUST use a 90KHz timescale, even when non- 411 WebVTT Media Segments use a different timescale. 413 If a WebVTT segment does not have the X-TIMESTAMP-MAP, the client 414 MUST assume that the WebVTT cue time of 0 maps to an media timestamp 415 of 0. 417 When synchronizing WebVTT with PES timestamps, clients SHOULD account 418 for cases where the 33-bit PES timestamps have wrapped and the WebVTT 419 cue times have not. When the PES timestamp wraps, the WebVTT segment 420 SHOULD have a X-TIMESTAMP-MAP header that maps the current WebVTT 421 time to the new (low valued) PES timestamp. 423 3.1.5. IMSC Subtitles 425 An IMSC Segment is a Fragmented MPEG-4 (Section 3.1.2) Media Segment 426 that carries subtitle media according to MPEG-4 Part 30 427 [MP4_TIMED_TEXT]. This subtitle media MUST comply with the Text 428 Profile of IMSC1 [IMSC1]. 430 The Media Initialization Section of an IMSC Segment is specified in 431 Section 3.1.2. 433 Each IMSC Segment MUST contain all subtitle samples that are intended 434 to be displayed during the period indicated by the segment EXTINF 435 duration. Each Segment MUST contain definitions for all styles which 436 are applied to any part of any sample in the Segment. 438 3.2. Partial Segments 440 One component of viewer delay in a live stream is publishing latency: 441 a Segment cannot be distributed until it has been completely encoded 442 and packaged. A long Segment encoded in real-time introduces a delay 443 equal to its duration. Partial Segments provide a parallel channel 444 for distributing media at the live edge of the Media Playlist, where 445 the media is divided into a larger number of smaller pieces, such as 446 CMAF Chunks. These subsets are called Partial Segments. Because 447 each Partial Segment has a short duration, it can be packaged, 448 published, and added to the Media Playlist much earlier than its 449 Parent Segment. 451 A Partial Segment MUST be in one of the Supported Media Segment 452 Formats described in Section 3.1. A Partial Segment is associated 453 with a regular Media Segment, called its Parent Segment, by appearing 454 before it in the Media Playlist, and after the previous Media 455 Segment. Partial Segments are identified by the EXT-X-PART tag 456 (Section 4.4.4.9). 458 A Partial Segment MUST contain a subset of the media samples in its 459 Parent Segment. A Parent Segment and its entire set of Partial 460 Segments MUST contain the same set of media samples, with the same 461 timing and metadata. 463 Each Partial Segment has a Part Index, which is an integer indicating 464 the position of the Partial Segment within its Parent Segment. The 465 first Partial Segment has a Part Index of zero. 467 Each Partial Segment also has a Media Sequence Number, which is equal 468 to the Media Sequence Number of its Parent Segment. 470 4. Playlists 472 This section describes the Playlist files used by HTTP Live 473 Streaming. In this section, "MUST" and "MUST NOT" specify the rules 474 for the syntax and structure of legal Playlist files. Playlists that 475 violate these rules are invalid; clients MUST fail to parse them. 476 See Section 6.3.2. 478 The format of the Playlist files is derived from the M3U [M3U] 479 playlist file format and inherits two tags from that earlier file 480 format: EXTM3U (Section 4.4.1.1) and EXTINF (Section 4.4.4.1). 482 In the specification of tag syntax, a string enclosed by <> 483 identifies a tag parameter; its specific format is described in its 484 tag definition. If a parameter is further surrounded by [], it is 485 optional; otherwise, it is required. 487 Each Playlist file MUST be identifiable either by the path component 488 of its URI or by HTTP Content-Type. In the first case, the path MUST 489 end with either .m3u8 or .m3u. In the second, the HTTP Content-Type 490 MUST be "application/vnd.apple.mpegurl" or "audio/mpegurl". Clients 491 SHOULD refuse to parse Playlists that are not so identified. 493 4.1. Definition of a Playlist 495 Playlist files MUST be encoded in UTF-8 [RFC3629]. They MUST NOT 496 contain any Byte Order Mark (BOM); clients SHOULD fail to parse 497 Playlists that contain a BOM or do not parse as UTF-8. Playlist 498 files MUST NOT contain UTF-8 control characters (U+0000 to U+001F and 499 U+007F to U+009F), with the exceptions of CR (U+000D) and LF 500 (U+000A). All character sequences MUST be normalized according to 501 Unicode normalization form "NFC" [UNICODE]. Note that US-ASCII 502 [US_ASCII] conforms to these rules. 504 Lines in a Playlist file are terminated by either a single line feed 505 character or a carriage return character followed by a line feed 506 character. Each line is a URI, is blank, or starts with the 507 character '#'. Blank lines are ignored. Whitespace MUST NOT be 508 present, except for elements in which it is explicitly specified. 510 Lines that start with the character '#' are either comments or tags. 511 Tags begin with #EXT. They are case sensitive. All other lines that 512 begin with '#' are comments and SHOULD be ignored. 514 A URI line identifies a Media Segment or a Playlist file (see 515 Section 4.4.6.2). Each Media Segment is specified by a URI and the 516 tags that apply to it. 518 A Playlist is a Media Playlist if all URI lines in the Playlist 519 identify Media Segments. A Playlist is a Master Playlist if all URI 520 lines in the Playlist identify Media Playlists. A Playlist MUST be 521 either a Media Playlist or a Master Playlist; all other Playlists are 522 invalid. 524 A URI in a Playlist, whether it is a URI line or part of a tag, MAY 525 be relative. Any relative URI is considered to be relative to the 526 URI of the Playlist that contains it. 528 The duration of a Media Playlist is the sum of the durations of the 529 Media Segments within it. 531 The segment bit rate of a Media Segment is the size of the Media 532 Segment divided by its EXTINF duration (Section 4.4.4.1). Note that 533 this includes container overhead but does not include overhead 534 imposed by the delivery system, such as HTTP, TCP, or IP headers. 536 The peak segment bit rate of a Media Playlist is the largest bit rate 537 of any contiguous set of segments whose total duration is between 0.5 538 times the Target Duration and 1.5 times the Target Duration plus 0.5 539 seconds (since media segments may exceed the Target Duration by up to 540 0.5 seconds). The bit rate of a set is calculated by dividing the 541 sum of the segment sizes by the sum of the segment durations. 543 The average segment bit rate of a Media Playlist is the sum of the 544 sizes (in bits) of every Media Segment in the Media Playlist, divided 545 by the Media Playlist duration. Note that this includes container 546 overhead, but not HTTP or other overhead imposed by the delivery 547 system. 549 4.2. Attribute Lists 551 Certain tags have values that are attribute-lists. An attribute-list 552 is a comma-separated list of attribute/value pairs with no 553 whitespace. 555 An attribute/value pair has the following syntax: 557 AttributeName=AttributeValue 559 An AttributeName is an unquoted string containing characters from the 560 set [A..Z], [0..9], and '-'. Therefore, AttributeNames contain only 561 uppercase letters, not lowercase. There MUST NOT be any whitespace 562 between the AttributeName and the '=' character, nor between the '=' 563 character and the AttributeValue. 565 An AttributeValue is one of the following: 567 o decimal-integer: an unquoted string of characters from the set 568 [0..9] expressing an integer in base-10 arithmetic in the range 569 from 0 to 2^64-1 (18446744073709551615). A decimal-integer may be 570 from 1 to 20 characters long. 572 o hexadecimal-sequence: an unquoted string of characters from the 573 set [0..9] and [A..F] that is prefixed with 0x or 0X. The maximum 574 length of a hexadecimal-sequence depends on its AttributeNames. 576 o decimal-floating-point: an unquoted string of characters from the 577 set [0..9] and '.' that expresses a non-negative floating-point 578 number in decimal positional notation. 580 o signed-decimal-floating-point: an unquoted string of characters 581 from the set [0..9], '-', and '.' that expresses a signed 582 floating-point number in decimal positional notation. 584 o quoted-string: a string of characters within a pair of double 585 quotes (0x22). The following characters MUST NOT appear in a 586 quoted-string: line feed (0xA), carriage return (0xD), or double 587 quote (0x22). Quoted-string AttributeValues SHOULD be constructed 588 so that byte-wise comparison is sufficient to test two quoted- 589 string AttributeValues for equality. Note that this implies case- 590 sensitive comparison. 592 o enumerated-string: an unquoted character string from a set that is 593 explicitly defined by the AttributeName. An enumerated-string 594 will never contain double quotes ("), commas (,), or whitespace. 596 o decimal-resolution: two decimal-integers separated by the "x" 597 character. The first integer is a horizontal pixel dimension 598 (width); the second is a vertical pixel dimension (height). 600 The type of the AttributeValue for a given AttributeName is specified 601 by the attribute definition. 603 A given AttributeName MUST NOT appear more than once in a given 604 attribute-list. Clients SHOULD refuse to parse such Playlists. 606 4.3. Variable Substitution 608 The following Playlist elements are subject to variable substitution: 610 o URI lines 612 o quoted-string AttributeValues 614 o hexadecimal-sequence AttributeValues 616 A Variable Reference is a string of the form "{$" (0x7B,0x24) 617 followed by a Variable Name followed by "}" (0x7D). Variable Names 618 are defined by the EXT-X-DEFINE tag (Section 4.4.2.3). 620 See Section 6.3.1 for more information about variable substitution. 622 4.4. Playlist Tags 624 Playlist tags specify either global parameters of the Playlist or 625 information about the Media Segments or Media Playlists that appear 626 after them. 628 4.4.1. Basic Tags 630 These tags are allowed in both Media Playlists and Master Playlists. 632 4.4.1.1. EXTM3U 634 The EXTM3U tag indicates that the file is an Extended M3U [M3U] 635 Playlist file. It MUST be the first line of every Media Playlist and 636 every Master Playlist. Its format is: 638 #EXTM3U 640 4.4.1.2. EXT-X-VERSION 642 The EXT-X-VERSION tag indicates the compatibility version of the 643 Playlist file, its associated media, and its server. 645 The EXT-X-VERSION tag applies to the entire Playlist file. Its 646 format is: 648 #EXT-X-VERSION: 650 where n is an integer indicating the protocol compatibility version 651 number. 653 It MUST appear in all Playlists containing tags or attributes that 654 are not compatible with protocol version 1 to support 655 interoperability with older clients. Section 7 specifies the minimum 656 value of the compatibility version number for any given Playlist 657 file. 659 A Playlist file MUST NOT contain more than one EXT-X-VERSION tag. If 660 a client encounters a Playlist with multiple EXT-X-VERSION tags, it 661 MUST fail to parse it. 663 4.4.2. Media or Master Playlist Tags 665 The tags in this section can appear in either Master Playlists or 666 Media Playlists. If one of these tags appears in a Master Playlist, 667 it SHOULD NOT appear in any Media Playlist referenced by that Master 668 Playlist. A tag that appears in both MUST have the same value; 669 otherwise, clients SHOULD ignore the value in the Media Playlist(s). 671 Tags in this section MUST NOT appear more than once in a Playlist. 672 If one does, clients MUST fail to parse the Playlist. The only 673 exception to this rule is EXT-X-DEFINE, which MAY appear more than 674 once. 676 4.4.2.1. EXT-X-INDEPENDENT-SEGMENTS 678 The EXT-X-INDEPENDENT-SEGMENTS tag indicates that all media samples 679 in a Media Segment can be decoded without information from other 680 segments. It applies to every Media Segment in the Playlist. 682 Its format is: 684 #EXT-X-INDEPENDENT-SEGMENTS 686 If the EXT-X-INDEPENDENT-SEGMENTS tag appears in a Master Playlist, 687 it applies to every Media Segment in every Media Playlist in the 688 Master Playlist. 690 4.4.2.2. EXT-X-START 692 The EXT-X-START tag indicates a preferred point at which to start 693 playing a Playlist. By default, clients SHOULD start playback at 694 this point when beginning a playback session. This tag is OPTIONAL. 696 Its format is: 698 #EXT-X-START: 700 The following attributes are defined: 702 TIME-OFFSET 704 The value of TIME-OFFSET is a signed-decimal-floating-point number 705 of seconds. A positive number indicates a time offset from the 706 beginning of the Playlist. A negative number indicates a negative 707 time offset from the end of the last Media Segment in the 708 Playlist. This attribute is REQUIRED. 710 The absolute value of TIME-OFFSET SHOULD NOT be larger than the 711 Playlist duration. If the absolute value of TIME-OFFSET exceeds 712 the duration of the Playlist, it indicates either the end of the 713 Playlist (if positive) or the beginning of the Playlist (if 714 negative). 716 If the Playlist does not contain the EXT-X-ENDLIST tag, the TIME- 717 OFFSET SHOULD NOT be within three Target Durations of the end of 718 the Playlist file. 720 PRECISE 722 The value is an enumerated-string; valid strings are YES and NO. 723 If the value is YES, clients SHOULD start playback at the Media 724 Segment containing the TIME-OFFSET, but SHOULD NOT render media 725 samples in that segment whose presentation times are prior to the 726 TIME-OFFSET. If the value is NO, clients SHOULD attempt to render 727 every media sample in that segment. This attribute is OPTIONAL. 728 If it is missing, its value should be treated as NO. 730 4.4.2.3. EXT-X-DEFINE 732 The EXT-X-DEFINE tag provides a Playlist variable definition or 733 declaration. This tag is OPTIONAL. 735 Its format is: 737 #EXT-X-DEFINE: 739 The following attributes are defined: 741 NAME 743 The value is a quoted-string which specifies the Variable Name. 744 All characters in the quoted-string MUST be from the following 745 set: [a..z], [A..Z], [0..9], '-', and '_'. 747 VALUE 749 The value is a quoted-string which specifies the Variable Value. 750 This attribute is REQUIRED if the EXT-X-DEFINE tag has a NAME 751 attribute. 753 IMPORT 755 The value is a quoted-string which specifies the Variable Name and 756 indicates that its value is that of the variable of the same name 757 in the Master Playlist. EXT-X-DEFINE tags containing the IMPORT 758 attribute MUST NOT occur in Master Playlists; they are only 759 allowed in Media Playlists. 761 If the IMPORT attribute value does not match any Variable Name 762 declared in the Master Playlist, or if the Media Playlist was not 763 loaded from a Master Playlist, the parser MUST fail to parse the 764 Playlist. 766 An EXT-X-DEFINE tag MUST contain either a NAME or an IMPORT 767 attribute, but not both. 769 An EXT-X-DEFINE tag MUST NOT specify the same Variable Name as any 770 other EXT-X-DEFINE tag in the same Playlist. Parsers that encounter 771 duplicate Variable Name declarations MUST fail to parse the Playlist. 773 EXT-X-DEFINE tags do NOT implicitly persist across Playlist reloads. 775 4.4.3. Media Playlist Tags 777 Media Playlist tags describe global parameters of the Media Playlist. 778 There MUST NOT be more than one Media Playlist tag of each type in 779 any Media Playlist. 781 A Media Playlist tag MUST NOT appear in a Master Playlist 783 4.4.3.1. EXT-X-TARGETDURATION 785 The EXT-X-TARGETDURATION tag specifies the Target Duration, an upper 786 bound on the duration of all Media Segments in the Playlist. The 787 EXTINF duration of each Media Segment in a Playlist file, when 788 rounded to the nearest integer, MUST be less than or equal to the 789 Target Duration. Longer segments can trigger playback stalls or 790 other errors. It applies to the entire Playlist file. Its format 791 is: 793 #EXT-X-TARGETDURATION: 795 where s is a decimal-integer indicating the Target Duration in 796 seconds. The EXT-X-TARGETDURATION tag is REQUIRED. 798 4.4.3.2. EXT-X-MEDIA-SEQUENCE 800 The EXT-X-MEDIA-SEQUENCE tag indicates the Media Sequence Number of 801 the first Media Segment that appears in a Playlist file. Its format 802 is: 804 #EXT-X-MEDIA-SEQUENCE: 806 where number is a decimal-integer. 808 If the Media Playlist file does not contain an EXT-X-MEDIA-SEQUENCE 809 tag, then the Media Sequence Number of the first Media Segment in the 810 Media Playlist SHALL be considered to be 0. A client MUST NOT assume 811 that segments with the same Media Sequence Number in different Media 812 Playlists contain matching content (see Section 6.3.2). 814 A URI for a Media Segment is not required to contain its Media 815 Sequence Number. 817 See Section 6.2.1 and Section 6.3.5 for more information on setting 818 the EXT-X-MEDIA-SEQUENCE tag. 820 The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media 821 Segment in the Playlist. 823 4.4.3.3. EXT-X-DISCONTINUITY-SEQUENCE 825 The EXT-X-DISCONTINUITY-SEQUENCE tag allows synchronization between 826 different Renditions of the same Variant Stream or different Variant 827 Streams that have EXT-X-DISCONTINUITY tags in their Media Playlists. 829 Its format is: 831 #EXT-X-DISCONTINUITY-SEQUENCE: 833 where number is a decimal-integer. 835 If the Media Playlist does not contain an EXT-X-DISCONTINUITY- 836 SEQUENCE tag, then the Discontinuity Sequence Number of the first 837 Media Segment in the Playlist SHALL be considered to be 0. 839 The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first 840 Media Segment in the Playlist. 842 The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT- 843 X-DISCONTINUITY tag. 845 See Section 6.2.1 and Section 6.2.2 for more information about 846 setting the value of the EXT-X-DISCONTINUITY-SEQUENCE tag. 848 4.4.3.4. EXT-X-ENDLIST 850 The EXT-X-ENDLIST tag indicates that no more Media Segments will be 851 added to the Media Playlist file. It MAY occur anywhere in the Media 852 Playlist file. Its format is: 854 #EXT-X-ENDLIST 856 4.4.3.5. EXT-X-PLAYLIST-TYPE 858 The EXT-X-PLAYLIST-TYPE tag provides mutability information about the 859 Media Playlist file. It applies to the entire Media Playlist file. 860 It is OPTIONAL. Its format is: 862 #EXT-X-PLAYLIST-TYPE: 864 where type-enum is either EVENT or VOD. 866 Section 6.2.1 defines the implications of the EXT-X-PLAYLIST-TYPE 867 tag. 869 If the EXT-X-PLAYLIST-TYPE value is EVENT, Media Segments can only be 870 added to the end of the Media Playlist. If the EXT-X-PLAYLIST-TYPE 871 value is Video On Demand (VOD), the Media Playlist cannot change. 873 If the EXT-X-PLAYLIST-TYPE tag is omitted from a Media Playlist, the 874 Playlist can be updated according to the rules in Section 6.2.1 with 875 no additional restrictions. For example, a live Playlist 876 (Section 6.2.2) MAY be updated to remove Media Segments in the order 877 that they appeared. 879 4.4.3.6. EXT-X-I-FRAMES-ONLY 881 The EXT-X-I-FRAMES-ONLY tag indicates that each Media Segment in the 882 Playlist describes a single I-frame. I-frames are encoded video 883 frames whose decoding does not depend on any other frame. I-frame 884 Playlists can be used for trick play, such as fast forward, rapid 885 reverse, and scrubbing. 887 The EXT-X-I-FRAMES-ONLY tag applies to the entire Playlist. Its 888 format is: 890 #EXT-X-I-FRAMES-ONLY 892 In a Playlist with the EXT-X-I-FRAMES-ONLY tag, the Media Segment 893 duration (EXTINF tag value) is the time between the presentation time 894 of the I-frame in the Media Segment and the presentation time of the 895 next I-frame in the Playlist, or the end of the presentation if it is 896 the last I-frame in the Playlist. 898 Media resources containing I-frame segments MUST begin with either a 899 Media Initialization Section (Section 3) or be accompanied by an EXT- 900 X-MAP tag indicating the Media Initialization Section so that clients 901 can load and decode I-frame segments in any order. The byte range of 902 an I-frame segment with an EXT-X-BYTERANGE tag applied to it 903 (Section 4.4.4.2) MUST NOT include its Media Initialization Section; 904 clients can assume that the Media Initialization Section is defined 905 by the EXT-X-MAP tag, or is located between the start of the resource 906 and the offset of the first I-frame segment in that resource. 908 Use of the EXT-X-I-FRAMES-ONLY REQUIRES a compatibility version 909 number of 4 or greater. 911 4.4.3.7. EXT-X-PART-INF 913 The EXT-X-PART-INF tag provides information about the Partial 914 Segments in the Playlist. It is REQUIRED if a Playlist contains one 915 or more EXT-X-PART tags. Its format is: 917 #EXT-X-PART-INF: 919 The following attributes are defined: 921 PART-TARGET 923 The value is a decimal-floating-point number of seconds indicating 924 the Part Target Duration. This attribute is REQUIRED. 926 4.4.3.8. EXT-X-SERVER-CONTROL 928 The EXT-X-SERVER-CONTROL tag allows the Server to indicate support 929 for Delivery Directives (Section 6.2.5). Its format is:. 931 #EXT-X-SERVER-CONTROL: 933 The following attributes are defined: 935 CAN-SKIP-UNTIL 937 Indicates that the Server can produce Playlist Delta Updates in 938 response to the _HLS_skip Delivery Directive. Its value is the 939 Skip Boundary, a decimal-floating-point number of seconds. The 940 Skip Boundary MUST be at least six times the Target Duration. 942 This attribute is OPTIONAL. It MAY appear in any Media Playlist. 944 CAN-SKIP-DATERANGES 946 A value of YES indicates that the Server can produce Playlist 947 Delta Updates that skip older EXT-X-DATERANGE tags in addition to 948 Media Segments. 950 This attribute is OPTIONAL. It REQUIRES the presence of the CAN- 951 SKIP-UNTIL attribute. 953 HOLD-BACK 955 The value is a decimal-floating-point number of seconds that 956 indicates the server-recommended minimum distance from the end of 957 the Playlist at which clients should begin to play or to which 958 they should seek, unless PART-HOLD-BACK applies. Its value MUST 959 be at least three times the Target Duration. 961 This attribute is OPTIONAL. Its absence implies a value of three 962 times the Target Duration. It MAY appear in any Media Playlist. 964 PART-HOLD-BACK 965 The value is a decimal-floating-point number of seconds that 966 indicates the server-recommended minimum distance from the end of 967 the Playlist at which clients should begin to play or to which 968 they should seek when playing in Low-Latency Mode. Its value MUST 969 be at least twice the Part Target Duration. Its value SHOULD be 970 at least three times the Part Target Duration. If different 971 Renditions have different Part Target Durations then PART-HOLD- 972 BACK SHOULD be at least three times the maximum Part Target 973 Duration. 975 PART-HOLD-BACK is REQUIRED if the Playlist contains the EXT-X- 976 PART-INF tag. 978 CAN-BLOCK-RELOAD 980 The value is an enumerated-string whose value is YES if the server 981 supports Blocking Playlist Reload (Section 6.2.5.2). This 982 attribute is OPTIONAL; its absence implies no support. 984 4.4.4. Media Segment Tags 986 Each Media Segment is specified by a series of Media Segment tags 987 followed by a URI. Some Media Segment tags apply to just the next 988 segment; others apply to all subsequent segments until another 989 instance of the same tag. 991 A Media Segment tag MUST NOT appear in a Master Playlist. Clients 992 MUST fail to parse Playlists that contain both Media Segment tags and 993 Master Playlist tags (Section 4.4.6). 995 4.4.4.1. EXTINF 997 The EXTINF tag specifies the duration of a Media Segment. It applies 998 only to the next Media Segment. This tag is REQUIRED for each Media 999 Segment. Its format is: 1001 #EXTINF:,[] 1003 where duration is a decimal-floating-point or decimal-integer number 1004 (as described in Section 4.2) that specifies the duration of the 1005 Media Segment in seconds. Durations SHOULD be decimal-floating- 1006 point, with enough accuracy to avoid perceptible error when segment 1007 durations are accumulated. However, if the compatibility version 1008 number is less than 3, durations MUST be integers. Durations that 1009 are reported as integers SHOULD be rounded to the nearest integer. 1010 The remainder of the line following the comma is an optional human- 1011 readable informative title of the Media Segment expressed as UTF-8 1012 text. 1014 4.4.4.2. EXT-X-BYTERANGE 1016 The EXT-X-BYTERANGE tag indicates that a Media Segment is a sub-range 1017 of the resource identified by its URI. It applies only to the next 1018 URI line that follows it in the Playlist. Its format is: 1020 #EXT-X-BYTERANGE:<n>[@<o>] 1022 where n is a decimal-integer indicating the length of the sub-range 1023 in bytes. If present, o is a decimal-integer indicating the start of 1024 the sub-range, as a byte offset from the beginning of the resource. 1025 If o is not present, the sub-range begins at the next byte following 1026 the sub-range of the previous Media Segment. 1028 If o is not present, a previous Media Segment MUST appear in the 1029 Playlist file and MUST be a sub-range of the same media resource, or 1030 the Media Segment is undefined and the client MUST fail to parse the 1031 Playlist. 1033 A Media Segment without an EXT-X-BYTERANGE tag consists of the entire 1034 resource identified by its URI. 1036 Use of the EXT-X-BYTERANGE tag REQUIRES a compatibility version 1037 number of 4 or greater. 1039 4.4.4.3. EXT-X-DISCONTINUITY 1041 The EXT-X-DISCONTINUITY tag indicates a discontinuity between the 1042 Media Segment that follows it and the one that preceded it. 1044 Its format is: 1046 #EXT-X-DISCONTINUITY 1048 The EXT-X-DISCONTINUITY tag MUST be present if there is a change in 1049 any of the following characteristics: 1051 o file format 1053 o number, type, and identifiers of tracks 1055 o timestamp sequence 1057 The EXT-X-DISCONTINUITY tag SHOULD be present if there is a change in 1058 any of the following characteristics: 1060 o encoding parameters 1061 o encoding sequence 1063 See Section 3, Section 6.2.1, and Section 6.3.3 for more information 1064 about the EXT-X-DISCONTINUITY tag. 1066 4.4.4.4. EXT-X-KEY 1068 Media Segments MAY be encrypted. The EXT-X-KEY tag specifies how to 1069 decrypt them. It applies to every Media Segment and to every Media 1070 Initialization Section declared by an EXT-X-MAP tag that appears 1071 between it and the next EXT-X-KEY tag in the Playlist file with the 1072 same KEYFORMAT attribute (or the end of the Playlist file). Two or 1073 more EXT-X-KEY tags with different KEYFORMAT attributes MAY apply to 1074 the same Media Segment if they ultimately produce the same decryption 1075 key. The format is: 1077 #EXT-X-KEY:<attribute-list> 1079 The following attributes are defined: 1081 METHOD 1083 The value is an enumerated-string that specifies the encryption 1084 method. This attribute is REQUIRED. 1086 The methods defined are: NONE, AES-128, and SAMPLE-AES. 1088 An encryption method of NONE means that Media Segments are not 1089 encrypted. If the encryption method is NONE, other attributes 1090 MUST NOT be present. 1092 An encryption method of AES-128 signals that Media Segments are 1093 completely encrypted using the Advanced Encryption Standard (AES) 1094 [AES_128] with a 128-bit key, Cipher Block Chaining (CBC), and 1095 Public-Key Cryptography Standards #7 (PKCS7) padding [RFC5652]. 1096 CBC is restarted on each segment boundary, using either the 1097 Initialization Vector (IV) attribute value or the Media Sequence 1098 Number as the IV; see Section 5.2. 1100 An alternative to whole-segment encryption is Sample Encryption. 1101 With Sample Encryption, only media sample data - such as audio 1102 packets or video frames - is encrypted. The rest of the Media 1103 Segment is unencrypted. Sample Encryption allows parts of the 1104 Segment to be processed without (or before) decrypting the media 1105 itself. 1107 An encryption method of SAMPLE-AES means that the Media Segments 1108 are Sample Encrypted using the Advanced Encryption Standard 1110 [AES_128]. How these media streams are encrypted and encapsulated 1111 in a segment depends on the media encoding and the media format of 1112 the segment. fMP4 Media Segments are encrypted using the 'cbcs' 1113 scheme of Common Encryption [COMMON_ENC]. Encryption of other 1114 Media Segment formats containing H.264 [H_264], AAC [ISO_14496], 1115 AC-3 [AC_3], and Enhanced AC-3 [AC_3] media streams is described 1116 in the HTTP Live Streaming (HLS) Sample Encryption specification 1117 [SampleEnc]. The IV attribute MAY be present; see Section 5.2. 1119 URI 1121 The value is a quoted-string containing a URI that specifies how 1122 to obtain the key. This attribute is REQUIRED unless the METHOD 1123 is NONE. 1125 IV 1127 The value is a hexadecimal-sequence that specifies a 128-bit 1128 unsigned integer Initialization Vector to be used with the key. 1129 Use of the IV attribute REQUIRES a compatibility version number of 1130 2 or greater. See Section 5.2 for when the IV attribute is used. 1132 KEYFORMAT 1134 The value is a quoted-string that specifies how the key is 1135 represented in the resource identified by the URI; see Section 5 1136 for more detail. This attribute is OPTIONAL; its absence 1137 indicates an implicit value of "identity". Use of the KEYFORMAT 1138 attribute REQUIRES a compatibility version number of 5 or greater. 1140 KEYFORMATVERSIONS 1142 The value is a quoted-string containing one or more positive 1143 integers separated by the "/" character (for example, "1", "1/2", 1144 or "1/2/5"). If more than one version of a particular KEYFORMAT 1145 is defined, this attribute can be used to indicate which 1146 version(s) this instance complies with. This attribute is 1147 OPTIONAL; if it is not present, its value is considered to be "1". 1148 Use of the KEYFORMATVERSIONS attribute REQUIRES a compatibility 1149 version number of 5 or greater. 1151 If the Media Playlist file does not contain an EXT-X-KEY tag, then 1152 Media Segments are not encrypted. 1154 See Section 5 for the format of the Key file, and Section 5.2, 1155 Section 6.2.3, and Section 6.3.6 for additional information on Media 1156 Segment encryption. 1158 4.4.4.5. EXT-X-MAP 1160 The EXT-X-MAP tag specifies how to obtain the Media Initialization 1161 Section (Section 3) required to parse the applicable Media Segments. 1162 It applies to every Media Segment that appears after it in the 1163 Playlist until the next EXT-X-MAP tag or until the end of the 1164 Playlist. 1166 Its format is: 1168 #EXT-X-MAP:<attribute-list> 1170 The following attributes are defined: 1172 URI 1174 The value is a quoted-string containing a URI that identifies a 1175 resource that contains the Media Initialization Section. This 1176 attribute is REQUIRED. 1178 BYTERANGE 1180 The value is a quoted-string specifying a byte range into the 1181 resource identified by the URI attribute. This range SHOULD 1182 contain only the Media Initialization Section. The format of the 1183 byte range is described in Section 4.4.4.2. This attribute is 1184 OPTIONAL; if it is not present, the byte range is the entire 1185 resource indicated by the URI. 1187 An EXT-X-MAP tag SHOULD be supplied for Media Segments in Playlists 1188 with the EXT-X-I-FRAMES-ONLY tag when the first Media Segment (i.e., 1189 I-frame) in the Playlist (or the first segment following an EXT- 1190 X-DISCONTINUITY tag) does not immediately follow the Media 1191 Initialization Section at the beginning of its resource. 1193 Use of the EXT-X-MAP tag in a Media Playlist that contains the EXT- 1194 X-I-FRAMES-ONLY tag REQUIRES a compatibility version number of 5 or 1195 greater. Use of the EXT-X-MAP tag in a Media Playlist that DOES NOT 1196 contain the EXT-X-I-FRAMES-ONLY tag REQUIRES a compatibility version 1197 number of 6 or greater. 1199 If the Media Initialization Section declared by an EXT-X-MAP tag is 1200 encrypted with a METHOD of AES-128, the IV attribute of the EXT-X-KEY 1201 tag that applies to the EXT-X-MAP is REQUIRED. 1203 4.4.4.6. EXT-X-PROGRAM-DATE-TIME 1205 The EXT-X-PROGRAM-DATE-TIME tag associates the first sample of a 1206 Media Segment with an absolute date and/or time. It applies only to 1207 the next Media Segment. Its format is: 1209 #EXT-X-PROGRAM-DATE-TIME:<date-time-msec> 1211 where date-time-msec is an ISO/IEC 8601:2004 [ISO_8601] date/time 1212 representation, such as YYYY-MM-DDThh:mm:ss.SSSZ. It SHOULD indicate 1213 a time zone and fractional parts of seconds, to millisecond accuracy. 1215 For example: 1217 #EXT-X-PROGRAM-DATE-TIME:2010-02-19T14:54:23.031+08:00 1219 See Section 6.2.1 and Section 6.3.3 for more information on the EXT- 1220 X-PROGRAM-DATE-TIME tag. 1222 4.4.4.7. EXT-X-GAP 1224 The EXT-X-GAP tag indicates that the segment URL to which it applies 1225 does not contain media data and SHOULD NOT be loaded by clients. It 1226 applies only to the next Media Segment. 1228 Its format is: 1230 #EXT-X-GAP 1232 See Section 6.2.1 and Section 6.3.3 for more information on the EXT- 1233 X-GAP tag. 1235 4.4.4.8. EXT-X-BITRATE 1237 The EXT-X-BITRATE tag identifies the approximate segment bit rate of 1238 the Media Segment(s) to which it applies. It applies to every Media 1239 Segment between it and the next EXT-X-BITRATE tag in the Playlist 1240 file (or the end of the Playlist file) that does not have an EXT- 1241 X-BYTERANGE tag applied to it. Its format is: 1243 #EXT-X-BITRATE:<rate> 1245 where rate is a decimal-integer of kilobits per second. 1247 This tag is OPTIONAL. If it is present then its value MUST be no 1248 less than 90% of the segment bit rate of each Media Segment to which 1249 it is applied and no greater than 110% of the segment bit rate of 1250 each Media Segment to which it is applied. 1252 4.4.4.9. EXT-X-PART 1254 The EXT-X-PART tag identifies a Partial Segment. It is OPTIONAL. 1255 Its format is: 1257 #EXT-X-PART:<attribute-list> 1259 The following attributes are defined: 1261 URI 1263 The value is the URI for the Partial Segment. This attribute is 1264 REQUIRED. 1266 DURATION 1268 The value is the duration of the Partial Segment as a decimal- 1269 floating-point number of seconds. This attribute is REQUIRED. 1271 INDEPENDENT 1273 The value is an enumerated-string whose value is YES if the 1274 Partial Segment contains an independent frame. This attribute is 1275 OPTIONAL; however every Partial Segment containing an independent 1276 frame SHOULD carry it to increase the efficiency with which 1277 clients can join and switch Renditions. 1279 BYTERANGE 1281 Indicates that the Partial Segment is a subrange of the resource 1282 specified by the URI attribute. The value has the same format as 1283 the EXT-X-BYTERANGE tag: <n>[@<o>]. 1285 GAP 1287 The value is an enumerated-string whose value is YES if the 1288 Partial Segment is not available. It is REQUIRED for such Partial 1289 Segments. 1291 All Media Segment Tags (Section 4.4.4) except for EXT-X-BYTERANGE and 1292 EXT-X-GAP that are applied to a Parent Segment MUST appear before the 1293 first EXT-X-PART tag of that Parent Segment. 1295 The duration of a Partial Segment MUST be less than or equal to the 1296 Part Target Duration. The duration of each Partial Segment MUST be 1297 at least 85% of the Part Target Duration, with the exception of 1298 Partial Segments with the INDEPENDENT=YES attribute and the final 1299 Partial Segment of any Parent Segment. 1301 4.4.5. Media Metadata Tags 1303 Media Metadata tags provide information about the playlist that is 1304 not associated with specific Media Segments. There MAY be more than 1305 one Media Metadata tag of each type in any Media Playlist. 1307 4.4.5.1. EXT-X-DATERANGE 1309 The EXT-X-DATERANGE tag associates a Date Range (i.e., a range of 1310 time defined by a starting and ending date) with a set of attribute/ 1311 value pairs. Its format is: 1313 #EXT-X-DATERANGE:<attribute-list> 1315 where the defined attributes are: 1317 ID 1319 A quoted-string that uniquely identifies a Date Range in the 1320 Playlist. This attribute is REQUIRED. 1322 CLASS 1324 A client-defined quoted-string that specifies some set of 1325 attributes and their associated value semantics. All Date Ranges 1326 with the same CLASS attribute value MUST adhere to these 1327 semantics. This attribute is OPTIONAL. 1329 START-DATE 1331 A quoted-string containing the [ISO_8601] date/time at which the 1332 Date Range begins. This attribute is REQUIRED. 1334 END-DATE 1336 A quoted-string containing the [ISO_8601] date/time at which the 1337 Date Range ends. It MUST be equal to or later than the value of 1338 the START-DATE attribute. This attribute is OPTIONAL. 1340 DURATION 1342 The duration of the Date Range expressed as a decimal-floating- 1343 point number of seconds. It MUST NOT be negative. A single 1344 instant in time (e.g., crossing a finish line) SHOULD be 1345 represented with a duration of 0. This attribute is OPTIONAL. 1347 PLANNED-DURATION 1348 The expected duration of the Date Range expressed as a decimal- 1349 floating-point number of seconds. It MUST NOT be negative. This 1350 attribute SHOULD be used to indicate the expected duration of a 1351 Date Range whose actual duration is not yet known. It is 1352 OPTIONAL. 1354 X-<client-attribute> 1356 The "X-" prefix defines a namespace reserved for client-defined 1357 attributes. The client-attribute MUST be a legal AttributeName. 1358 Clients SHOULD use a reverse-DNS syntax when defining their own 1359 attribute names to avoid collisions. The attribute value MUST be 1360 a quoted-string, a hexadecimal-sequence, or a decimal-floating- 1361 point. An example of a client-defined attribute is X-COM-EXAMPLE- 1362 AD-ID="XYZ123". These attributes are OPTIONAL. 1364 SCTE35-CMD, SCTE35-OUT, SCTE35-IN 1366 Used to carry SCTE-35 data; see Section 4.4.5.1.1 for more 1367 information. These attributes are OPTIONAL. 1369 END-ON-NEXT 1371 An enumerated-string whose value MUST be YES. This attribute 1372 indicates that the end of the range containing it is equal to the 1373 START-DATE of its Following Range. The Following Range is the 1374 Date Range of the same CLASS that has the earliest START-DATE 1375 after the START-DATE of the range in question. This attribute is 1376 OPTIONAL. 1378 An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST have a 1379 CLASS attribute. Other EXT-X-DATERANGE tags with the same CLASS 1380 attribute MUST NOT specify Date Ranges that overlap. 1382 An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT 1383 contain DURATION or END-DATE attributes. 1385 A Date Range with neither a DURATION, an END-DATE, nor an END-ON- 1386 NEXT=YES attribute has an unknown duration, even if it has a PLANNED- 1387 DURATION. 1389 If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain 1390 at least one EXT-X-PROGRAM-DATE-TIME tag. 1392 If a Playlist contains two EXT-X-DATERANGE tags with the same ID 1393 attribute value, then any AttributeName that appears in both tags 1394 MUST have the same AttributeValue. 1396 If a Date Range contains both a DURATION attribute and an END-DATE 1397 attribute, the value of the END-DATE attribute MUST be equal to the 1398 value of the START-DATE attribute plus the value of the DURATION 1399 attribute. 1401 Clients SHOULD ignore EXT-X-DATERANGE tags with illegal syntax. 1403 4.4.5.1.1. Mapping SCTE-35 into EXT-X-DATERANGE 1405 Splice information carried in source media according to the SCTE-35 1406 specification [SCTE35] MAY be represented in a Media Playlist using 1407 EXT-X-DATERANGE tags. 1409 Each SCTE-35 splice_info_section() containing a splice_null(), 1410 splice_schedule(), bandwidth_reservation(), or private_cmd() SHOULD 1411 be represented by an EXT-X-DATERANGE tag with an SCTE35-CMD attribute 1412 whose value is the big-endian binary representation of the 1413 splice_info_section(), expressed as a hexadecimal-sequence. 1415 An SCTE-35 splice out/in pair signaled by a pair of splice_insert() 1416 commands SHOULD be represented by one or more EXT-X-DATERANGE tags 1417 carrying the same ID attribute, which MUST be unique to that splice 1418 out/in pair. The "out" splice_info_section() (with 1419 out_of_network_indicator set to 1) MUST be placed in an SCTE35-OUT 1420 attribute, with the same formatting as SCTE35-CMD. The "in" 1421 splice_info_section() (with out_of_network_indicator set to 0) MUST 1422 be placed in an SCTE35-IN attribute, with the same formatting as 1423 SCTE35-CMD. 1425 An SCTE-35 splice out/in pair signaled by a pair of time_signal() 1426 commands, each carrying a single segmentation_descriptor(), SHOULD be 1427 represented by one or more EXT-X-DATERANGE tags carrying the same ID 1428 attribute, which MUST be unique to that splice out/in pair. The 1429 "out" splice_info_section() MUST be placed in an SCTE35-OUT 1430 attribute; the "in" splice_info_section() MUST be placed in an 1431 SCTE35-IN attribute. 1433 Different types of segmentation, as indicated by the 1434 segmentation_type_id in the segmentation_descriptor(), SHOULD be 1435 represented by separate EXT-X-DATERANGE tags, even if two or more 1436 segmentation_descriptor()s arrive in the same splice_info_section(). 1437 In that case, each EXT-X-DATERANGE tag will have an SCTE35-OUT, 1438 SCTE35-IN, or SCTE35-CMD attribute whose value is the entire 1439 splice_info_section(). 1441 An SCTE-35 time_signal() command that does not signal a splice out or 1442 in point SHOULD be represented by an EXT-X-DATERANGE tag with an 1443 SCTE35-CMD attribute. 1445 The START-DATE of an EXT-X-DATERANGE tag containing an SCTE35-OUT 1446 attribute MUST be the date and time that corresponds to the program 1447 time of that splice. 1449 The START-DATE of an EXT-X-DATERANGE tag containing an SCTE35-CMD 1450 MUST be the date and time specified by the splice_time() in the 1451 command or the program time at which the command appeared in the 1452 source stream if the command does not specify a splice_time(). 1454 An EXT-X-DATERANGE tag containing an SCTE35-OUT attribute MAY contain 1455 a PLANNED-DURATION attribute. Its value MUST be the planned duration 1456 of the splice. 1458 The DURATION of an EXT-X-DATERANGE tag containing an SCTE35-IN 1459 attribute MUST be the actual (not planned) program duration between 1460 the corresponding out-point and that in-point. 1462 The END-DATE of an EXT-X-DATERANGE tag containing an SCTE35-IN 1463 attribute MUST be the actual (not planned) program date and time of 1464 that in-point. 1466 If the actual end date and time is not known when an SCTE35-OUT 1467 attribute is added to the Playlist, the DURATION attribute and the 1468 END-TIME attribute MUST NOT be present; the actual end date of the 1469 splice SHOULD be signaled by another EXT-X-DATERANGE tag once it has 1470 been established. 1472 A canceled splice SHOULD NOT appear in the Playlist as an EXT- 1473 X-DATERANGE tag. 1475 An EXT-X-DATERANGE tag announcing a splice SHOULD be added to a 1476 Playlist at the same time as the last pre-splice Media Segment, or 1477 earlier if possible. 1479 The ID attribute of an EXT-X-DATERANGE tag MAY contain a 1480 splice_event_id and/or a segmentation_event_id, but it MUST be unique 1481 in the Playlist. If there is a possibility that an SCTE-35 id will 1482 be reused, the ID attribute value MUST include disambiguation, such 1483 as a date or sequence number. 1485 4.4.5.1.2. EXT-X-SKIP 1487 A server produces a Playlist Delta Update (Section 6.2.5.1), by 1488 replacing tags earlier than the Skip Boundary with an EXT-X-SKIP tag. 1490 When replacing Media Segments, the EXT-X-SKIP tag replaces the 1491 segment URI lines and all Media Segment Tags tags that are applied to 1492 those segments. 1494 Its format is: 1496 #EXT-X-SKIP:<attribute-list> 1498 The following attributes are defined: 1500 SKIPPED-SEGMENTS 1502 The value is the count of Media Segments were replaced by the EXT- 1503 X-SKIP tag. This attribute is REQUIRED. 1505 RECENTLY-REMOVED-DATERANGES 1507 The value is a quoted-string consisting of a tab (0x9) delimited 1508 list of EXT-X-DATERANGE IDs that have been removed from the 1509 Playlist recently. See Section 6.2.5.1 for more information. 1510 This attribute is REQUIRED if the Client requested an update that 1511 skips EXT-X-DATERANGE tags. 1513 4.4.5.1.3. EXT-X-PRELOAD-HINT 1515 The EXT-X-PRELOAD-HINT tag allows a Client loading media from a live 1516 stream to reduce the time to obtain a resource from the Server by 1517 issuing its request before the resource is available to be delivered. 1518 The server will hold onto the request ("block") until it can respond. 1520 Its format is: 1522 #EXT-X-PRELOAD-HINT:<attribute-list> 1524 The following attributes are defined: 1526 TYPE 1528 The value is an enumerated-string that specifies the type of the 1529 hinted resource. If the value is PART, the resource is a Partial 1530 Segment. If the value is MAP, the resource is a Media 1531 Initialization Section. This attribute is REQUIRED. 1533 URI 1535 The value is a URI identifying the hinted resource. It MUST match 1536 the URI that will be subsequently added to the Playlist as a non- 1537 hinted resource (for example, the URI of an EXT-X-PART tag). The 1538 URI MAY be relative to the URI of the Playlist or it MAY be 1539 absolute. The hostname MAY differ from the hostname of the 1540 Playlist URI. This attribute is REQUIRED. 1542 BYTERANGE-START 1544 The value is the byte offset of the first byte of the hinted 1545 resource, from the beginning of the resource identified by the URI 1546 attribute. This attribute is OPTIONAL. Its absence implies a 1547 value of 0. 1549 BYTERANGE-LENGTH 1551 The value is the length of the hinted resource. This attribute is 1552 OPTIONAL. Its absence indicates that the last byte of the hinted 1553 resource is the last byte of the resource identified by the URI 1554 attribute. 1556 Note that when a hinted Partial Segment eventually appears in the 1557 Playlist as an EXT-X-PART tag, it MAY have a different Discontinuity 1558 Sequence Number, Media Initialization Section, or encryption 1559 configuration. In other words, the Partial Segment can be preceded 1560 by an EXTINF tag indicating the end of the previous Parent Segment 1561 and an EXT-X-DISCONTINUITY, EXT-X-MAP, or EXT-X-KEY tag. 1563 A Playlist containing an EXT-X-ENDLIST tag MUST NOT contain an EXT-X- 1564 PRELOAD-HINT tag. 1566 4.4.5.1.4. EXT-X-RENDITION-REPORT 1568 The EXT-X-RENDITION-REPORT tag carries information about an 1569 associated Rendition that is as up-to-date as the Playlist that 1570 contains it. Its format is: 1572 #EXT-X-RENDITION-REPORT:<attribute-list> 1574 The following attributes are defined: 1576 URI 1578 The value is the URI for the Media Playlist of the specified 1579 Rendition. It MUST be relative to the URI of the Media Playlist 1580 containing the EXT-X-RENDITION-REPORT tag. This attribute is 1581 REQUIRED. 1583 LAST-MSN 1585 The value is a decimal-integer specifying the Media Sequence 1586 Number of the last Media Segment currently in the specified 1587 Rendition. If the Rendition contains Partial Segments then this 1588 value is the Media Sequence Number of the last Partial Segment. 1589 This attribute is REQUIRED. 1591 LAST-PART 1593 The value is a decimal-integer that indicates the Part Index of 1594 the last Partial Segment currently in the specified Rendition 1595 whose Media Sequence Number is equal to the LAST-MSN attribute 1596 value. This attribute is REQUIRED if the Rendition contains a 1597 Partial Segment. 1599 A server MAY omit adding an attribute to an EXT-X-RENDITION-REPORT 1600 tag - even a mandatory attribute - if its value is the same as that 1601 of the Rendition Report of the Media Playlist to which the EXT-X- 1602 RENDITION-REPORT tag is being added. Doing so reduces the size of 1603 the Rendition Report. 1605 4.4.6. Master Playlist Tags 1607 Master Playlist tags define the Variant Streams, Renditions, and 1608 other global parameters of the presentation. 1610 Master Playlist tags MUST NOT appear in a Media Playlist; clients 1611 MUST fail to parse any Playlist that contains both a Master Playlist 1612 tag and either a Media Playlist tag or a Media Segment tag. 1614 4.4.6.1. EXT-X-MEDIA 1616 The EXT-X-MEDIA tag is used to relate Media Playlists that contain 1617 alternative Renditions (Section 4.4.6.2.1) of the same content. For 1618 example, three EXT-X-MEDIA tags can be used to identify audio-only 1619 Media Playlists that contain English, French, and Spanish Renditions 1620 of the same presentation. Or, two EXT-X-MEDIA tags can be used to 1621 identify video-only Media Playlists that show two different camera 1622 angles. 1624 Its format is: 1626 #EXT-X-MEDIA:<attribute-list> 1628 The following attributes are defined: 1630 TYPE 1632 The value is an enumerated-string; valid strings are AUDIO, VIDEO, 1633 SUBTITLES, and CLOSED-CAPTIONS. This attribute is REQUIRED. 1635 Typically, closed-caption [CEA608] media is carried in the video 1636 stream. Therefore, an EXT-X-MEDIA tag with TYPE of CLOSED- 1637 CAPTIONS does not specify a Rendition; the closed-caption media is 1638 present in the Media Segments of every video Rendition. 1640 URI 1642 The value is a quoted-string containing a URI that identifies the 1643 Media Playlist file. This attribute is OPTIONAL; see 1644 Section 4.4.6.2.1. If the TYPE is CLOSED-CAPTIONS, the URI 1645 attribute MUST NOT be present. 1647 GROUP-ID 1649 The value is a quoted-string that specifies the group to which the 1650 Rendition belongs. See Section 4.4.6.1.1. This attribute is 1651 REQUIRED. 1653 LANGUAGE 1655 The value is a quoted-string containing one of the standard Tags 1656 for Identifying Languages [RFC5646], which identifies the primary 1657 language used in the Rendition. This attribute is OPTIONAL. 1659 ASSOC-LANGUAGE 1661 The value is a quoted-string containing a language tag [RFC5646] 1662 that identifies a language that is associated with the Rendition. 1663 An associated language is often used in a different role than the 1664 language specified by the LANGUAGE attribute (e.g., written versus 1665 spoken, or a fallback dialect). This attribute is OPTIONAL. 1667 The LANGUAGE and ASSOC-LANGUAGE attributes can be used, for 1668 example, to link Norwegian Renditions that use different spoken 1669 and written languages. 1671 NAME 1673 The value is a quoted-string containing a human-readable 1674 description of the Rendition. If the LANGUAGE attribute is 1675 present, then this description SHOULD be in that language. This 1676 attribute is REQUIRED. 1678 DEFAULT 1680 The value is an enumerated-string; valid strings are YES and NO. 1681 If the value is YES, then the client SHOULD play this Rendition of 1682 the content in the absence of information from the user indicating 1683 a different choice. This attribute is OPTIONAL. Its absence 1684 indicates an implicit value of NO. 1686 AUTOSELECT 1687 The value is an enumerated-string; valid strings are YES and NO. 1688 This attribute is OPTIONAL. Its absence indicates an implicit 1689 value of NO. If the value is YES, then the client MAY choose to 1690 play this Rendition in the absence of explicit user preference 1691 because it matches the current playback environment, such as 1692 chosen system language. 1694 If the AUTOSELECT attribute is present, its value MUST be YES if 1695 the value of the DEFAULT attribute is YES. 1697 FORCED 1699 The value is an enumerated-string; valid strings are YES and NO. 1700 This attribute is OPTIONAL. Its absence indicates an implicit 1701 value of NO. The FORCED attribute MUST NOT be present unless the 1702 TYPE is SUBTITLES. 1704 A value of YES indicates that the Rendition contains content that 1705 is considered essential to play. When selecting a FORCED 1706 Rendition, a client SHOULD choose the one that best matches the 1707 current playback environment (e.g., language). 1709 A value of NO indicates that the Rendition contains content that 1710 is intended to be played in response to explicit user request. 1712 INSTREAM-ID 1714 The value is a quoted-string that specifies a Rendition within the 1715 segments in the Media Playlist. This attribute is REQUIRED if the 1716 TYPE attribute is CLOSED-CAPTIONS, in which case it MUST have one 1717 of the values: "CC1", "CC2", "CC3", "CC4", or "SERVICEn" where n 1718 MUST be an integer between 1 and 63 (e.g., "SERVICE9" or 1719 "SERVICE42"). 1721 The values "CC1", "CC2", "CC3", and "CC4" identify a Line 21 Data 1722 Services channel [CEA608]. The "SERVICE" values identify a 1723 Digital Television Closed Captioning [CEA708] service block 1724 number. 1726 For all other TYPE values, the INSTREAM-ID MUST NOT be specified. 1728 CHARACTERISTICS 1730 The value is a quoted-string containing one or more Uniform Type 1731 Identifiers [UTI] separated by comma (,) characters. This 1732 attribute is OPTIONAL. Each UTI indicates an individual 1733 characteristic of the Rendition. 1735 A SUBTITLES Rendition MAY include the following characteristics: 1736 "public.accessibility.transcribes-spoken-dialog", 1737 "public.accessibility.describes-music-and-sound", and 1738 "public.easy-to-read" (which indicates that the subtitles have 1739 been edited for ease of reading). 1741 An AUDIO Rendition MAY include the following characteristic: 1742 "public.accessibility.describes-video". 1744 The CHARACTERISTICS attribute MAY include private UTIs. 1746 CHANNELS 1748 The value is a quoted-string that specifies an ordered, slash- 1749 separated ("/") list of parameters. 1751 If the TYPE attribute is AUDIO, then the first parameter is a 1752 count of audio channels expressed as a decimal-integer, indicating 1753 the maximum number of independent, simultaneous audio channels 1754 present in any Media Segment in the Rendition. For example, an 1755 AC-3 5.1 Rendition would have a CHANNELS="6" attribute. 1757 If the TYPE attribute is AUDIO, then the second parameter 1758 identifies the encoding of object-based audio used by the 1759 Rendition. This parameter is a comma-separated list of Audio 1760 Object Coding Identifiers. It is optional. An Audio Object 1761 Coding Identifier is a string containing characters from the set 1762 [A..Z], [0..9], and '-'. They are codec-specific. A parameter 1763 value of consisting solely of the dash character (0x2D) indicates 1764 that the audio is not object-based. 1766 No other CHANNELS parameters are currently defined. 1768 All audio EXT-X-MEDIA tags SHOULD have a CHANNELS attribute. If a 1769 Master Playlist contains two Renditions with the same NAME encoded 1770 with the same codec but a different number of channels, then the 1771 CHANNELS attribute is REQUIRED; otherwise, it is OPTIONAL. 1773 4.4.6.1.1. Rendition Groups 1775 A set of one or more EXT-X-MEDIA tags with the same GROUP-ID value 1776 and the same TYPE value defines a Group of Renditions. Each member 1777 of the Group MUST be an alternative Rendition of the same content; 1778 otherwise, playback errors can occur. 1780 All EXT-X-MEDIA tags in a Playlist MUST meet the following 1781 constraints: 1783 o All EXT-X-MEDIA tags in the same Group MUST have different NAME 1784 attributes. 1786 o A Group MUST NOT have more than one member with a DEFAULT 1787 attribute of YES. 1789 o Each EXT-X-MEDIA tag with an AUTOSELECT=YES attribute SHOULD have 1790 a combination of LANGUAGE [RFC5646], ASSOC-LANGUAGE, FORCED, and 1791 CHARACTERISTICS attributes that is distinct from those of other 1792 AUTOSELECT=YES members of its Group. 1794 A Playlist MAY contain multiple Groups of the same TYPE in order to 1795 provide multiple encodings of that media type. If it does so, each 1796 Group of the same TYPE MUST have the same set of members, and each 1797 corresponding member MUST have identical attributes with the 1798 exception of the URI and CHANNELS attributes. 1800 Each member in a Group of Renditions MAY have a different sample 1801 format. For example, an English Rendition can be encoded with AC-3 1802 5.1 while a Spanish Rendition is encoded with AAC stereo. However, 1803 any EXT-X-STREAM-INF tag (Section 4.4.6.2) or EXT-X-I-FRAME-STREAM- 1804 INF tag (Section 4.4.6.3) that references such a Group MUST have a 1805 CODECS attribute that lists every sample format present in any 1806 Rendition in the Group, or client playback failures can occur. In 1807 the example above, the CODECS attribute would include 1808 "ac-3,mp4a.40.2". 1810 4.4.6.2. EXT-X-STREAM-INF 1812 The EXT-X-STREAM-INF tag specifies a Variant Stream, which is a set 1813 of Renditions that can be combined to play the presentation. The 1814 attributes of the tag provide information about the Variant Stream. 1816 The URI line that follows the EXT-X-STREAM-INF tag specifies a Media 1817 Playlist that carries a Rendition of the Variant Stream. The URI 1818 line is REQUIRED. Clients that do not support multiple video 1819 Renditions SHOULD play this Rendition. 1821 Its format is: 1823 #EXT-X-STREAM-INF:<attribute-list> 1824 <URI> 1826 The following attributes are defined: 1828 BANDWIDTH 1829 The value is a decimal-integer of bits per second. It represents 1830 the peak segment bit rate of the Variant Stream. 1832 If all the Media Segments in a Variant Stream have already been 1833 created, the BANDWIDTH value MUST be the largest sum of peak 1834 segment bit rates that is produced by any playable combination of 1835 Renditions. (For a Variant Stream with a single Media Playlist, 1836 this is just the peak segment bit rate of that Media Playlist.) 1837 An inaccurate value can cause playback stalls or prevent clients 1838 from playing the variant. 1840 If the Master Playlist is to be made available before all Media 1841 Segments in the presentation have been encoded, the BANDWIDTH 1842 value SHOULD be the BANDWIDTH value of a representative period of 1843 similar content, encoded using the same settings. 1845 Every EXT-X-STREAM-INF tag MUST include the BANDWIDTH attribute. 1847 AVERAGE-BANDWIDTH 1849 The value is a decimal-integer of bits per second. It represents 1850 the average segment bit rate of the Variant Stream. 1852 If all the Media Segments in a Variant Stream have already been 1853 created, the AVERAGE-BANDWIDTH value MUST be the largest sum of 1854 average segment bit rates that is produced by any playable 1855 combination of Renditions. (For a Variant Stream with a single 1856 Media Playlist, this is just the average segment bit rate of that 1857 Media Playlist.) An inaccurate value can cause playback stalls or 1858 prevent clients from playing the variant. 1860 If the Master Playlist is to be made available before all Media 1861 Segments in the presentation have been encoded, the AVERAGE- 1862 BANDWIDTH value SHOULD be the AVERAGE-BANDWIDTH value of a 1863 representative period of similar content, encoded using the same 1864 settings. 1866 The AVERAGE-BANDWIDTH attribute is OPTIONAL. 1868 CODECS 1870 The value is a quoted-string containing a comma-separated list of 1871 formats, where each format specifies a media sample type that is 1872 present in one or more Renditions specified by the Variant Stream. 1873 Valid format identifiers are those in the ISO Base Media File 1874 Format Name Space defined by "The 'Codecs' and 'Profiles' 1875 Parameters for "Bucket" Media Types" [RFC6381]. 1877 For example, a stream containing AAC low complexity (AAC-LC) audio 1878 and H.264 Main Profile Level 3.0 video would have a CODECS value 1879 of "mp4a.40.2,avc1.4d401e". 1881 Note that if a Variant Stream specifies one or more Renditions 1882 that include IMSC subtitles, the CODECS attribute MUST indicate 1883 this with a format identifier such as "stpp.ttml.im1t". 1885 Every EXT-X-STREAM-INF tag SHOULD include a CODECS attribute. 1887 RESOLUTION 1889 The value is a decimal-resolution describing the optimal pixel 1890 resolution at which to display all the video in the Variant 1891 Stream. 1893 The RESOLUTION attribute is OPTIONAL but is recommended if the 1894 Variant Stream includes video. 1896 FRAME-RATE 1898 The value is a decimal-floating-point describing the maximum frame 1899 rate for all the video in the Variant Stream, rounded to three 1900 decimal places. 1902 The FRAME-RATE attribute is OPTIONAL but is recommended if the 1903 Variant Stream includes video. The FRAME-RATE attribute SHOULD be 1904 included if any video in a Variant Stream exceeds 30 frames per 1905 second. 1907 HDCP-LEVEL 1909 The value is an enumerated-string; valid strings are TYPE-0, TYPE- 1910 1, and NONE. This attribute is advisory. A value of TYPE-0 1911 indicates that the Variant Stream could fail to play unless the 1912 output is protected by High-bandwidth Digital Content Protection 1913 (HDCP) Type 0 [HDCP] or equivalent. A value of TYPE-1 indicates 1914 that the Variant Stream could fail to play unless the output is 1915 protected by HDCP Type 1 or equivalent. A value of NONE indicates 1916 that the content does not require output copy protection. 1918 Encrypted Variant Streams with different HDCP levels SHOULD use 1919 different media encryption keys. 1921 The HDCP-LEVEL attribute is OPTIONAL. It SHOULD be present if any 1922 content in the Variant Stream will fail to play without HDCP. 1923 Clients without output copy protection SHOULD NOT load a Variant 1924 Stream with an HDCP-LEVEL attribute unless its value is NONE. 1926 ALLOWED-CPC 1928 The ALLOWED-CPC attribute allows a server to indicate that the 1929 playback of a Variant Stream containing encrypted Media Segments 1930 is to be restricted to devices that guarantee a certain level of 1931 content protection robustness. Its value is a quoted-string 1932 containing a comma-separated list of entries. Each entry consists 1933 of a KEYFORMAT attribute value followed by a colon character (:) 1934 followed by a sequence of Content Protection Configuration (CPC) 1935 Labels separated by slash (/) characters. Each CPC Label is a 1936 string containing characters from the set [A..Z], [0..9], and '-'. 1938 For example: ALLOWED-CPC="com.example.drm1:SMART-TV/PC, 1939 com.example.drm2:HW" 1941 A CPC Label identifies a class of playback device that implements 1942 the KEYFORMAT with a certain level of content protection 1943 robustness. Each KEYFORMAT can define its own set of CPC Labels. 1944 The "identity" KEYFORMAT does not define any labels. A KEYFORMAT 1945 that defines CPC Labels SHOULD also specify its robustness 1946 requirements in a secure manner in each key response. 1948 A client MAY play the Variant Stream if it implements one of the 1949 listed KEYFORMAT schemes with content protection robustness that 1950 matches one or more of the CPC Labels in the list. If it does not 1951 match any of the CPC Labels then it SHOULD NOT attempt to play the 1952 Variant Stream. 1954 The ALLOWED-CPC attribute is OPTIONAL. If it is not present or 1955 does not contain a particular KEYFORMAT then all clients that 1956 support that KEYFORMAT MAY play the Variant Stream. 1958 VIDEO-RANGE 1960 The value is an enumerated-string; valid strings are SDR, HLG and 1961 PQ. 1963 The value MUST be SDR if the video in the Variant Stream is 1964 encoded using one of the following reference opto-electronic 1965 transfer characteristic functions specified by the 1966 TransferCharacteristics code point: [CICP] 1, 6, 13, 14, 15. Note 1967 that different TransferCharacteristics code points can use the 1968 same transfer function. 1970 The value MUST be HLG if the video in the Variant Stream is 1971 encoded using a reference opto-electronic transfer characteristic 1972 function specified by the TransferCharacteristics code point 18, 1973 or consists of such video mixed with video qualifying as SDR (see 1974 above). 1976 The value MUST be PQ if the video in the Variant Stream is encoded 1977 using a reference opto-electronic transfer characteristic function 1978 specified by the TransferCharacteristics code point 16, or 1979 consists of such video mixed with video qualifying as SDR or HLG 1980 (see above). 1982 This attribute is OPTIONAL. Its absence implies a value of SDR. 1983 Clients that do not recognize the attribute value SHOULD NOT 1984 select the Variant Stream. 1986 AUDIO 1988 The value is a quoted-string. It MUST match the value of the 1989 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 1990 Playlist whose TYPE attribute is AUDIO. It indicates the set of 1991 audio Renditions that SHOULD be used when playing the 1992 presentation. See Section 4.4.6.2.1. 1994 The AUDIO attribute is OPTIONAL. 1996 VIDEO 1998 The value is a quoted-string. It MUST match the value of the 1999 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 2000 Playlist whose TYPE attribute is VIDEO. It indicates the set of 2001 video Renditions that SHOULD be used when playing the 2002 presentation. See Section 4.4.6.2.1. 2004 The VIDEO attribute is OPTIONAL. 2006 SUBTITLES 2008 The value is a quoted-string. It MUST match the value of the 2009 GROUP-ID attribute of an EXT-X-MEDIA tag elsewhere in the Master 2010 Playlist whose TYPE attribute is SUBTITLES. It indicates the set 2011 of subtitle Renditions that can be used when playing the 2012 presentation. See Section 4.4.6.2.1. 2014 The SUBTITLES attribute is OPTIONAL. 2016 CLOSED-CAPTIONS 2018 The value can be either a quoted-string or an enumerated-string 2019 with the value NONE. If the value is a quoted-string, it MUST 2020 match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag 2021 elsewhere in the Playlist whose TYPE attribute is CLOSED-CAPTIONS, 2022 and it indicates the set of closed-caption Renditions that can be 2023 used when playing the presentation. See Section 4.4.6.2.1. 2025 If the value is the enumerated-string value NONE, all EXT-X- 2026 STREAM-INF tags MUST have this attribute with a value of NONE, 2027 indicating that there are no closed captions in any Variant Stream 2028 in the Master Playlist. Having closed captions in one Variant 2029 Stream but not another can trigger playback inconsistencies. 2031 The CLOSED-CAPTIONS attribute is OPTIONAL. 2033 4.4.6.2.1. Alternative Renditions 2035 When an EXT-X-STREAM-INF tag contains an AUDIO, VIDEO, SUBTITLES, or 2036 CLOSED-CAPTIONS attribute, it indicates that alternative Renditions 2037 of the content are available for playback of that Variant Stream. 2039 When defining alternative Renditions, the following constraints MUST 2040 be met to prevent client playback errors: 2042 o All playable combinations of Renditions associated with an EXT-X- 2043 STREAM-INF tag MUST have an aggregate bandwidth less than or equal 2044 to the BANDWIDTH attribute of the EXT-X-STREAM-INF tag. 2046 o If an EXT-X-STREAM-INF tag contains a RESOLUTION attribute and a 2047 VIDEO attribute, then every alternative video Rendition MUST have 2048 an optimal display resolution matching the value of the RESOLUTION 2049 attribute. 2051 o Every alternative Rendition associated with an EXT-X-STREAM-INF 2052 tag MUST meet the constraints for a Variant Stream described in 2053 Section 6.2.4. 2055 The URI attribute of the EXT-X-MEDIA tag is REQUIRED if the media 2056 type is SUBTITLES, but OPTIONAL if the media type is VIDEO or AUDIO. 2057 If the media type is VIDEO or AUDIO, a missing URI attribute 2058 indicates that the media data for this Rendition is included in the 2059 Media Playlist of any EXT-X-STREAM-INF tag referencing this EXT- 2060 X-MEDIA tag. If the media TYPE is AUDIO and the URI attribute is 2061 missing, clients MUST assume that the audio data for this Rendition 2062 is present in every video Rendition specified by the EXT-X-STREAM-INF 2063 tag. 2065 The URI attribute of the EXT-X-MEDIA tag MUST NOT be included if the 2066 media type is CLOSED-CAPTIONS. 2068 4.4.6.3. EXT-X-I-FRAME-STREAM-INF 2070 The EXT-X-I-FRAME-STREAM-INF tag identifies a Media Playlist file 2071 containing the I-frames of a multimedia presentation. It stands 2072 alone, in that it does not apply to a particular URI in the Master 2073 Playlist. Its format is: 2075 #EXT-X-I-FRAME-STREAM-INF:<attribute-list> 2077 All attributes defined for the EXT-X-STREAM-INF tag (Section 4.4.6.2) 2078 are also defined for the EXT-X-I-FRAME-STREAM-INF tag, except for the 2079 FRAME-RATE, AUDIO, SUBTITLES, and CLOSED-CAPTIONS attributes. In 2080 addition, the following attribute is defined: 2082 URI 2084 The value is a quoted-string containing a URI that identifies the 2085 I-frame Media Playlist file. That Playlist file MUST contain an 2086 EXT-X-I-FRAMES-ONLY tag. 2088 Every EXT-X-I-FRAME-STREAM-INF tag MUST include a BANDWIDTH attribute 2089 and a URI attribute. 2091 The provisions in Section 4.4.6.2.1 also apply to EXT-X-I-FRAME- 2092 STREAM-INF tags with a VIDEO attribute. 2094 A Master Playlist that specifies alternative VIDEO Renditions and 2095 I-frame Playlists SHOULD include an alternative I-frame VIDEO 2096 Rendition for each regular VIDEO Rendition, with the same NAME and 2097 LANGUAGE attributes. 2099 4.4.6.4. EXT-X-SESSION-DATA 2101 The EXT-X-SESSION-DATA tag allows arbitrary session data to be 2102 carried in a Master Playlist. 2104 Its format is: 2106 #EXT-X-SESSION-DATA:<attribute-list> 2108 The following attributes are defined: 2110 DATA-ID 2112 The value of DATA-ID is a quoted-string that identifies a 2113 particular data value. The DATA-ID SHOULD conform to a reverse 2114 DNS naming convention, such as "com.example.movie.title"; however, 2115 there is no central registration authority, so Playlist authors 2116 SHOULD take care to choose a value that is unlikely to collide 2117 with others. This attribute is REQUIRED. 2119 VALUE 2121 VALUE is a quoted-string. It contains the data identified by 2122 DATA-ID. If the LANGUAGE is specified, VALUE SHOULD contain a 2123 human-readable string written in the specified language. 2125 URI 2127 The value is a quoted-string containing a URI. The resource 2128 identified by the URI MUST be formatted as JSON [RFC8259]; 2129 otherwise, clients may fail to interpret the resource. 2131 LANGUAGE 2133 The value is a quoted-string containing a language tag [RFC5646] 2134 that identifies the language of the VALUE. This attribute is 2135 OPTIONAL. 2137 Each EXT-X-SESSION-DATA tag MUST contain either a VALUE or URI 2138 attribute, but not both. 2140 A Playlist MAY contain multiple EXT-X-SESSION-DATA tags with the same 2141 DATA-ID attribute. A Playlist MUST NOT contain more than one EXT-X- 2142 SESSION-DATA tag with the same DATA-ID attribute and the same 2143 LANGUAGE attribute. 2145 4.4.6.5. EXT-X-SESSION-KEY 2147 The EXT-X-SESSION-KEY tag allows encryption keys from Media Playlists 2148 to be specified in a Master Playlist. This allows the client to 2149 preload these keys without having to read the Media Playlist(s) 2150 first. 2152 Its format is: 2154 #EXT-X-SESSION-KEY:<attribute-list> 2156 All attributes defined for the EXT-X-KEY tag (Section 4.4.4.4) are 2157 also defined for the EXT-X-SESSION-KEY, except that the value of the 2158 METHOD attribute MUST NOT be NONE. If an EXT-X-SESSION-KEY is used, 2159 the values of the METHOD, KEYFORMAT, and KEYFORMATVERSIONS attributes 2160 MUST match any EXT-X-KEY with the same URI value. 2162 EXT-X-SESSION-KEY tags SHOULD be added if multiple Variant Streams or 2163 Renditions use the same encryption keys and formats. An EXT-X- 2164 SESSION-KEY tag is not associated with any particular Media Playlist. 2166 A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY 2167 tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS 2168 attribute values. 2170 The EXT-X-SESSION-KEY tag is optional. 2172 5. Key Files 2174 5.1. Structure of Key Files 2176 An EXT-X-KEY tag with a URI attribute identifies a Key file. A Key 2177 file contains a cipher key that can decrypt Media Segments in the 2178 Playlist. 2180 [AES_128] encryption uses 16-octet keys. If the KEYFORMAT of an EXT- 2181 X-KEY tag is "identity", the Key file is a single packed array of 16 2182 octets in binary format. 2184 5.2. IV for AES-128 2186 [AES_128] REQUIRES the same 16-octet IV to be supplied when 2187 encrypting and decrypting. Varying this IV increases the strength of 2188 the cipher. 2190 An IV attribute on an EXT-X-KEY tag with a KEYFORMAT of "identity" 2191 specifies an IV that can be used when decrypting Media Segments 2192 encrypted with that Key file. IV values for AES-128 are 128-bit 2193 numbers. 2195 An EXT-X-KEY tag with a KEYFORMAT of "identity" that does not have an 2196 IV attribute indicates that the Media Sequence Number is to be used 2197 as the IV when decrypting a Media Segment, by putting its big-endian 2198 binary representation into a 16-octet (128-bit) buffer and padding 2199 (on the left) with zeros. 2201 6. Client/Server Responsibilities 2203 6.1. Introduction 2205 This section describes how the server generates the Playlist and 2206 Media Segments and how the client should download them for playback. 2208 6.2. Server Responsibilities 2210 6.2.1. General Server Responsibilities 2212 The production of the source media is outside the scope of this 2213 document, which simply presumes a source of continuous encoded media 2214 containing the presentation. 2216 The server MUST divide the source media into individual Media 2217 Segments whose duration (when rounded to a whole second) is less than 2218 or equal to the Target Duration. Segments longer than that can 2219 trigger playback stalls and other errors. 2221 The server SHOULD attempt to divide the source media at points that 2222 support effective decode of individual Media Segments, such as on 2223 packet and key frame boundaries. 2225 The server MUST create a URI for every Media Segment that enables its 2226 clients to obtain the segment data. If a server supports partial 2227 loading of resources (e.g., via HTTP Range requests), it MAY specify 2228 segments as sub-ranges of larger resources using the EXT-X-BYTERANGE 2229 tag. 2231 The absence of media data (due to, for example, the temporary 2232 unavailability of an encoder) SHOULD be signaled by adding one or 2233 more Media Segments to the Playlist whose Segment durations add up to 2234 the duration of absent media; these Media Segments MUST have EXT- 2235 X-GAP tags applied to them. Similarly, such Partial Segments MUST 2236 have a GAP=YES attribute. Attempting to download these segments MAY 2237 produce an error, such as HTTP 404 or 410. 2239 A Media Segment MUST be available for immediate download at the full 2240 speed of the link to the Client when it is added to a Playlist unless 2241 it has been marked with an EXT-X-GAP tag; otherwise playback errors 2242 can occur. Once download starts, its transfer rate SHOULD NOT be 2243 constrained by the segment production process. 2245 A Partial Segment MUST be similarly available at the time it is added 2246 to a Playlist. 2248 HTTP servers SHOULD transfer text files -- such as Playlists and 2249 WebVTT segments -- using the "gzip" Content-Encoding if the client 2250 indicates that it is prepared to accept it. 2252 The server must create a Media Playlist file (Section 4) that 2253 contains a URI for each Media Segment that the server wishes to make 2254 available, in the order in which they are to be played. 2256 The value of the EXT-X-VERSION tag (Section 4.4.1.2) SHOULD NOT be 2257 greater than what is required for the tags and attributes in the 2258 Playlist (see Section 7). 2260 Changes to the Playlist file MUST be made atomically from the point 2261 of view of the clients, or playback errors MAY occur. 2263 The server MUST NOT change the Media Playlist file, except to: 2265 Append lines to it (Section 6.2.1). 2267 Remove Media Segment URIs from the Playlist in the order that they 2268 appear, along with any tags that apply only to those segments 2269 (Section 6.2.2). 2271 Remove Media Metadata tags that no longer apply to the 2272 presentation (Section 6.2.1). 2274 Remove EXT-X-PART tags no longer at the live edge (Section 6.2.2). 2276 Increment the value of the EXT-X-MEDIA-SEQUENCE or EXT-X- 2277 DISCONTINUITY-SEQUENCE tags (Section 6.2.2). 2279 Add an EXT-X-ENDLIST tag to the Playlist (Section 6.2.1). 2281 A Media Playlist has further constraints on its updates if it 2282 contains an EXT-X-PLAYLIST-TYPE tag. An EXT-X-PLAYLIST-TYPE tag with 2283 a value of VOD indicates that the Playlist file MUST NOT change. An 2284 EXT-X-PLAYLIST-TYPE tag with a value of EVENT indicates that the 2285 Server MUST NOT change or remove any part of the Playlist file, with 2286 the exception of EXT-X-PART tags and Media Metadata tags as described 2287 above; the Server MAY append lines to the Playlist. 2289 The value of the EXT-X-TARGETDURATION tag in the Media Playlist MUST 2290 NOT change. A typical Target Duration is 6 seconds. 2292 Playlist changes other than those allowed here can trigger playback 2293 errors and inconsistent client behavior. 2295 Each Media Segment in a Media Playlist has an integer Discontinuity 2296 Sequence Number. The Discontinuity Sequence Number can be used in 2297 addition to the timestamps within the media to synchronize Media 2298 Segments across different Renditions. 2300 A segment's Discontinuity Sequence Number is the value of the EXT-X- 2301 DISCONTINUITY-SEQUENCE tag (or zero if none) plus the number of EXT- 2302 X-DISCONTINUITY tags in the Playlist preceding the URI line of the 2303 segment. 2305 The server MAY associate an absolute date and time with a Media 2306 Segment by applying an EXT-X-PROGRAM-DATE-TIME tag to it. This 2307 defines an informative mapping of the (wall-clock) date and time 2308 specified by the tag to the first media timestamp in the segment, 2309 which may be used as a basis for seeking, for display, or for other 2310 purposes. If a server provides this mapping, it SHOULD apply an EXT- 2311 X-PROGRAM-DATE-TIME tag to every segment that has an EXT- 2312 X-DISCONTINUITY tag applied to it. 2314 The Server MUST NOT add any EXT-X-PROGRAM-DATE-TIME tag to a Playlist 2315 that would cause the mapping between program date and Media Segment 2316 to become ambiguous. 2318 The server MUST NOT remove an EXT-X-DATERANGE tag from a Playlist if 2319 any date in the range maps to a Media Segment in the Playlist. 2321 The server MUST NOT reuse the ID attribute value of an EXT- 2322 X-DATERANGE tag for any new Date Range in the same Playlist. 2324 Once the Following Range of a Date Range with an END-ON-NEXT=YES 2325 attribute is added to a Playlist, the Server MUST NOT subsequently 2326 add a Date Range with the same CLASS attribute whose START-DATE is 2327 between that of the END-ON-NEXT=YES range and its Following Range. 2329 For Date Ranges with a PLANNED-DURATION attribute, the Server SHOULD 2330 signal the actual end of the range once it has been established. It 2331 can do so by adding another EXT-X-DATERANGE tag with the same ID 2332 attribute value and either a DURATION or an END-DATE attribute or, if 2333 the Date Range has an END-ON-NEXT=YES attribute, by adding a 2334 Following Range. 2336 If the Media Playlist contains the final Media Segment of the 2337 presentation, then the Playlist file MUST contain the EXT-X-ENDLIST 2338 tag; this allows clients to minimize unproductive Playlist reloads. 2340 If a Media Playlist does not contain the EXT-X-ENDLIST tag, the 2341 server MUST make a new version of the Playlist file available that 2342 contains at least one new Media Segment. It MUST be made available 2343 no later than 1.5 times the Target Duration after the previous time 2344 the Playlist was updated with a Media Segment. This allows clients 2345 to utilize the network efficiently. 2347 If a Media Playlist without an EXT-X-ENDLIST tag contains Partial 2348 Segments, the Server MUST add a new Partial Segment to the Playlist 2349 within one Part Target Duration after it added the previous Partial 2350 Segment. 2352 If the server wishes to remove an entire presentation, it SHOULD 2353 provide a clear indication to clients that the Playlist file is no 2354 longer available (e.g., with an HTTP 404 or 410 response). It MUST 2355 ensure that all Media Segments in the Playlist file remain available 2356 to clients for at least the duration of the Playlist file at the time 2357 of removal to prevent interruption of in-progress playback. 2359 6.2.2. Live Playlists 2361 The server MAY limit the availability of Media Segments by removing 2362 Media Segments from the Playlist file (Section 6.2.1). If Media 2363 Segments are to be removed, the Playlist file MUST contain an EXT-X- 2364 MEDIA-SEQUENCE tag. Its value MUST be incremented by 1 for every 2365 Media Segment that is removed from the Playlist file; it MUST NOT 2366 decrease or wrap. Clients can malfunction if each Media Segment does 2367 not have a consistent, unique Media Sequence Number. 2369 EXT-X-PART tags SHOULD be removed from the Playlist after they are 2370 greater than three Target Durations from the end of the Playlist. 2372 Media Segments and EXT-X-PART tags MUST be removed from the Playlist 2373 in the order that they appear in the Playlist; otherwise, client 2374 playback can malfunction. 2376 The server MUST NOT remove a Media Segment from a Playlist file 2377 without an EXT-X-ENDLIST tag if that would produce a Playlist whose 2378 duration is less than three times the Target Duration. Doing so can 2379 trigger playback stalls. 2381 The Availability Duration of a Media Segment is the duration of the 2382 segment plus the duration of the longest-duration Playlist 2383 distributed by the server containing that segment. If the server 2384 removes a Media Segment URI from a Playlist that contains an EXT- 2385 X-ENDLIST tag, clients MUST be able to download the corresponding 2386 Media Segment until the time of removal plus the segment's 2387 Availability Duration. If the server removes a Media Segment URI 2388 from a Playlist that does not contain an EXT-X-ENDLIST tag, clients 2389 MUST be able to download the segment until the time at which it first 2390 appeared in the Playlist plus the segment's Availability Duration. 2392 If the server wishes to remove segments from a Media Playlist 2393 containing an EXT-X-DISCONTINUITY tag, the Media Playlist MUST 2394 contain an EXT-X-DISCONTINUITY-SEQUENCE tag. Without the EXT-X- 2395 DISCONTINUITY-SEQUENCE tag, it can be impossible for a client to 2396 locate corresponding segments between Renditions. 2398 If the server removes an EXT-X-DISCONTINUITY tag from the Media 2399 Playlist, it MUST increment the value of the EXT-X-DISCONTINUITY- 2400 SEQUENCE tag so that the Discontinuity Sequence Numbers of the 2401 segments still in the Media Playlist remain unchanged. The value of 2402 the EXT-X-DISCONTINUITY-SEQUENCE tag MUST NOT decrease or wrap. 2403 Clients can malfunction if each Media Segment does not have a 2404 consistent Discontinuity Sequence Number. 2406 If a server plans to remove a Media Segment after it is delivered to 2407 clients over HTTP, it SHOULD ensure that the HTTP response contains 2408 an Expires header that reflects the planned time-to-live. 2410 A Live Playlist MUST NOT contain the EXT-X-PLAYLIST-TYPE tag, as no 2411 value of that tag allows Media Segments to be removed. 2413 6.2.3. Encrypting Media Segments 2415 Media Segments MAY be encrypted. Every encrypted Media Segment MUST 2416 have an EXT-X-KEY tag (Section 4.4.4.4) applied to it with a URI that 2417 the client can use to obtain a Key file (Section 5) containing the 2418 decryption key. 2420 A Media Segment can only be encrypted with one encryption METHOD, 2421 using one encryption key and IV. However, a server MAY offer 2422 multiple ways to retrieve that key by providing multiple EXT-X-KEY 2423 tags, each with a different KEYFORMAT attribute value. 2425 The server MAY set the HTTP Expires header in the key response to 2426 indicate the duration for which the key can be cached. 2428 Any unencrypted Media Segment in a Playlist that is preceded by an 2429 encrypted Media Segment MUST have an EXT-X-KEY tag applied to it with 2430 a METHOD attribute of NONE. Otherwise, the client will misinterpret 2431 those segments as encrypted. 2433 If the encryption METHOD is AES-128 and the Playlist does not contain 2434 the EXT-X-I-FRAMES-ONLY tag, AES encryption as described in 2435 Section 4.4.4.4 SHALL be applied to individual Media Segments. 2437 If the encryption METHOD is AES-128 and the Playlist contains an EXT- 2438 X-I-FRAMES-ONLY tag, the entire resource MUST be encrypted using 2439 AES-128 CBC with PKCS7 padding [RFC5652]. Encryption MAY be 2440 restarted on 16-byte block boundaries, unless the first block 2441 contains an I-frame. The IV used for encryption MUST be either the 2442 Media Sequence Number of the Media Segment or the value of the IV 2443 attribute of the EXT-X-KEY tag, as described in Section 5.2. These 2444 constraints allow a client to load and decrypt individual I-frames 2445 specified as sub-ranges of regular encrypted Media Segments, and 2446 their Media Initialization Sections. 2448 If the encryption METHOD indicates Sample Encryption, media samples 2449 MAY be encrypted prior to encapsulation in a Media Segment. 2451 The server MUST NOT remove an EXT-X-KEY tag from the Playlist file if 2452 it applies to any Media Segment in the Playlist file, or clients who 2453 subsequently load that Playlist will be unable to decrypt those Media 2454 Segments. 2456 6.2.4. Providing Variant Streams 2458 A server MAY offer multiple Media Playlist files to provide different 2459 encodings of the same presentation. If it does so, it SHOULD provide 2460 a Master Playlist file that lists each Variant Stream to allow 2461 clients to switch between encodings dynamically. 2463 Master Playlists describe regular Variant Streams with EXT-X-STREAM- 2464 INF tags and I-frame Variant Streams with EXT-X-I-FRAME-STREAM-INF 2465 tags. 2467 If an EXT-X-STREAM-INF tag or EXT-X-I-FRAME-STREAM-INF tag contains 2468 the CODECS attribute, the attribute value MUST include every media 2469 format [RFC6381] present in any Media Segment in any of the 2470 Renditions specified by the Variant Stream. 2472 The server MUST meet the following constraints when producing Variant 2473 Streams in order to allow clients to switch between them seamlessly: 2475 Each Variant Stream MUST present the same content. 2477 Matching content in Variant Streams MUST have matching timestamps. 2478 This allows clients to synchronize the media. 2480 Matching content in Variant Streams MUST have matching 2481 Discontinuity Sequence Numbers (see Section 4.4.3.3). 2483 Each Media Playlist in each Variant Stream MUST have the same 2484 Target Duration. The only exceptions are SUBTITLES Renditions and 2485 Media Playlists containing an EXT-X-I-FRAMES-ONLY tag, which MAY 2486 have different Target Durations if they have an EXT-X-PLAYLIST- 2487 TYPE of VOD. 2489 Content that appears in a Media Playlist of one Variant Stream but 2490 not in another MUST appear either at the beginning or at the end 2491 of the Media Playlist file and MUST NOT be longer than the Target 2492 Duration. 2494 If any Media Playlists have an EXT-X-PLAYLIST-TYPE tag, all Media 2495 Playlists MUST have an EXT-X-PLAYLIST-TYPE tag with the same 2496 value. 2498 If the Playlist contains an EXT-X-PLAYLIST-TYPE tag with the value 2499 of VOD, the first segment of every Media Playlist in every Variant 2500 Stream MUST start at the same media timestamp. 2502 If any Media Playlist in a Master Playlist contains an EXT-X- 2503 PROGRAM-DATE-TIME tag, then all Media Playlists in that Master 2504 Playlist MUST contain EXT-X-PROGRAM-DATE-TIME tags with consistent 2505 mappings of date and time to media timestamps. 2507 Each Variant Stream MUST contain the same set of Date Ranges. The 2508 EXT-X-DATERANGE tags of corresponding Date Ranges MUST have the 2509 same ID attribute value and contain the same set of attribute/ 2510 value pairs. 2512 If any Media Playlist in a Master Playlist contains an EXT-X- 2513 SERVER-CONTROL tag, then all Media Playlists in that Master 2514 Playlist MUST contain that tag, with the same attributes and 2515 values. 2517 In addition, for broadest compatibility, Variant Streams SHOULD 2518 contain the same encoded audio bitstream. This allows clients to 2519 switch between Variant Streams without audible glitching. 2521 The rules for Variant Streams also apply to alternative Renditions 2522 (see Section 4.4.6.2.1). 2524 6.2.5. Delivery Directives Interface 2526 A server MAY provide a set of services to its clients by implementing 2527 support for Delivery Directives. Delivery Directives are transmitted 2528 by the Client to the Server as Query Parameters in Playlist request 2529 URIs. 2531 Servers advertise the availability of Delivery Directives using the 2532 EXT-X-SERVER-CONTROL tag (Section 4.4.3.8). 2534 Currently-defined Delivery Directives are _HLS_skip, _HLS_msn and 2535 _HLS_part. 2537 6.2.5.1. Playlist Delta Updates 2539 Live presentations involve frequent Playlist downloads. When 2540 Playlists are large and a Client already has the previous version, 2541 the transfer cost can be reduced considerably by sending only the 2542 newest information in response to a Playlist update request. 2544 A Server advertises support for Playlist Delta Updates that skip 2545 older Media Segments by adding the CAN-SKIP-UNTIL attribute to the 2546 EXT-X-SERVER-CONTROL tag. A Server can also offer support for 2547 Playlist Delta Updates that skip older EXT-X-DATERANGE tags by adding 2548 the CAN-SKIP-DATERANGES attribute to the EXT-X-SERVER-CONTROL tag. 2550 When a Server receives a request for a Playlist containing the CAN- 2551 SKIP-UNTIL attribute but no EXT-X-ENDLIST tag, and the requested URL 2552 contains an _HLS_skip directive whose value is YES or v2, it MUST 2553 respond with a Playlist Delta Update. 2555 The Playlist Delta Update is a version of the Playlist in which Media 2556 Segments that are further from the end of the Playlist than the Skip 2557 Boundary (Section 4.4.3.8), as well as their associated tags, are 2558 replaced by an EXT-X-SKIP tag (Section 4.4.5.1.2). 2560 When the _HLS_skip directive has a value of v2, the Playlist Delta 2561 Update additionally MUST NOT contain EXT-X-DATERANGE tags that were 2562 added to the Playlist more than CAN-SKIP-UNTIL seconds before the 2563 Playlist request. The RECENTLY-REMOVED-DATERANGES attribute of the 2564 EXT-X-SKIP tag MUST list the date ranges that were removed from the 2565 Playlist within CAN-SKIP-UNTIL seconds of the Playlist request. 2567 All tags that were not skipped MUST remain in the Playlist Delta 2568 Update. 2570 A Server MUST ignore the _HLS_skip directive if the Playlist does not 2571 contain the CAN-SKIP-UNTIL attribute, or if it contains an EXT- 2572 X-ENDLIST tag. 2574 6.2.5.2. Blocking Playlist Reload 2576 A Server MAY offer Blocking Playlist Reloads, which enable immediate 2577 client discovery of Playlist updates as an alternative to polling. 2579 A Server advertises support for Blocking Playlist Reload by adding 2580 the CAN-BLOCK-RELOAD=YES attribute to the EXT-X-SERVER-CONTROL tag. 2582 A Client requests a Blocking Playlist Reload using an _HLS_msn 2583 directive with a decimal-integer value M. When the Playlist URI 2584 contains an _HLS_msn directive and no _HLS_part directive, the Server 2585 MUST defer responding to the request until the Playlist contains a 2586 Media Segment with a Media Sequence Number of M or later or it 2587 responds with an error. 2589 The Playlist URI MAY also contain an _HLS_part directive with a 2590 decimal-integer value N. When the Playlist URI contains both an 2591 _HLS_msn directive and an _HLS_part directive, the Server MUST defer 2592 responding to the request until the Playlist contains the Partial 2593 Segment with Part Index N and with a Media Sequence Number of M or 2594 later or it responds with an error. 2596 If the Client requests a Part Index greater than that of the final 2597 Partial Segment of the Parent Segment, the Server MUST treat the 2598 request as one for Part Index 0 of the following Parent Segment. 2600 The Server MUST deliver the entire Playlist, even if the requested 2601 Media Segment is not the last one in the Playlist, and even if it is 2602 no longer in the Playlist. 2604 A Server MUST ignore _HLS_msn and _HLS_part if the Playlist contains 2605 an EXT-X-ENDLIST tag. 2607 If the _HLS_msn is greater than the Media Sequence Number of the last 2608 Media Segment in the current Playlist plus two, or if the _HLS_part 2609 exceeds the last Partial Segment in the current Playlist by the 2610 Advance Part Limit, then the server SHOULD immediately return Bad 2611 Request, such as HTTP 400. The Advance Part Limit is three divided 2612 by the Part Target Duration if the Part Target Duration is less than 2613 one second, or three otherwise. 2615 If the Playlist URI contains an _HLS_part directive but no _HLS_msn 2616 directive, the Server MUST return Bad Request, such as HTTP 400. 2618 A Server that cannot provide the requested Playlist after blocking 2619 for more than three Target Durations SHOULD return Service 2620 Unavailable, such as HTTP 503. 2622 6.2.6. Providing Preload Hints 2624 The Server MAY add EXT-X-PRELOAD-HINT tags (Section 4.4.5.1.3) to the 2625 Playlist to allow Clients playing the stream to request upcoming 2626 resources in advance. 2628 A hinted resource MUST be available for request when its EXT-X- 2629 PRELOAD-HINT tag is added to the Playlist. 2631 When processing requests for a URL or a byte range of a URL that 2632 includes one or more Partial Segments that are not yet completely 2633 available to be sent - such as requests made in response to an EXT-X- 2634 PRELOAD-HINT tag - the server MUST refrain from transmitting any 2635 bytes belonging to a Partial Segment until all bytes of that Partial 2636 Segment can be transmitted at the full speed of the link to the 2637 client. If the requested range includes more than one Partial 2638 Segment then the server MUST enforce this delivery guarantee for each 2639 Partial Segment in turn. This enables the client to perform accurate 2640 Adaptive Bit Rate (ABR) measurements. 2642 The Server SHOULD NOT hint a byte range that it does not expect its 2643 clients to require in the near term. 2645 The server SHOULD respond with "Not Found" (such as HTTP 404) to a 2646 request for a resource that it cannot find and that is not specified 2647 by an EXT-X-PRELOAD-HINT tag in an active Media Playlist. 2649 A server MAY choose not to publish previously-hinted resources if the 2650 planned segmentation changes, such as the case of early return from 2651 an ad. The server SHOULD respond to client requests for those 2652 resources with "Not Found" (such as HTTP 404). 2654 If a Partial Segment is created as a subrange of a larger resource 2655 and its length is not known at the time that its hint is added to the 2656 Playlist, the BYTERANGE-LENGTH attribute SHOULD be omitted. The 2657 BYTERANGE-OFFSET SHOULD indicate the Partial Segment's starting 2658 offset into the larger resource. 2660 The Server SHOULD NOT add more than one EXT-X-PRELOAD-HINT tag with 2661 the same TYPE to a Playlist. 2663 6.3. Client Responsibilities 2665 6.3.1. General Client Responsibilities 2667 How the client obtains the URI to the Playlist file is outside the 2668 scope of this document; it is presumed to have done so. 2670 The client obtains the Playlist file from the URI. If the Playlist 2671 file so obtained is a Master Playlist, the client can select a 2672 Variant Stream to load from the Master Playlist. 2674 Clients MUST ensure that loaded Playlists comply with Section 4 and 2675 that the EXT-X-VERSION tag, if present, specifies a protocol version 2676 supported by the client; if either check fails, the client MUST NOT 2677 attempt to use the Playlist, or unintended behavior could occur. 2679 When parsing Playlist elements that are subject to variable 2680 substitution, a Variable Reference whose Variable Name has been 2681 provided by an EXT-X-DEFINE tag that precedes the Variable Reference 2682 MUST be replaced by the corresponding Variable Value. Such 2683 replacements themselves are NOT subject to variable substitution. 2685 When parsing Playlist elements that are subject to variable 2686 substitution, a Variable Reference whose Variable Name has NOT been 2687 provided by an EXT-X-DEFINE tag preceding the Variable Reference MUST 2688 trigger a parsing error. 2690 If any URI element in a Playlist contains an URI scheme that the 2691 client cannot handle, the client MUST stop playback. All clients 2692 MUST support HTTP schemes. 2694 To support forward compatibility, when parsing Playlists, clients 2695 MUST: 2697 o ignore any unrecognized tags. 2699 o ignore any attribute/value pair with an unrecognized 2700 AttributeName. 2702 o ignore any tag containing an attribute/value pair of type 2703 enumerated-string whose AttributeName is recognized but whose 2704 AttributeValue is not recognized, unless the definition of the 2705 attribute says otherwise. 2707 When identifying playable Renditions, Clients SHOULD consider an 2708 audio Rendition having unrecognized CHANNELS parameters to be 2709 playable if its associated CODECS attribute is supported. However, 2710 an equivalent Rendition with the same audio codec and recognized 2711 CHANNELS parameters SHOULD be preferred if it is present in the 2712 Master Playlist. 2714 Algorithms used by the client to switch between Variant Streams are 2715 beyond the scope of this document. 2717 6.3.2. Loading the Media Playlist File 2719 Every time a Media Playlist is loaded or reloaded from a Playlist 2720 URI, the client MUST determine the next Media Segment to load, as 2721 described in Section 6.3.5, if it intends to play the presentation 2722 normally (i.e., in Playlist order at the nominal playback rate). 2724 If the Media Playlist contains the EXT-X-MEDIA-SEQUENCE tag, the 2725 client SHOULD assume that each Media Segment in it will become 2726 unavailable at the time that the Playlist file was loaded plus the 2727 duration of the Playlist file. 2729 A client MAY use the segment Media Sequence Number to track the 2730 location of a Media Segment within a Playlist when the Playlist is 2731 reloaded. 2733 A client MUST NOT assume that segments with the same Media Sequence 2734 Number in different Variant Streams or Renditions have the same 2735 position in the presentation; Playlists MAY have independent Media 2736 Sequence Numbers. Instead, a client MUST use the relative position 2737 of each segment on the Playlist timeline and its Discontinuity 2738 Sequence Number to locate corresponding segments. 2740 Clients using Delivery Directives (Section 6.2.5) MUST ensure that 2741 all query parameters appear in UTF-8 order within the URI. This 2742 improves Server cache utilization. 2744 A client MUST load the Media Playlist file of every Rendition 2745 selected for playback in order to locate the media specific to that 2746 Rendition. But, to prevent unnecessary load on the server, it SHOULD 2747 NOT load the Playlist file of any other Rendition. 2749 For some Variant Streams, it is possible to select Renditions that do 2750 not include the Rendition specified by the EXT-X-STREAM-INF tag. As 2751 noted above, the client SHOULD NOT load that Rendition in those 2752 cases. 2754 6.3.3. Playing the Media Playlist File 2756 The client SHALL choose which Media Segment to play first from the 2757 Media Playlist when playback starts. If the EXT-X-ENDLIST tag is not 2758 present and the client intends to play the media normally, the client 2759 SHOULD NOT choose a segment closer to the end of the Playlist than 2760 described by the HOLD-BACK and PART-HOLD-BACK attributes. Doing so 2761 can trigger playback stalls. 2763 Normal playback can be achieved by playing Media Segments or Partial 2764 Segments in the order that they appear in the Playlist. The client 2765 MAY present the available media in any way it wishes, including 2766 normal playback, random access, and trick modes. 2768 The client SHOULD NOT attempt to load Media Segments that have been 2769 marked with an EXT-X-GAP tag, or to load Partial Segments with a 2770 GAP=YES attribute. Instead, clients are encouraged to look for 2771 another Variant Stream of the same Rendition which does not have the 2772 same gap, and play that instead. 2774 The encoding parameters for samples in a Media Segment and across 2775 multiple Media Segments in a Media Playlist SHOULD remain consistent. 2776 However, clients SHOULD deal with encoding changes as they are 2777 encountered, for example, by scaling video content to accommodate a 2778 resolution change. If the Variant Stream includes a RESOLUTION 2779 attribute, clients SHOULD display all video within a rectangle with 2780 the same proportions as that resolution. 2782 Clients SHOULD be prepared to handle multiple tracks of a particular 2783 type (e.g., audio or video). A client with no other preference 2784 SHOULD choose the track with the lowest numerical track identifier 2785 that it can play. 2787 Clients SHOULD ignore private streams inside Transport Streams that 2788 they do not recognize. Private streams can be used to support 2789 different devices with the same stream, although stream authors 2790 SHOULD be sensitive to the additional network load that this imposes. 2792 The client MUST be prepared to reset its parser(s) and decoder(s) 2793 before playing a Media Segment that has an EXT-X-DISCONTINUITY tag 2794 applied to it; otherwise, playback errors can occur. 2796 The client SHOULD attempt to load Media Segments in advance of when 2797 they will be required for uninterrupted playback to compensate for 2798 temporary variations in latency and throughput. 2800 The client MAY use the value of the EXT-X-PROGRAM-DATE-TIME tag to 2801 display the program origination time to the user. If the value 2802 includes time zone information, the client SHALL take it into 2803 account; if it does not, the client MAY assume the time to be local. 2805 Note that dates in Playlists can refer to when the content was 2806 produced (or to other times), which have no relation to the time of 2807 playback. 2809 If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after 2810 one or more Media Segment URIs, the client SHOULD extrapolate 2811 backward from that tag (using EXTINF durations and/or media 2812 timestamps) to associate dates with those segments. To associate a 2813 date with any other Media Segment that does not have an EXT-X- 2814 PROGRAM-DATE-TIME tag applied to it directly, the client SHOULD 2815 extrapolate forward from the last EXT-X-PROGRAM-DATE-TIME tag 2816 appearing before that segment in the Playlist. 2818 6.3.4. Reloading the Media Playlist File 2820 The client MUST periodically reload a Media Playlist file to learn 2821 what media is currently available, unless it contains an EXT-X- 2822 PLAYLIST-TYPE tag with a value of VOD, or a value of EVENT and the 2823 EXT-X-ENDLIST tag is also present. 2825 However, the client MUST NOT attempt to reload the Playlist file more 2826 frequently than specified by this section, in order to limit the 2827 collective load on the server. 2829 When a client loads a Playlist file for the first time or reloads a 2830 Playlist file and finds that it has changed since the last time it 2831 was loaded, the client MUST wait for at least the duration of the 2832 last segment in the Playlist before attempting to reload the Playlist 2833 file again, measured from the last time the client began loading the 2834 Playlist file. 2836 If the client reloads a Playlist file and finds that it has not 2837 changed, then it MUST wait for a period of one-half the Target 2838 Duration before retrying. 2840 After reloading a Media Playlist, the client SHOULD verify that each 2841 Media Segment in it has the same URI (and byte range, if specified) 2842 as the Media Segment with the same Media Sequence Number in the 2843 previous Media Playlist. It SHOULD halt playback if it does not, as 2844 this normally indicates a server error. 2846 In order to reduce server load, the client SHOULD NOT reload the 2847 Playlist files of Variant Streams or alternate Renditions that are 2848 not currently being played. If it decides to switch playback to a 2849 different Variant Stream, it SHOULD stop reloading the Playlist of 2850 the old Variant Stream and begin loading the Playlist of the new 2851 Variant Stream. It can use the EXTINF durations and the constraints 2852 in Section 6.2.4 to determine the approximate location of 2853 corresponding media. Once media from the new Variant Stream has been 2854 loaded, the timestamps in the Media Segments can be used to 2855 synchronize the old and new timelines precisely. 2857 A client MUST NOT attempt to use the Media Sequence Number to 2858 synchronize between streams (see Section 6.3.2). 2860 6.3.5. Determining the Next Segment to Load 2862 The client MUST examine the Media Playlist file every time it is 2863 loaded or reloaded to determine the next Media Segment to load, as 2864 the set of available media MAY have changed. 2866 The first segment to load is generally the segment that the client 2867 has chosen to play first (see Section 6.3.3). 2869 In order to play the presentation normally, the next Media Segment to 2870 load is the one with the lowest Media Sequence Number that is greater 2871 than the Media Sequence Number of the last Media Segment loaded. 2873 6.3.6. Decrypting Encrypted Media Segments 2875 If a Media Playlist file contains an EXT-X-KEY tag that specifies a 2876 Key file URI, the client can obtain that Key file and use the key 2877 inside it to decrypt all Media Segments to which that EXT-X-KEY tag 2878 applies. 2880 A client MUST ignore any EXT-X-KEY tag with an unsupported or 2881 unrecognized KEYFORMAT attribute, to allow for cross-device 2882 addressability. If the Playlist contains a Media Segment to which 2883 only EXT-X-KEY tags with unrecognized or unsupported KEYFORMAT 2884 attributes are applied, playback SHOULD fail. 2886 A client MUST NOT attempt to decrypt any segments whose EXT-X-KEY tag 2887 has a METHOD attribute that it does not recognize. 2889 If the encryption METHOD is AES-128, AES-128 CBC decryption SHALL be 2890 applied to individual Media Segments, whose encryption format is 2891 described in Section 4.4.4.4. 2893 If the encryption METHOD is AES-128 and the Media Segment is part of 2894 an I-frame Playlist (Section 4.4.3.6) and it has an EXT-X-BYTERANGE 2895 tag applied to it, special care needs to be taken in loading and 2896 decrypting the segment, because the resource identified by the URI is 2897 encrypted in 16-byte blocks from the start of the resource. 2899 The decrypted I-frame can be recovered by first widening its byte 2900 range, as specified by the EXT-X-BYTERANGE tag, so that it starts and 2901 ends on 16-byte boundaries from the start of the resource. 2903 Next, the byte range is widened further to include a 16-byte block at 2904 the beginning of the range. This 16-byte block allows the correct IV 2905 for the following block to be calculated. 2907 The widened byte range can then be loaded and decrypted with AES-128 2908 CBC using an arbitrary IV. The number of bytes added to the 2909 beginning and the end of the original byte range are discarded from 2910 the decrypted bytes; what remains is the decrypted I-frame. 2912 If the encryption METHOD indicates Sample Encryption, decryption 2913 SHALL be applied to encrypted media samples within the Media Segment. 2915 An EXT-X-KEY tag with a METHOD of NONE indicates that the Media 2916 Segments it applies to are not encrypted. 2918 6.3.7. Requesting Playlist Delta Updates 2920 If a Media Playlist file contains an EXT-X-SERVER-CONTROL tag with a 2921 CAN-SKIP-UNTIL attribute and no EXT-X-ENDLIST tag, a Client MAY use 2922 the _HLS_skip Delivery Directive to request Playlist Delta Updates. 2924 A Client SHOULD NOT request a Playlist Delta Update unless it already 2925 has a version of the Playlist that is no older than one-half of the 2926 Skip Boundary. 2928 The client can request a Playlist Delta Update that skips older Media 2929 Segments by adding an "_HLS_skip=YES" directive to the Media Playlist 2930 URL when it requests the Playlist. 2932 Alternately, if the EXT-X-SERVER-CONTROL tag contains a CAN-SKIP- 2933 DATERANGES=YES attribute, the client can request a Playlist Delta 2934 Update that skips both older Segments and older EXT-X-DATERANGE tags 2935 by adding an "_HLS_skip=v2" directive to the Media Playlist URL when 2936 it requests the Playlist. 2938 A Client MUST merge the contents of a Playlist Delta Update with its 2939 previous version of the Playlist to form an up-to-date version of the 2940 Playlist. If a Client receives a Playlist containing an EXT-X-SKIP 2941 tag and finds that it does not already have all of the information 2942 that was skipped, it MUST obtain a complete copy of the Playlist by 2943 reissuing its Playlist request without the _HLS_skip directive. 2945 6.3.8. Issuing Blocking Requests 2947 Clients MUST NOT request Blocking Playlist Reloads unless the 2948 Playlist contains an EXT-X-SERVER-CONTROL tag with a CAN-BLOCK- 2949 RELOAD=YES attribute. 2951 If Blocking Playlist Reloads are supported, Clients SHOULD use the 2952 _HLS_msn Delivery Directive (and _HLS_part, if the Playlist contains 2953 Partial Segments) to obtain Playlist updates in preference to the 2954 polling regime described in Section 6.3.4. 2956 If up-to-date information on the next expected Media Sequence Number 2957 of a Rendition is not available, a Client SHOULD use a tune-in 2958 algorithm such as the one described in Appendix C to obtain a recent 2959 version of the Playlist. 2961 Clients MUST ignore EXT-X-PRELOAD-HINT tags with unrecognized TYPE 2962 attributes. Clients SHOULD ignore all but the first EXT-X-PRELOAD- 2963 HINT tag in a Playlist with a particular TYPE attribute. 2965 When processing a Playlist containing an EXT-X-PRELOAD-HINT tag with 2966 TYPE=PART, a Client with sufficient space in its download pipeline 2967 that is not already loading the hinted resource SHOULD request it. 2968 This will typically happen at the same time as its blocking request 2969 for the next Playlist update. 2971 When processing a Playlist containing an EXT-X-PRELOAD-HINT tag with 2972 TYPE=MAP, a Client with sufficient space in its download pipeline 2973 that has not already cached the hinted Media Initialization 2974 Section SHOULD request it. 2976 A Client SHOULD cancel a request for a hinted resource if it is not 2977 present in a subsequent Playlist update, such as in an EXT-X-PRELOAD- 2978 HINT tag or as part of another tag such as EXT-X-PART. The client 2979 SHOULD ignore the results of such requests. 2981 A Client SHOULD recognize when a Partial Segment indicated by an EXT- 2982 X-PART tag is a subrange of a hint download and obtain the Partial 2983 Segment from the hint download. Clients SHOULD recognize contiguous 2984 ranges between existing Partial Segments and Partial Segment hints 2985 and avoid duplicate downloads. 2987 7. Protocol Version Compatibility 2989 Protocol compatibility is specified by the EXT-X-VERSION tag. A 2990 Playlist that contains tags or attributes that are not compatible 2991 with protocol version 1 MUST include an EXT-X-VERSION tag. 2993 A client MUST NOT attempt playback if it does not support the 2994 protocol version specified by the EXT-X-VERSION tag, or unintended 2995 behavior could occur. 2997 A Media Playlist MUST indicate an EXT-X-VERSION of 2 or higher if it 2998 contains: 3000 o The IV attribute of the EXT-X-KEY tag. 3002 A Media Playlist MUST indicate an EXT-X-VERSION of 3 or higher if it 3003 contains: 3005 o Floating-point EXTINF duration values. 3007 A Media Playlist MUST indicate an EXT-X-VERSION of 4 or higher if it 3008 contains: 3010 o The EXT-X-BYTERANGE tag. 3012 o The EXT-X-I-FRAMES-ONLY tag. 3014 A Media Playlist MUST indicate an EXT-X-VERSION of 5 or higher if it 3015 contains: 3017 o An EXT-X-KEY tag with a METHOD of SAMPLE-AES. 3019 o The KEYFORMAT and KEYFORMATVERSIONS attributes of the EXT-X-KEY 3020 tag. 3022 o The EXT-X-MAP tag. 3024 A Media Playlist MUST indicate an EXT-X-VERSION of 6 or higher if it 3025 contains: 3027 o The EXT-X-MAP tag in a Media Playlist that does not contain EXT- 3028 X-I-FRAMES-ONLY. 3030 Note that in protocol version 6, the semantics of the EXT- 3031 X-TARGETDURATION tag changed slightly. In protocol version 5 and 3032 earlier it indicated the maximum segment duration; in protocol 3033 version 6 and later it indicates the the maximum segment duration 3034 rounded to the nearest integer number of seconds. 3036 A Master Playlist MUST indicate an EXT-X-VERSION of 7 or higher if it 3037 contains: 3039 o "SERVICE" values for the INSTREAM-ID attribute of the EXT-X-MEDIA 3040 tag. 3042 A Playlist MUST indicate an EXT-X-VERSION of 8 or higher if it 3043 contains: 3045 o Variable substitution. 3047 A Playlist MUST indicate an EXT-X-VERSION of 9 or higher if it 3048 contains: 3050 o The EXT-X-SKIP tag. 3052 A Playlist MUST indicate an EXT-X-VERSION of 10 or higher if it 3053 contains: 3055 o An EXT-X-SKIP tag that replaces EXT-X-DATERANGE tags in a Playlist 3056 Delta Update. 3058 The EXT-X-MEDIA tag and the AUDIO, VIDEO, and SUBTITLES attributes of 3059 the EXT-X-STREAM-INF tag are backward compatible to protocol version 3060 1, but playback on older clients may not be desirable. A server MAY 3061 consider indicating an EXT-X-VERSION of 4 or higher in the Master 3062 Playlist but is not required to do so. 3064 The PROGRAM-ID attribute of the EXT-X-STREAM-INF and the EXT-X-I- 3065 FRAME-STREAM-INF tags was removed in protocol version 6. 3067 The EXT-X-ALLOW-CACHE tag was removed in protocol version 7. 3069 8. Playlist Examples 3071 8.1. Simple Media Playlist 3073 #EXTM3U 3074 #EXT-X-TARGETDURATION:10 3075 #EXT-X-VERSION:3 3076 #EXTINF:9.009, 3077 http://media.example.com/first.ts 3078 #EXTINF:9.009, 3079 http://media.example.com/second.ts 3080 #EXTINF:3.003, 3081 http://media.example.com/third.ts 3082 #EXT-X-ENDLIST 3084 8.2. Live Media Playlist Using HTTPS 3086 #EXTM3U 3087 #EXT-X-VERSION:3 3088 #EXT-X-TARGETDURATION:8 3089 #EXT-X-MEDIA-SEQUENCE:2680 3091 #EXTINF:7.975, 3092 https://priv.example.com/fileSequence2680.ts 3093 #EXTINF:7.941, 3094 https://priv.example.com/fileSequence2681.ts 3095 #EXTINF:7.975, 3096 https://priv.example.com/fileSequence2682.ts 3098 8.3. Playlist with Encrypted Media Segments 3099 #EXTM3U 3100 #EXT-X-VERSION:3 3101 #EXT-X-MEDIA-SEQUENCE:7794 3102 #EXT-X-TARGETDURATION:15 3104 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" 3106 #EXTINF:2.833, 3107 http://media.example.com/fileSequence52-A.ts 3108 #EXTINF:15.0, 3109 http://media.example.com/fileSequence52-B.ts 3110 #EXTINF:13.333, 3111 http://media.example.com/fileSequence52-C.ts 3113 #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" 3115 #EXTINF:15.0, 3116 http://media.example.com/fileSequence53-A.ts 3118 8.4. Master Playlist 3120 #EXTM3U 3121 #EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000 3122 http://example.com/low.m3u8 3123 #EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000 3124 http://example.com/mid.m3u8 3125 #EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000 3126 http://example.com/hi.m3u8 3127 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 3128 http://example.com/audio-only.m3u8 3130 8.5. Master Playlist with I-Frames 3132 #EXTM3U 3133 #EXT-X-STREAM-INF:BANDWIDTH=1280000 3134 low/audio-video.m3u8 3135 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=86000,URI="low/iframe.m3u8" 3136 #EXT-X-STREAM-INF:BANDWIDTH=2560000 3137 mid/audio-video.m3u8 3138 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=150000,URI="mid/iframe.m3u8" 3139 #EXT-X-STREAM-INF:BANDWIDTH=7680000 3140 hi/audio-video.m3u8 3141 #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=550000,URI="hi/iframe.m3u8" 3142 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5" 3143 audio-only.m3u8 3145 8.6. Master Playlist with Alternative Audio 3147 In this example, the CODECS attributes have been condensed for space. 3148 A '\' is used to indicate that the tag continues on the following 3149 line with whitespace removed: 3151 #EXTM3U 3152 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English", \ 3153 DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en", \ 3154 URI="main/english-audio.m3u8" 3155 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Deutsch", \ 3156 DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="de", \ 3157 URI="main/german-audio.m3u8" 3158 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Commentary", \ 3159 DEFAULT=NO,AUTOSELECT=NO,LANGUAGE="en", \ 3160 URI="commentary/audio-only.m3u8" 3161 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",AUDIO="aac" 3162 low/video-only.m3u8 3163 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",AUDIO="aac" 3164 mid/video-only.m3u8 3165 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",AUDIO="aac" 3166 hi/video-only.m3u8 3167 #EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5",AUDIO="aac" 3168 main/english-audio.m3u8 3170 8.7. Master Playlist with Alternative Video 3172 This example shows three different video Renditions (Main, 3173 Centerfield, and Dugout) and three different Variant Streams (low, 3174 mid, and high). In this example, clients that did not support the 3175 EXT-X-MEDIA tag and the VIDEO attribute of the EXT-X-STREAM-INF tag 3176 would only be able to play the video Rendition "Main". 3178 Since the EXT-X-STREAM-INF tag has no AUDIO attribute, all video 3179 Renditions would be required to contain the audio. 3181 In this example, the CODECS attributes have been condensed for space. 3182 A '\' is used to indicate that the tag continues on the following 3183 line with whitespace removed: 3185 #EXTM3U 3186 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Main", \ 3187 DEFAULT=YES,URI="low/main/audio-video.m3u8" 3188 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Centerfield", \ 3189 DEFAULT=NO,URI="low/centerfield/audio-video.m3u8" 3190 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Dugout", \ 3191 DEFAULT=NO,URI="low/dugout/audio-video.m3u8" 3193 #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",VIDEO="low" 3194 low/main/audio-video.m3u8 3196 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Main", \ 3197 DEFAULT=YES,URI="mid/main/audio-video.m3u8" 3198 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Centerfield", \ 3199 DEFAULT=NO,URI="mid/centerfield/audio-video.m3u8" 3200 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mid",NAME="Dugout", \ 3201 DEFAULT=NO,URI="mid/dugout/audio-video.m3u8" 3203 #EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",VIDEO="mid" 3204 mid/main/audio-video.m3u8 3206 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Main", \ 3207 DEFAULT=YES,URI="hi/main/audio-video.m3u8" 3208 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Centerfield", \ 3209 DEFAULT=NO,URI="hi/centerfield/audio-video.m3u8" 3210 #EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="hi",NAME="Dugout", \ 3211 DEFAULT=NO,URI="hi/dugout/audio-video.m3u8" 3213 #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",VIDEO="hi" 3214 hi/main/audio-video.m3u8 3216 8.8. Session Data in a Master Playlist 3218 In this example, only the EXT-X-SESSION-DATA is shown: 3220 #EXT-X-SESSION-DATA:DATA-ID="com.example.lyrics",URI="lyrics.json" 3222 #EXT-X-SESSION-DATA:DATA-ID="com.example.title",LANGUAGE="en", \ 3223 VALUE="This is an example" 3224 #EXT-X-SESSION-DATA:DATA-ID="com.example.title",LANGUAGE="es", \ 3225 VALUE="Este es un ejemplo" 3227 8.9. CHARACTERISTICS Attribute Containing Multiple Characteristics 3229 Certain characteristics are valid in combination, as in: 3231 CHARACTERISTICS= 3232 "public.accessibility.transcribes-spoken-dialog,public.easy-to-read" 3234 8.10. EXT-X-DATERANGE Carrying SCTE-35 Tags 3236 This example shows two EXT-X-DATERANGE tags that describe a single 3237 Date Range, with an SCTE-35 "out" splice_insert() command that is 3238 subsequently updated with an SCTE-35 "in" splice_insert() command. 3240 #EXTM3U 3241 ... 3242 #EXT-X-DATERANGE:ID="splice-6FFFFFF0",START-DATE="2014-03-05T11: 3243 15:00Z",PLANNED-DURATION=59.993,SCTE35-OUT=0xFC002F0000000000FF0 3244 00014056FFFFFF000E011622DCAFF000052636200000000000A0008029896F50 3245 000008700000000 3247 ... Media Segment declarations for 60s worth of media 3249 #EXT-X-DATERANGE:ID="splice-6FFFFFF0",DURATION=59.993,SCTE35-IN= 3250 0xFC002A0000000000FF00000F056FFFFFF000401162802E6100000000000A00 3251 08029896F50000008700000000 3252 ... 3254 8.11. Low-Latency Playlist 3256 This example shows the end of a Playlist that contains Partial 3257 Segments. Note that EXT-X-PART tags have already been removed from 3258 earlier Parent Segments. The Playlist also includes a preload hint, 3259 a Rendition Report, and a mid-roll advertisement. 3261 #EXTM3U 3262 #EXT-X-TARGETDURATION:4 3263 ... 3264 #EXTINF:4.00008, 3265 fileSequence268.mp4 3266 #EXTINF:4.00008, 3267 fileSequence269.mp4 3268 #EXTINF:4.00008, 3269 fileSequence270.mp4 3270 #EXT-X-PART:DURATION=2.00004,INDEPENDENT=YES,URI="filePart271.0.mp4" 3271 #EXT-X-PART:DURATION=2.00004,URI="filePart271.1.mp4" 3272 #EXTINF:4.00008, 3273 fileSequence271.mp4 3274 #EXT-X-PART:DURATION=2.00004,INDEPENDENT=YES,URI="filePart272.0.mp4" 3275 #EXT-X-PART:DURATION=0.50001,URI="filePart272.1.mp4" 3276 #EXTINF:2.50005, 3277 fileSequence272.mp4 3278 #EXT-X-DISCONTINUITY 3279 #EXT-X-PART:DURATION=2.00004,INDEPENDENT=YES,URI="midRoll273.0.mp4" 3280 #EXT-X-PART:DURATION=2.00004,URI="midRoll273.1.mp4" 3281 #EXTINF:4.00008, 3282 midRoll273.mp4 3283 #EXT-X-PART:DURATION=2.00004,INDEPENDENT=YES,URI="midRoll274.0.mp4" 3284 #EXT-X-PRELOAD-HINT:TYPE=PART,URI="midRoll274.1.mp4" 3285 #EXT-X-RENDITION-REPORT:URI="/1M/LL-HLS.m3u8",LAST-MSN=274,LAST-PART=1 3287 9. Contributors 3289 Significant contributions to the design of this protocol were made by 3290 Jim Batson, David Biderman, Bill May, Roger Pantos, Alan Tseng, and 3291 Eryk Vershen. Stuart Cheshire helped edit the specification. 3293 Significant contributions to the update of this protocol were made by 3294 Bill May, Eryk Vershen, and Peng Zhou. 3296 In particular, Bill May co-authored the first edition of HTTP Live 3297 Streaming, [RFC8216], and continues to provide valuable guidance and 3298 input. 3300 10. IANA Considerations 3302 IANA has registered the following media type [RFC2046]: 3304 Type name: application 3306 Subtype name: vnd.apple.mpegurl 3308 Required parameters: none 3309 Optional parameters: none 3311 Encoding considerations: encoded as UTF-8, which is 8-bit text. This 3312 media type may require encoding on transports not capable of handling 3313 8-bit text. See Section 4 for more information. 3315 Security considerations: See Section 11. 3317 Compression: this media type does not employ compression. 3319 Interoperability considerations: There are no byte-ordering issues, 3320 since files are 8-bit text. Applications could encounter 3321 unrecognized tags, which SHOULD be ignored. 3323 Published specification: see Section 4. 3325 Applications that use this media type: Multimedia applications such 3326 as the iPhone media player in iOS 3.0 and later and QuickTime Player 3327 in Mac OS X version 10.6 and later. 3329 Fragment identifier considerations: no Fragment Identifiers are 3330 defined for this media type. 3332 Query parameter considerations: the definition of all query 3333 parameters for resources of this media type which begin with the 3334 string "_HLS_" are reserved by this specification. Currently-defined 3335 query parameters are specified in Section 6.2.5. 3337 Additional information: 3339 Deprecated alias names for this type: none 3340 Magic number(s): #EXTM3U 3341 File extension(s): .m3u8, .m3u (see Section 4) 3342 Macintosh file type code(s): none 3344 Person & email address to contact for further information: David 3345 Singer, singer AT apple.com. 3347 Intended usage: LIMITED USE 3349 Restrictions on usage: none 3351 Author: Roger Pantos 3353 Change Controller: David Singer 3355 11. Security Considerations 3357 Since the protocol generally uses HTTP to transfer data, most of the 3358 same security considerations apply. See Section 15 of HTTP 3359 [RFC7230]. 3361 Media file parsers are typically subject to "fuzzing" attacks. 3362 Implementors SHOULD pay particular attention to code that will parse 3363 data received from a server and ensure that all possible inputs are 3364 handled correctly. 3366 Playlist files contain URIs, which clients will use to make network 3367 requests of arbitrary entities. Clients SHOULD range-check responses 3368 to prevent buffer overflows. See also the Security Considerations 3369 section of "Uniform Resource Identifier (URI): Generic Syntax" 3370 [RFC3986]. 3372 Apart from URL resolution, this format does not employ any form of 3373 active content. 3375 Clients SHOULD limit each playback session to a reasonable number of 3376 concurrent downloads (for example, four) to avoid contributing to 3377 denial-of-service attacks. 3379 HTTP requests often include session state ("cookies"), which may 3380 contain private user data. Implementations MUST follow cookie 3381 restriction and expiry rules specified by "HTTP State Management 3382 Mechanism" [RFC6265] to protect themselves from attack. See also the 3383 Security Considerations section of that document, and "Use of HTTP 3384 State Management" [RFC2964]. 3386 Encryption keys are specified by URI. The delivery of these keys 3387 SHOULD be secured by a mechanism such as HTTP Over TLS [RFC2818] 3388 (formerly SSL) in conjunction with a secure realm or a session token. 3390 12. References 3392 12.1. Normative References 3394 [AC_3] Advanced Television Systems Committee, "Digital Audio 3395 Compression (AC-3) (E-AC-3)", ATSC Standard A/52:2010, 3396 November 2010, <http://atsc.org/wp- 3397 content/uploads/2015/03/A52-201212-17.pdf>. 3399 [AES_128] National Institute of Standards and Technology, "Advanced 3400 Encryption Standard (AES)", FIPS PUB 197, DOI 3401 10.6028/NIST.FIPS.197, November 2001, 3402 <http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197.pdf>. 3404 [CEA608] Consumer Technology Association, "Line 21 Data Services", 3405 ANSI/CTA Standard 608-E, April 2008, 3406 <https://standards.cta.tech/kwspub/published_docs/ANSI- 3407 CTA-608-E-R-2014-Preview.pdf>. 3409 [CEA708] Consumer Technology Association, "Digital Television (DTV) 3410 Closed Captioning", ANSI/CTA Standard CEA-708-E, August 3411 2013, <https://standards.cta.tech/kwspub/published_docs/ 3412 ANSI-CTA-708-E-Preview.pdf>. 3414 [CICP] International Organization for Standardization, 3415 "Information technology - MPEG systems technologies - Part 3416 8: Coding-independent code points", ISO/IEC International 3417 Standard 23001-8:2016, 2016, <https://www.iso.org/obp/ 3418 ui/#iso:std:iso-iec:23001:-8:ed-2:v1:en>. 3420 [CMAF] International Organization for Standardization, 3421 "Information technology -- Multimedia application format 3422 (MPEG-A) -- Part 19: Common media application format 3423 (CMAF) for segmented media", ISO/IEC International 3424 Standard 23000-19:2017, December 2017, 3425 <https://www.iso.org/standard/71975.html>. 3427 [COMMON_ENC] 3428 International Organization for Standardization, 3429 "Information technology -- MPEG systems technologies -- 3430 Part 7: Common encryption in ISO base media file format 3431 files", ISO/IEC International Standard 23001-7:2016, 3432 February 2016, <http://www.iso.org/iso/ 3433 catalogue_detail.htm?csnumber=68042>. 3435 [H_264] International Telecommunications Union, "Advanced video 3436 coding for generic audiovisual services", January 2012, 3437 <http://www.itu.int/rec/T-REC-H.264>. 3439 [HDCP] Digital Content Protection LLC, "High-bandwidth Digital 3440 Content Protection System - Mapping HDCP to HDMI", 3441 February 2013, <http://www.digital- 3442 cp.com/sites/default/files/specifications/ 3443 HDCP%20on%20HDMI%20Specification%20Rev2_2_Final1.pdf>. 3445 [IMSC1] W3C, "TTML Profiles for Internet Media Subtitles and 3446 Captions 1.0 (IMSC1)", April 2016, 3447 <https://www.w3.org/TR/ttml-imsc1/>. 3449 [ISO_13818] 3450 International Organization for Standardization, "Generic 3451 coding of moving pictures and associated audio 3452 information", ISO/IEC International Standard 13818:2007, 3453 October 2007, 3454 <http://www.iso.org/iso/catalogue_detail?csnumber=44169>. 3456 [ISO_13818_3] 3457 International Organization for Standardization, "Generic 3458 coding of moving pictures and associated audio information 3459 -- Part 3: Audio", ISO/IEC International 3460 Standard 13818-3:1998, April 1998, 3461 <http://www.iso.org/iso/home/store/catalogue_tc/ 3462 catalogue_detail.htm?csnumber=26797>. 3464 [ISO_13818_7] 3465 International Organization for Standardization, "Generic 3466 coding of moving pictures and associated audio information 3467 -- Part 7: Advanced Audio Coding (AAC)", ISO/IEC 3468 International Standard 13818-7:2006, January 2006, 3469 <http://www.iso.org/iso/home/store/catalogue_tc/ 3470 catalogue_detail.htm?csnumber=43345>. 3472 [ISO_14496] 3473 International Organization for Standardization, 3474 "Information technology -- Coding of audio-visual objects 3475 -- Part 3: Audio", ISO/IEC International 3476 Standard 14496-3:2009, 2009, 3477 <http://www.iso.org/iso/catalogue_detail?csnumber=53943>. 3479 [ISO_8601] 3480 International Organization for Standardization, "Data 3481 elements and interchange formats -- Information 3482 interchange -- Representation of dates and times", ISO/IEC 3483 International Standard 8601:2004, December 2004, 3484 <http://www.iso.org/iso/catalogue_detail?csnumber=40874>. 3486 [ISOBMFF] International Organization for Standardization, 3487 "Information technology -- Coding of audio-visual objects 3488 -- Part 12: ISO base media file format", ISO/IEC 3489 International Standard 14496-12:2015, December 2015, 3490 <http://www.iso.org/iso/ 3491 catalogue_detail.htm?csnumber=68960>. 3493 [MP4_TIMED_TEXT] 3494 International Organization for Standardization, 3495 "Information technology -- Coding of audio-visual objects 3496 -- Part 30: Timed text and other visual overlays in ISO 3497 base media file format", ISO/IEC International 3498 Standard 14496-30:2014, March 2014, 3499 <https://www.iso.org/standard/63107.html>. 3501 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 3502 Extensions (MIME) Part Two: Media Types", RFC 2046, 3503 DOI 10.17487/RFC2046, November 1996, 3504 <https://www.rfc-editor.org/info/rfc2046>. 3506 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3507 Requirement Levels", BCP 14, RFC 2119, 3508 DOI 10.17487/RFC2119, March 1997, 3509 <https://www.rfc-editor.org/info/rfc2119>. 3511 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, 3512 DOI 10.17487/RFC2818, May 2000, 3513 <https://www.rfc-editor.org/info/rfc2818>. 3515 [RFC2964] Moore, K. and N. Freed, "Use of HTTP State Management", 3516 BCP 44, RFC 2964, DOI 10.17487/RFC2964, October 2000, 3517 <https://www.rfc-editor.org/info/rfc2964>. 3519 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 3520 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 3521 2003, <https://www.rfc-editor.org/info/rfc3629>. 3523 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 3524 Resource Identifier (URI): Generic Syntax", STD 66, 3525 RFC 3986, DOI 10.17487/RFC3986, January 2005, 3526 <https://www.rfc-editor.org/info/rfc3986>. 3528 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for Identifying 3529 Languages", BCP 47, RFC 5646, DOI 10.17487/RFC5646, 3530 September 2009, <https://www.rfc-editor.org/info/rfc5646>. 3532 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 3533 RFC 5652, DOI 10.17487/RFC5652, September 2009, 3534 <https://www.rfc-editor.org/info/rfc5652>. 3536 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 3537 DOI 10.17487/RFC6265, April 2011, 3538 <https://www.rfc-editor.org/info/rfc6265>. 3540 [RFC6381] Gellens, R., Singer, D., and P. Frojdh, "The 'Codecs' and 3541 'Profiles' Parameters for "Bucket" Media Types", RFC 6381, 3542 DOI 10.17487/RFC6381, August 2011, 3543 <https://www.rfc-editor.org/info/rfc6381>. 3545 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 3546 Protocol (HTTP/1.1): Message Syntax and Routing", 3547 RFC 7230, DOI 10.17487/RFC7230, June 2014, 3548 <https://www.rfc-editor.org/info/rfc7230>. 3550 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 3551 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 3552 May 2017, <https://www.rfc-editor.org/info/rfc8174>. 3554 [RFC8216] Pantos, R., Ed. and W. May, "HTTP Live Streaming", 3555 RFC 8216, DOI 10.17487/RFC8216, August 2017, 3556 <https://www.rfc-editor.org/info/rfc8216>. 3558 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 3559 Interchange Format", STD 90, RFC 8259, 3560 DOI 10.17487/RFC8259, December 2017, 3561 <https://www.rfc-editor.org/info/rfc8259>. 3563 [SCTE35] Society of Cable Telecommunications Engineers, "Digital 3564 Program Insertion Cueing Message for Cable", ANSI/SCTE 35, 3565 August 2014, <http://www.scte.org/documents/pdf/Standards/ 3566 ANSI_SCTE%2035%202014.pdf>. 3568 [US_ASCII] 3569 American National Standards Institute, "Coded Character 3570 Sets - 7-Bit American National Standard Code for 3571 Information Interchange (7-Bit ASCII)", ANSI X3.4, 3572 December 1986. 3574 [WebVTT] World Wide Web Consortium (W3C), ""WebVTT: The Web Video 3575 Text Tracks Format", Draft Community Group Report", July 3576 2013, <http://dev.w3.org/html5/webvtt/>. 3578 12.2. Informative References 3580 [ID3] ID3.org, "The ID3 audio file data tagging format", 3581 <http://www.id3.org/Developer_Information>. 3583 [M3U] Nullsoft, Inc., "The M3U Playlist format, originally 3584 invented for the Winamp media player", 3585 <http://wikipedia.org/wiki/M3U>. 3587 [SampleEnc] 3588 Apple Inc., "MPEG-2 Stream Encryption Format for HTTP Live 3589 Streaming", 3590 <https://developer.apple.com/library/ios/documentation/ 3591 AudioVideo/Conceptual/HLS_Sample_Encryption/>. 3593 [UNICODE] The Unicode Consortium, "The Unicode Standard", 3594 <https://www.unicode.org/versions/latest/>. 3596 [UTI] Apple Inc., "Uniform Type Identifier", 3597 <http://developer.apple.com/library/ios/#documentation/ 3598 general/conceptual/DevPedia-CocoaCore/ 3599 UniformTypeIdentifier.html>. 3601 Appendix A. Changes from RFC 8216 3603 Several changes have been made since the publication of RFC 8216 3604 [RFC8216]. 3606 The following tags have been added: EXT-X-GAP, EXT-X-BITRATE, EXT-X- 3607 SERVER-CONTROL, EXT-X-SKIP, EXT-X-PART-INF, EXT-X-PART, EXT-X- 3608 PRELOAD-HINT, and EXT-X-RENDITION-REPORT. 3610 EXT-X-DEFINE was introduced to support variable substitution. 3612 IMSC has been added to the set of recognized subtitle formats. 3614 The VIDEO-RANGE attribute has been added to the EXT-X-STREAM-INF and 3615 EXT-X-I-FRAME-STREAM-INF tags. 3617 The ALLOWED-CPC attribute has been added to the EXT-X-STREAM-INF and 3618 EXT-X-I-FRAME-STREAM-INF tags. 3620 TYPE-1 has been added as a defined value for the HDCP-LEVEL 3621 attribute. 3623 The minimum new segment publication latency has been removed from 3624 server timing model. 3626 The Availability Duration of a Media Segment now depends on the 3627 presence of an EXT-X-ENDLIST tag. 3629 The recommended playlist offset to join a live stream has changed. 3631 The minimum delay before reloading a Playlist file has changed. 3633 The definition of peak segment bit rate was changed to ensure every 3634 segment is included in at least one contiguous set. 3636 Media Metadata tags such as EXT-X-DATERANGE may be removed from 3637 playlists. 3639 Partial Segments were defined as a means to reduce publishing 3640 latency. 3642 Delivery Directives were introduced, including support for Playlist 3643 Delta Updates and Blocking Playlist Reload. 3645 A Low-Latency Server Configuration Profile was added to Appendix B. 3647 Appendix C was added. 3649 There have been a number of minor editorial changes. 3651 Appendix B. Server Configuration Profiles 3653 Server Configuration Profiles specify additional requirements that 3654 optimize delivery of HTTP Live Streaming for certain use cases. 3656 B.1. Low-Latency Server Configuration Profile 3658 Playing at a reduced delay from live requires certain stream and 3659 transport features to support the timely delivery of media. Clients 3660 SHOULD verify that the server meets these requirements before playing 3661 at a delay-from-live of less than two Target Durations. Because the 3662 Low-Latency extensions are additions rather than replacements, 3663 clients can and SHOULD fall back to regular-latency playback if they 3664 discover that the server does not meet the requirements of this 3665 configuration profile. 3667 This profile places the following requirements on stream production: 3669 All Media Playlists have EXT-PROGRAM-DATE-TIME tags. This allows 3670 more-precise mapping between Segments across Renditions. Note 3671 that real-time clocks are NOT required to be synchronized between 3672 client and server. 3674 Each (non-Partial) Media Segment in a Media Playlist will contain 3675 at least one independent frame. 3677 A Playlist that contains an EXT-X-PART tag but no EXT-X-ENDLIST 3678 tag will also contain an EXT-X-PRELOAD-HINT tag that specifies the 3679 next Partial Segment that is expected to be added to the Playlist. 3681 If the Partial Segment specified by an EXT-X-PRELOAD-HINT tag has 3682 a different Media Initialization Section than the last Partial 3683 Segment in the Playlist, the Playlist will also contain an EXT-X- 3684 PRELOAD-HINT tag with TYPE=MAP that hints the Media Initialization 3685 Section of the hinted Partial Segment. 3687 Each Media Playlist contains one EXT-RENDITION-REPORT tag for each 3688 Media Playlist (Rendition) in the Master Playlist, except for the 3689 Media Playlist to which the EXT-X-RENDITION-REPORT tag is being 3690 added, and Playlists that contain the EXT-X-I-FRAMES-ONLY tag. 3692 This profile places the following requirements on stream delivery: 3694 HTTP-delivered Playlists and Segments are served via HTTP/2. 3695 Efficient delivery requires HTTP/2 priority control (dependencies 3696 and weights) and support for Ping frames. 3698 Each server offers the entire set of Variant Streams in the master 3699 Playlist. This allows rapid bit rate switching without connection 3700 reestablishment. 3702 Servers support HTTP Range requests if Media Playlists contain the 3703 BYTERANGE, BYTERANGE-START, or BYTERANGE-LENGTH attributes. 3705 TCP connections support Selective Acknowledgment (SACK) across the 3706 entire route from client to server. This improves the performance 3707 of TCP loss recovery 3709 Playlist requests are idempotent. 3711 Playlists are delivered in GZIP format. This speeds up Media 3712 Playlist reload and Rendition switching. 3714 All Renditions in a Master Playlist are updated in sync, within an 3715 accuracy of one Part Target Duration. 3717 CDNs and other proxy caches recognize blocking requests for 3718 Playlists and Media Segments whose cache fill is already pending, 3719 and hold the duplicate requests until they can be delivered from 3720 that cache fill. This minimizes the load on the active origin. 3722 HTTP caches used to deliver Playlists or Segments will set the Age 3723 HTTP Response header. 3725 In addition, the following configurations are recommended: 3727 TCP connections should set Explicit Congestion Notification (ECN) 3728 during congestion. They should also use TCP timestamps, TAIL LOSS 3729 probe, and TCP RACK. These configurations improve the performance 3730 of TCP loss recovery. See RFC 2018, RFC 3168, RFC 7323, and IETF 3731 draft-ietf-tcpm-rack for more information about these TCP options. 3733 Servers should support TLS 1.3 or higher. This reduces time to 3734 connect. Servers should also support TLS 1.3 0-RTT connections 3735 for Media Playlists and Media Segments. 3737 Blocking Playlist Reload allows longer caching of Playlists 3738 without detriment to Clients. Successful responses to blocking 3739 Playlist requests should be cached for six Target Durations. 3740 Unsuccessful responses (such as 404s) should be cached for four 3741 Target Durations. Successful responses to non-blocking Playlist 3742 requests should be cached for half the Target Duration. 3743 Unsuccessful responses to non-blocking Playlist requests should be 3744 cached for for one Target Duration. 3746 Successful responses to blocking Media segment requests should be 3747 cached for six Target Durations. Unsuccessful responses should be 3748 cached for one Target Duration. 3750 Origin servers should use Cache-Control headers to communicate the 3751 desired cache lifetime. 3753 The recommended Target Duration is six seconds. 3755 The recommended GOP size is between one and two seconds. Smaller 3756 GOPs allow faster switching between Renditions. 3758 Appendix C. Low-Latency CDN Tune-in 3760 Clients SHOULD support delivery of low-latency streams through CDNs 3761 and other HTTP caches. Correctly implementing PART-HOLD-BACK, the 3762 server-recommended playback delay from live, requires that the client 3763 first obtain a reasonably up-to-date version of the Media Playlist. 3765 There are various approaches that a client may take to obtain a 3766 recent version of a Media Playlist. The following algorithm 3767 typically requires two Playlist requests to obtain a Playlist that is 3768 within one Part Target Duration of the current Playlist: 3770 1. Send a request for the Media Playlist that does not include an 3771 _HLS_msn or _HLS_part directive. 3773 2. Record the first Playlist response, including its received time 3774 and Age header. If there's no Age header in the first Playlist 3775 response, consider the Playlist to be up to date. (No Age header 3776 means that the response came directly from the origin, rather 3777 than being held for a period of time in an intervening HTTP 3778 cache.) 3780 3. If there is an Age header in the first Playlist response, set the 3781 goalDuration to match the Age value. Increase the goalDuration 3782 by one second if the Part Target Duration is less than 1.0. 3784 4. While the Age value is greater than or equal to the floor of the 3785 Part Target Duration: 3787 A. Set currentGoal to be the goalDuration plus the amount of 3788 time since the first Playlist response. 3790 B. If the current version of the Playlist has at least 3791 currentGoal more media in it than the first Playlist, 3792 consider the current Playlist to be up to date. 3794 C. Use the Target Duration and the Part Target Duration to 3795 estimate how many more segments and parts the server will add 3796 to the Playlist to contribute at least currentGoal more media 3797 to it. 3799 D. Request the Media Playlist again, using the _HLS_msn and 3800 _HLS_part directives to obtain the Playlist that has the 3801 estimated additional duration of media since the first 3802 Playlist. 3804 E. Update the current Playlist and the Age value from the 3805 Playlist response. 3807 Author's Address 3809 Roger Pantos (editor) 3810 Apple Inc. 3811 Cupertino, California 3812 United States 3814 Email: http-live-streaming-review@group.apple.com