简体   繁体   English

如何在iOS 9+中使用AVPlayer实施“自适应比特率”(HLS)

[英]How to implement 'Adaptive Bit Rate' (HLS) with AVPlayer in iOS 9+

I am trying to implement adaptive bit rate with AVPlayer but i don't know how to switch between a low/high stream. 我正在尝试使用AVPlayer实现自适应比特率,但是我不知道如何在低/高流之间切换。 I am a bit confused and have few questions: 我有点困惑,有几个问题:

  1. Is it the sole responsibility of the server to implement HLS on its side OR the client also has to do something about it OR the client handles it automatically? 它是服务器的实现在其一侧HLS承担全部责任或者客户端也可以做一些事情或者客户端自动处理呢?

  2. I am getting the following URLs from server, can someone tell me how to switch between the them based on network speed and what other steps are involved? 我从服务器获取以下URL ,有人可以告诉我如何根据网络速度在它们之间进行切换以及涉及哪些其他步骤吗?

{ "VideoStreamUrl": " http://50.7.149.74:1935/pitvlive/aplus3.stream/playlist.m3u8 ?", "VideoStreamUrlLow": " http://50.7.149.74:1935/pitvlive/aplus3_240p.stream/playlist.m3u8 ?", "VideoStreamUrlHD": null } {“ VideoStreamUrl”:“ http://50.7.149.74:1935/pitvlive/aplus3.stream/playlist.m3u8 ?”,“ VideoStreamUrlLow”:“ http://50.7.149.74:1935/pitvlive/aplus3_240p.stream/playlist .m3u8吗?”,“ VideoStreamUrlHD”:null}

AVPlayer supports HLS natively from the framework so you shouldnt need to do anything to support this. AVPlayer从框架本身就支持HLS,因此您不需要做任何事情来支持它。

The framework will automatically switch between low and high streams according to the current available bandwidth, so you dont actually need to pick a stream. 该框架将根据当前可用带宽自动在低流和高流之间切换,因此您实际上不需要选择流。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM