From 6ad638d0e834964dbab625e695afd13a3568b42c Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sat, 14 Aug 2021 14:56:20 +0200 Subject: [PATCH] hls: fix compatibility with video.js and iOS add AUDs to all h264 packet groups --- internal/hls/tsfile.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/hls/tsfile.go b/internal/hls/tsfile.go index 25a46938..e58fcc77 100644 --- a/internal/hls/tsfile.go +++ b/internal/hls/tsfile.go @@ -90,6 +90,9 @@ func (t *tsFile) writeH264(dts time.Duration, pts time.Duration, isIDR bool, nal } } + // prepend an AUD. This is required by video.js and iOS + nalus = append([][]byte{{byte(h264.NALUTypeAccessUnitDelimiter), 240}}, nalus...) + enc, err := h264.EncodeAnnexB(nalus) if err != nil { return err