HLS AVItemPlayer incorrect duration

263 views Asked by At

I'm getting this manifest from streaming server.

#EXTM3U
#EXT-X-VERSION:1
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:NO
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-KEY:METHOD=AES-128,URI="***"
#EXT-X-PROGRAM-DATE-TIME:2016-12-24T12:30:00.000+00:00
#EXTINF:10,
EPISODE_266160_256k_4_122445000000_00000000_v2.ts
#EXT-X-PROGRAM-DATE-TIME:2016-12-24T12:30:09.752+00:00

...

EPISODE_266160_256k_4_122446638399_00000168_v2.ts
#EXT-X-PROGRAM-DATE-TIME:2016-12-24T12:57:28.152+00:00
#EXTINF:10,
EPISODE_266160_256k_4_122446648152_00000169_v2.ts
#EXT-X-ENDLIST

As you can see, time difference between 12:30:00 and 12:57:28 are 27:32 sec. Nevertheless, AVItemPlayer.duration and Quicktime player are showing 28:13 seconds. Last chunk don't provides date-time because is truncated before 10 seconds which is target duration.

Quicktime player AVItemPlayer.duration

In the real life, when I play the stream without interruptions, duration is 27:32. But if I seek in the timeline duration it increase to 28:13.

I'm showing some markers in the timeline and this cause to place them in incorrect position. Do you know why player could be calculating incorrect duration and how to fix it?

0

There are 0 answers