将.m3u8文件传递给AudioStreamer iOS

时间:2017-02-03 10:57:57

标签: ios objective-c m3u8 audiostreamer

任何人都可以建议我使用适用于iOS 10的m3u8解析器。我使用了this但它给了我错误

  

M3U8_BASE_URL未清除的标识符,未声明可见接口   在NSString for isExtendedM3Ufile这些错误,超过17个

NSString+m3u8.m中的

。我想将m3u8文件传递给AudioStreamer

请帮帮我。 感谢

1 个答案:

答案 0 :(得分:0)

enter image description here 根据截图,我将所有文件复制到一个文件夹中并导入到项目中。

然后m3u8文件URL到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;
            */

            }
        }