passing .m3u8 file to AudioStreamer iOS

Deadly 提交于 2019-12-11 08:14:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!