MPMoviePlayerController - 如何判断正在播放的比特率?
HTTP Live Streaming 格式支持可变比特率,这在 m3u8 文件中进行了描述。
是否可以获得当前播放流的码率?
The HTTP Live Streaming format supports variable bitrates, which are described in the m3u8 file.
Is it possible to get the bitrate of the currently playing stream?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您无法从 MPMoviePlayerController 获取该信息
要获取所需的信息,您可以使用 AVPlayer 和 AVPlayerItems,然后它们将创建 AVAsset 项目,您可以查询这些项目以发现其属性。
一旦你有了 AVPlayer,你就可以使用
currentItem
找到当前的 AVPlayerItem。由此,您可以获得asset
属性。AVAsset
具有AVAssetTrack
,并且它具有formatDescriptions
属性。您应该在那里找到比特率。No, you can't get that information from MPMoviePlayerController
To get the information you want, you could use AVPlayer and AVPlayerItems, which will then create AVAsset items that you can interrogate to discover their properties.
Once you have a AVPlayer, you can find the current AVPlayerItem using
currentItem
. From that, you can get theasset
property.A
AVAsset
hasAVAssetTrack
s and this has theformatDescriptions
property. Somewhere in there you should find the bitrate.