如何在ios app文档目录中下载带.m3u8网址的视频。当我用.m3u8 url下载视频时,我收到包含以下数据的文本文件:
EXTM3U
EXT-X-VERSION:3
EXT-X-STREAM-INF:PROGRAM-ID = 1,BANDWIDTH = 1057090,CODECS =“avc1.4d001f,mp4a.40.2”,RESOLUTION = 854x480 14527590795694Super-Cool-Stylesstream_80.m3u8
EXT-X-STREAM-INF:PROGRAM-ID = 1,带宽= 1902362,CODECS = “avc1.4d001f,mp4a.40.2” RESOLUTION = 1280×720 14527590795694Super-冷Stylesstream_81.m3u8
EXT-X-STREAM-INF:PROGRAM-ID = 1,带宽= 455156,CODECS = “avc1.4d0015,mp4a.40.2” RESOLUTION = 428x240 14527590795694Super-冷Stylesstream_82.m3u8
EXT-X-STREAM-INF:PROGRAM-ID = 1,带宽= 188580,CODECS = “avc1.4d00c,mp4a.40.2” RESOLUTION = 256x144 14527590795694Super-冷Stylesstream_83.m3u8
EXT-X-STREAM-INF:PROGRAM-ID = 1,带宽= 144773,CODECS = “avc1.4d00c,mp4a.40.2” RESOLUTION = 256x144 14527590795694Super-冷Stylesstream_84.m3u8
我不知道如何继续下载实际视频,以便在离线模式下播放。请建议。
答案 0 :(得分:0)
对于任何通过此主题寻找解决方案的人来说:
从iOS 10开始,这可以使用AVAssetDownloadURLSession实现。
以下是Apple关于下载HLS资产以供离线使用的完整指南: