Hi,
I would like to know what is the recommended way to detect the end of a live HLS playlist (sliding window) which contains the EXT-X-ENDLIST end tag ?
I tried to do this: Observing the currentItem's duration property. It often works, but sometimes currentItem's duration remains indefinite even if EXT-X-ENDLIST hls end tag was appended to the playlist. To me: if duration.isIndefinite, we're LIVE if duration.isValid && !duration.isIndefinite, it's VOD
Observe playbackType from AVPlayerItem's last accessLogEvent with AVPlayerItemNewAccessLogEntryNotification. It seems the most reliable and work 100% of the time, but accessLog is never refreshed when playing a live playlist and is refreshed only after seeking. I would prefer a more reactive way to know when a live has ended...
Playlist example where currentItem's duration remains indefinite event if end tag is present (iPhone XR, iOS 14.4.1):
swift
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:302
#EXT-X-PROGRAM-DATE-TIME:2021-05-20T13:30:32.000Z
#EXT-X-KEY:METHOD=AES-128,URI="https://example.akamaized.net/serve.key"
#EXTINF:8.00000,
remote_00302.ts
#EXT-X-PROGRAM-DATE-TIME:2021-05-20T13:30:40.000Z
#EXTINF:8.00000,
remote_00303.ts
...
#EXT-X-PROGRAM-DATE-TIME:2021-05-20T14:00:08.000Z
#EXTINF:8.00000,
remote_00524.ts
#EXT-X-PROGRAM-DATE-TIME:2021-05-20T14:00:16.000Z
#EXTINF:8.00000,
remote_00525.ts
#EXT-X-PROGRAM-DATE-TIME:2021-05-20T14:00:24.000Z
#EXTINF:5.13333,
remote_00526.ts
#EXT-X-ENDLIST
Should i file a bug for this ? Or i'm doing it in the wrong way ?
Thank you for your help,
Paul.
3
0
3.9k