Search code examples
ioshttp-live-streaming

HLS streaming onto IOS devices


I trying broadcast HLS stream to the IOS devices. HLS work like LIVE session. I have few video file and share each separate video with #EXT-X-ENDLIST. I send one after another. First video play normally, but next video doesn't begin from the beginning, IOS devices make jumping through this hls playlist.

For example:

enter code here
#EXTM3U
#EXT-X-TARGETDURATION:1
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:1,
mystream-1.ts
#EXTINF:1,
mystream-2.ts
#EXTINF:1,
mystream-3.ts
#EXTINF:1,
mystream-4.ts
#EXTINF:1,
mystream-5.ts
#EXTINF:1,
mystream-6.ts
#EXTINF:1,
mystream-7.ts

if IOS recv such playlist, then it doesn't begin playback from mystream-1.ts it begin from mystream-4.ts.

How could I fix it?


Solution

  • It's normal that when the playlist is for a live stream (without the #EXT-X-ENDLIST) that the client will start playing a few segments from the end of the playlist. This is because it expects that the playlist will be continually updated with more segments and the client will retrieve the playlist in a loop.

    You can fix it just by adding the #EXT-X-ENDLIST tag at the end of the playlist.

    Or maybe you expect that the stream continues to grow, in that case, you can try with an event playlist with this tag: #EXT-X-PLAYLIST-TYPE:EVENT

    The expected behavior of the client is not specified, so I don't know for sure if the application will start playing it from the beginning, but at least it should be able to seek to the start.