fix mini call screen size

pull/699/head
ryanzhao 2 years ago
parent a45ed57480
commit 2968a3cf06

@ -78,8 +78,8 @@ class RemoteVideoView: TargetView {
class LocalVideoView: TargetView {
static let width: CGFloat = 80
static let height: CGFloat = 173
static let width: CGFloat = UIDevice.current.isIPad ? 160 : 80
static let height: CGFloat = UIDevice.current.isIPad ? 346: 173
override func renderFrame(_ frame: RTCVideoFrame?) {
super.renderFrame(frame)

@ -5,7 +5,8 @@ final class MiniCallView: UIView, RTCVideoViewDelegate {
var callVC: CallVC
// MARK: UI
private static let defaultSize: CGFloat = 100
private static let defaultSize: CGFloat = UIDevice.current.isIPad ? 200 : 100
private static let defaultVideoSize: CGFloat = UIDevice.current.isIPad ? 320 : 160
private let topMargin = UIApplication.shared.keyWindow!.safeAreaInsets.top + Values.veryLargeSpacing
private let bottomMargin = UIApplication.shared.keyWindow!.safeAreaInsets.bottom
@ -70,7 +71,7 @@ final class MiniCallView: UIView, RTCVideoViewDelegate {
private func setUpViewHierarchy() {
self.width = self.set(.width, to: MiniCallView.defaultSize)
self.height = self.set(.height, to: MiniCallView.defaultSize)
self.layer.cornerRadius = 10
self.layer.cornerRadius = UIDevice.current.isIPad ? 20 : 10
self.layer.masksToBounds = true
// Background
let background = getBackgroudView()
@ -139,7 +140,10 @@ final class MiniCallView: UIView, RTCVideoViewDelegate {
// MARK: RTCVideoViewDelegate
func videoView(_ videoView: RTCVideoRenderer, didChangeVideoSize size: CGSize) {
let newSize = CGSize(width: min(160.0, 160.0 * size.width / size.height), height: min(160.0, 160.0 * size.height / size.width))
let newSize = CGSize(
width: min(Self.defaultVideoSize, Self.defaultVideoSize * size.width / size.height),
height: min(Self.defaultVideoSize, Self.defaultVideoSize * size.height / size.width)
)
persistCurrentPosition(newSize: newSize)
self.width?.constant = newSize.width
self.height?.constant = newSize.height

Loading…
Cancel
Save