Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out the current TS segment during a HLS(m3u8) playback in iOS?

An HLS (m3u8) file references mpeg-ts files. During its playback in iOS' AVPlayer, how can i determine the currently playing mpeg-ts URI?

like image 881
tommy chheng Avatar asked Oct 29 '13 19:10

tommy chheng


1 Answers

If your looking for a reference to the URI of the currently downloading TS, it's not available. You can get the URI of the stream for the current bit-rate by looking at the current AVPlayerItem's -accessLog.

E.g.: [[[player currentItem] accessLog] events]

It's an NSArray of AVPlayerItemAccessLogEvent's.

But it's not going to give you the URI of the TS per se. You may just have to calculate the current TS by where the playhead is currently at in relation to the duration as well as the segment size.

like image 128
jason.howk Avatar answered Nov 16 '22 15:11

jason.howk