有时我们的HLS流在safari上无法播放,但是在其他的一些第三方的player却是可以播放的,一般是由于safari native player 对标准的检查比较严格,以下是协议中对media segment,playlist的一些要求。
Media Segment
- media MUST be continuous across segments, with the exception of transitions for ads and other inserted material.
- If using a transport stream, continuity counters and timestamps MUST be sequential.
- If using fMP4, the track fragment decode time MUST be consistent with the decode time and duration of the previous segment.
- Video segments MUST start with an IDR frame.
- Target durations SHOULD be 6 seconds.
- Segment durations SHOULD be nominally 6 seconds (for example, NTSC 29.97 may be 6.006 seconds).
- Media Segments MUST NOT exceed the target duration by more than 0.5 seconds.
- Each xHE-AAC segment SHOULD start with an Immediate Playout Frame (IPF).
Media Playlist
- You MUST use sufficiently accurate segment durations to ensure that the sum of the EXTINF durations of any contiguous group of segments is within one video frame duration of the actual duration of the content.
- Audio and video playlists MUST all use the same target duration.
- Audio and video playlists MUST contain the same duration of the content.
- The EXT-X-PROGRAM-DATE-TIME tag MUST be present in every live (linear) Media Playlist.
- The date-time value of an EXT-X-PROGRAM-DATE-TIME tag SHOULD be aligned with the airtime of the content.
- If your Media Playlists are created from static source content (VOD), you MUST add the EXT-X-PLAYLIST-TYPE with the value VOD.
- Within one asset, all Media Playlists with an EXT-X-PLAYLIST-TYPE of VOD MUST cover exactly the same media time range.
- If your Media Playlists are event style (start from a fixed point with segments never removed), you MUST add the EXT-X-PLAYLIST-TYPE with the value EVENT.
- Separate audio streams MUST be declared using EXT-X-MEDIA tags.
- The LANGUAGE attribute MUST be included in every EXT-X-MEDIA tag that doesn’t have TYPE=VIDEO.
- You MUST provide at least six segments in a live (linear) playlist.
- *You SHOULD provide at least 15 minutes of content in a live (linear) playlist.
- Breaks of encoding continuity MUST be indicated with the EXT-X-DISCONTINUITY tag.
- Video frame rate changes MUST be marked as a discontinuity using EXT-X-DISCONTINUITY tags.
- All variants and renditions MUST have discontinuities at the same points in time.
- *You SHOULD avoid switching codecs at discontinuities, for example, switching between HEVC and H.264, or between AAC and Dolby Digital.
- If live (linear) content will ever contain an EXT-X-DISCONTINUITY tag, the EXT-X-DISCONTINUITY-SEQUENCE tag MUST always be present.
- Your media requests MUST NOT use HTTP redirects, with the exception of ad content to allow dynamic selection of ads.
- You SHOULD identify interstitial and program boundaries using the EXT-X-DATERANGE tag.
- If using fMP4, EXT-X-MAP tags MUST be present.
- Metadata SHOULD be in the playlist (using EXT-X-DATERANGE) rather than in the media (using Timed Metadata).
- *For maximum interoperability, all audio/video variants and renditions SHOULD have segment boundaries at the same points in time.
- If your xHE-AAC segments start with an IPF, you SHOULD use the EXT-X-INDEPENDENT-SEGMENTS tag in the Media Playlist.
- A live (linear) playlist update SHOULD be considered invalid when the Last-Modified HTTP header, if supplied, is more than three target durations from the Date HTTP header.
Multivariant Playlist
- Your EXT-X-STREAM-INF tag MUST always provide the CODECS attribute.
- Your EXT-X-STREAM-INF tag MUST always provide the RESOLUTION attribute if the rendition includes video.
- Your EXT-X-I-FRAME-STREAM-INF tag MUST always provide the CODECS attribute.
- Your EXT-X-I-FRAME-STREAM-INF tag MUST always provide the RESOLUTION attribute.
- You SHOULD deliver video and audio as separate streams.
- If you have multichannel audio, you MUST use separate audio streams.
- If you have alternative audio content (languages/commentary/DVS), you MUST use separate audio streams.
- If you have different video angles, you MUST use separate audio streams.
- You MUST provide multiple bit rates of video (that is, variants).
- For HD content, there SHOULD be at least two variants encoded at the highest-available resolution.
- If your video segments start with an IDR, you SHOULD use the EXT-X-INDEPENDENT-SEGMENTS tag in the Multivariant Playlist. (See item 7.4.)
- If your video segments start with an IDR and the EXT-X-INDEPENDENT-SEGMENTS tag isn’t in the Multivariant Playlist, you MUST use the EXT-X-INDEPENDENT-SEGMENTS tag in all video Media Playlists. (See item 7.4.)
- The BANDWIDTH attribute MUST be the largest sum of peak segment bit rates that’s produced by any playable combination of renditions.
- You MUST include the AVERAGE-BANDWIDTH attribute.
- Each EXT-X-STREAM-INF tag that includes video content MUST have a FRAME-RATE attribute.
- The VIDEO-RANGE attribute MUST be specified unless all variants and renditions are SDR.
- Within a group of Renditions (EXT-X-MEDIA tags having the same TYPE and GROUP-ID), those tags having the same LANGUAGE value should be ordered from most general to most specific. (Because CHARACTERISTICS are open-ended, the matching algorithm needs the ordering since it can’t interpret all the semantics.)
- An EXT-X-CONTENT-STEERING tag SHOULD always have a PATHWAY-ID attribute.
- The SCORE attribute (if present) MUST be on every variant. Otherwise, the SCORE attribute will be ignored.
HTTP Live Streaming (HLS) authoring specification for Apple devices
HTTP Live Streaming 2nd Edition draft-pantos-hls-rfc8216bis-13