1

I'm using AVURAsset with a HLS url. The response is like below

    QualityLevels(1020000)/Manifest(video,format=m3u8-aapl)
    #EXT-X-I-FRAME-STREAM-   INF:BANDWIDTH=1189576,RESOLUTION=668x376,CODECS="avc1.4d401f",URI="QualityLevels(1020000)/Manifest(video,format=m3u8-aapl,type=keyframes)"
    #EXT-X-STREAM-INF:BANDWIDTH=1810952,RESOLUTION=924x520,CODECS="avc1.4d401f,mp4a.40.2",AUDIO="audio"


   QualityLevels(1628000)/Manifest(video,format=m3u8-aapl)
   #EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1810952,RESOLUTION=924x520,CODECS="avc1.4d401f",URI="QualityLevels(1628000)/Manifest(video,format=m3u8-aapl,type=keyframes)"
   #EXT-X-STREAM-INF:BANDWIDTH=2803314,RESOLUTION=1280x720,CODECS="avc1.640029,mp4a.40.2",AUDIO="audio"

Can I get the metadata from this playlist file with AVFoundation class, like bandwidth, resolution?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
RayChen
  • 1,417
  • 2
  • 17
  • 36

1 Answers1

3

You can get the resolution of video as its natural size as following AVURLAsset getting video size

Regarding bandwidth, it is probably bit-rate of video. You can try this implementation

- (int)getBandwidth:(AVPlayer *)moviePlayer {
    VPlayerItemAccessLog *log = [moviePlayer.currentItem accessLog];
    NSArray *events = [log events];
    AVPlayerItemAccessLogEvent *event = [events lastObject];
    return ((int) ceilf(event.indicatedBitrate / 1000.0));
}

I hope this would be helpful.

Community
  • 1
  • 1
HSG
  • 1,224
  • 11
  • 17
  • Thanks, but I would like to get all bandwidth. This method seems only can get current track required speed. – RayChen Apr 18 '16 at 09:05