Landcape handling of video self view in 1-1 calls

This commit is contained in:
Christophe Deschamps 2022-11-28 16:15:41 +01:00
parent 5ab6a7ce1b
commit ad9163320c
3 changed files with 22 additions and 2 deletions

View file

@ -70,6 +70,14 @@ extension UIView {
return self
}
func updateSize(w:CGFloat,h:CGFloat) -> UIView {
snp.updateConstraints { (make) in
make.width.equalTo(w)
make.height.equalTo(h)
}
return self
}
func height(_ h:CGFloat) -> UIView {
snp.makeConstraints { (make) in
make.height.equalTo(h)

View file

@ -238,8 +238,8 @@ class ActiveCallView: UIView { // = currentCall
avatar.square(Avatar.diameter_for_call_views_land).center().done()
} else {
avatar.square(Avatar.diameter_for_call_views).center().done()
}
localVideo.updateSizeConstraint()
}
required init?(coder: NSCoder) {

View file

@ -73,8 +73,20 @@ class LocalVideoView: UIView {
setSizeConstraint()
}
func getSize() -> CGSize {
let w = UIDevice.current.orientation.isLandscape ? width*aspect_ratio : width
let h = !UIDevice.current.orientation.isLandscape ? width*aspect_ratio : width
return CGSize(width: w,height: h)
}
func setSizeConstraint() {
size(w: width, h: width*aspect_ratio).done()
let targetSsize = getSize()
size(w: targetSsize.width, h: targetSsize.height).done()
}
func updateSizeConstraint() {
let targetSsize = getSize()
updateSize(w: targetSsize.width, h: targetSsize.height).done()
}