问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/36689135/get-bandwidth-of-stream-from-m3u-stream