gpt4 book ai didi

ios - 设置 AVPlayer AVPlayerItem 缓冲区大小?

转载 作者:可可西里 更新时间:2023-11-01 17:13:26 27 4
gpt4 key购买 nike

用avplayer播放视频,监听loadedTimeRanges属性,播放了10分钟左右的视频,avplayer总是预加载视频,感觉开销很大,有没有办法限制预加载区域的大小?比如一半时间预加载视频?

最佳答案

我认为您正在寻找 AVPlayerItem 的 preferredForwardBufferedDuration 属性。

每个苹果:

This property defines the preferred forward buffer duration in seconds. If set to 0, the player will choose an appropriate level of buffering for most use cases. Setting this property to a low value will increase the chance that playback will stall and re-buffer, while setting it to a high value will increase demand on system resources.

参见 https://developer.apple.com/reference/avfoundation/avplayeritem/1643630-preferredforwardbufferduration?language=objc

关于ios - 设置 AVPlayer AVPlayerItem 缓冲区大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43720129/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com