Closed binho closed 3 years ago
SZAVPlayer
has set the parameter playerLayer
as public access.
https://github.com/eroscai/SZAVPlayer/blob/786b5337cae31ba1225514329b3d4b96d49bbc2e/Sources/Classes/SZAVPlayer.swift#L100
You can use it directly to achieve your purpose. For example
// tried on `playerLayer` and `playerView` itself (playerView is an instance of `SZAVPlayer`)
override func layoutSubviews() {
super.layoutSubviews()
playerView.playerLayer?.frame = bounds
playerView.playerLayer?.layoutIfNeeded()
}
If is still doesn't working after trying, please tell me.
@eroscai It worked, I just changed layoutIfNeeded()
to removeAllAnimations()
to prevent it from animating.
I've been trying to use the player inside a collection view cell that can change it's width/height based on user collapsing/expanding it but look like the video player layer is not respecting the player constraints.
(I've added a green border to the video player to make it easy to see)
Tried some things from the cell itself like:
but only way to fix it for now was update
SZAVPlayer
and add:Not sure it's a bug or is there a simpler way to fix it without modifying the source. thanks