问题
Can any one suggest me a m3u8 parser that works on iOS 10. I used this but its giving me errors
M3U8_BASE_URL undecleared indentifier, No visible interface declared in NSString for isExtendedM3Ufile these kind of errors,, more than 17
in NSString+m3u8.m
. I want to pass an m3u8 file to AudioStreamer.
Please help me. Thanks
回答1:
According to the screenshot, I copied all the files into one folder and import to the project.
Then m3u8 file URL to the M3U8PlaylistModel
let playlistModel = M3U8PlaylistModel(url: self.m3u8_url)
guard let m3u8PlaylistModel = playlistModel else {
return
}
guard let masterPlaylist = m3u8PlaylistModel.masterPlaylist else {
return
}
guard let streamList = masterPlaylist.xStreamList else {
return
}
streamList.sortByBandwidth(inOrder: .orderedAscending)
for i in 0 ..< streamList.count {
if let extXStreamInf = streamList.xStreamInf(at: i){
/* you can get below properties, using this extXStreamInf object
@property (nonatomic, readonly, assign) NSInteger bandwidth;
@property (nonatomic, readonly, assign) NSInteger programId; // removed by draft 12
@property (nonatomic, readonly, copy) NSArray *codecs;
@property (nonatomic, readonly) MediaResoulution resolution;
@property (nonatomic, readonly, copy) NSString *audio;
@property (nonatomic, readonly, copy) NSString *video;
@property (nonatomic, readonly, copy) NSString *subtitles;
@property (nonatomic, readonly, copy) NSString *closedCaptions;
@property (nonatomic, readonly, copy) NSURL *URI;
*/
}
}
来源:https://stackoverflow.com/questions/42022641/passing-m3u8-file-to-audiostreamer-ios