Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用iOS AVPlayer修改HLS流媒体的运行时URL_Ios_Avplayer_Http Live Streaming - Fatal编程技术网

使用iOS AVPlayer修改HLS流媒体的运行时URL

使用iOS AVPlayer修改HLS流媒体的运行时URL,ios,avplayer,http-live-streaming,Ios,Avplayer,Http Live Streaming,我们已将录制的视频存储在MS azure中,出于安全目的,MS azure需要添加带有HLS URL的安全令牌 例如,如果实际URL为http://samplevideo.m3u8安全令牌是XXX然后,需要从azure访问视频的URL是http://samplevideo.m3u8?XXX 此外,还需要更改.m3u8清单文件中包含的.tsURL。 例如,如果包含的.tsURL是PQR\u-vid\u 10.ts,则需要将其转换为PQR\u-vid\u 10.ts?XXX 在android中,我们

我们已将录制的视频存储在MS azure中,出于安全目的,MS azure需要添加带有HLS URL的安全令牌

例如,如果实际URL为
http://samplevideo.m3u8
安全令牌是
XXX
然后,需要从azure访问视频的URL是
http://samplevideo.m3u8?XXX

此外,还需要更改
.m3u8
清单文件中包含的
.ts
URL。 例如,如果包含的
.ts
URL是
PQR\u-vid\u 10.ts
,则需要将其转换为
PQR\u-vid\u 10.ts?XXX

在android中,我们使用的是Exo player,它有一个很好的API,允许通过回调修改每个URL。 例如,我们正在为exo player使用以下代码,它工作得非常好:

private void buildHlsMediaSource(){
Uri=Uri.parse(testHlsUrl);
HlsMediaSource HlsMediaSource=
新HlsMediaSource.工厂(
新ResolvingDataSource.Factory(
新的DefaultHttpDataSourceFactory(Util.getUserAgent(this,getString(R.string.app_name)),
(DataSpec DataSpec)->DataSpec.withUri(resolveUri(DataSpec.uri)))
.createMediaSource(uri);
玩家准备(hlsMediaSource);
player.setplaywhenrady(false);
player.addListener(eventListener);
}
私有Uri解析Uri(Uri){
字符串resultPath=uri.toString()+“?XXX”;
返回Uri.parse(resultPath);
}
但是,我们无法为iOS AVPlayer找到一个好的/类似的解决方案。 我们已经看到,一些答案建议使用本地代理服务器来解决这个问题。但我们不确定这是否是最终解决方案,也不确定是否有其他更好、更直接的解决方案

因此,请您为我们提供一个可能的简单/直接的解决方案,或者一个示例代码片段,或者这个用例的任何其他文档

提前谢谢