[英]Setting AVPlayerLayer VideoGravity works on Simulator, not on iPad
[英]AVPlayerLayer video “overspilled” when videoGravity set to AVLayerVideoGravityResizeAspectFill
我已經按照Apple Developer Library上的建議,使用AVPlayerLayer設置了自定義UIView。 一切正常,但是當我將AVPlayerLayer的videoGravity設置為AVLayerVideoGravityResizeAspectFill時,看起來框架外的部分也可見。 它似乎也有一個alpha。
我嘗試將masksToBounds設置為YES,但似乎無法解決問題。
有任何想法嗎?
您應該選中Xcode中AVPlayerLayerView的復選框“ Clip subviews”。 或者您需要將屬性相應地設置為YES。
我遇到了同樣的問題,並通過切換到AVLayerVideoGravityResizeAspect進行了修復。 AVLayerVideoGravityResizeAspect確保預覽圖層在框架范圍內調整大小。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.