An HLS (m3u8) file references mpeg-ts files. During its playback in iOS' AVPlayer, how can i determine the currently playing mpeg-ts URI?
Asked
Active
Viewed 3,922 times
14
-
Could you provide a url for your m3u8 file? – Don Miguel Jan 10 '14 at 12:20
-
My question is for any generic m3u8 file, you can get an example on https://developer.apple.com/library/ios/technotes/tn2288/_index.html – tommy chheng Jan 15 '14 at 22:59
1 Answers
3
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.

jason.howk
- 201
- 1
- 2
-
This will not work in case of adaptive streaming in where you might have different m3u8's for different renditions of the same video. – user3577291 Mar 30 '15 at 23:00
-
I don't think you can calculate the current TS this way because there is no way to get the initial offset (EXT-X-MEDIA-SEQUENCE:138), API just doesn't provide access to it. – Denis Mysenko Apr 13 '15 at 11:55