forked from mirrors/linphone-iphone
Merge remote-tracking branch 'refs/remotes/origin/feature/conversations'
#Conflicts: # Linphone/UI/Main/Conversations/ViewModel/ConversationViewModel.swift
This commit is contained in:
commit
60d006248b
3 changed files with 69 additions and 14 deletions
|
|
@ -62,6 +62,8 @@ struct CallView: View {
|
|||
@State private var pointingUp: CGFloat = 0.0
|
||||
@State private var currentOffset: CGFloat = 0.0
|
||||
@State var displayVideo = false
|
||||
@State private var previewVideoOffset = CGSize.zero
|
||||
@State private var previewVideoOffsetPreviousDrag = CGSize.zero
|
||||
|
||||
@Binding var fullscreenVideo: Bool
|
||||
@State var isShowCallsListFragment: Bool = false
|
||||
|
|
@ -568,23 +570,40 @@ struct CallView: View {
|
|||
Spacer()
|
||||
VStack {
|
||||
Spacer()
|
||||
LinphoneVideoViewHolder { view in
|
||||
coreContext.doOnCoreQueue { core in
|
||||
core.nativePreviewWindow = view
|
||||
HStack {
|
||||
LinphoneVideoViewHolder { view in
|
||||
coreContext.doOnCoreQueue { core in
|
||||
core.nativePreviewWindow = view
|
||||
}
|
||||
}
|
||||
.aspectRatio(callViewModel.callStatsModel.sentVideoWindow.widthFactor/callViewModel.callStatsModel.sentVideoWindow.heightFactor, contentMode: .fill)
|
||||
.frame(maxWidth: callViewModel.callStatsModel.sentVideoWindow.widthFactor * 256,
|
||||
maxHeight: callViewModel.callStatsModel.sentVideoWindow.heightFactor * 256)
|
||||
.clipped()
|
||||
}
|
||||
.frame(width: angleDegree == 0 ? 120*1.2 : 160*1.2, height: angleDegree == 0 ? 160*1.2 : 120*1.2)
|
||||
.frame(width: angleDegree == 0 ? 120*1.2 : 160*1.2, height: angleDegree == 0 ? 160*1.2 : 120*1.2) // 144*192
|
||||
.cornerRadius(20)
|
||||
.padding(10)
|
||||
.padding(.trailing, abs(angleDegree/2))
|
||||
.gesture(
|
||||
DragGesture(coordinateSpace: .global)
|
||||
.onChanged { value in
|
||||
previewVideoOffset = CGSize(width: previewVideoOffsetPreviousDrag.width + value.translation.width,
|
||||
height: previewVideoOffsetPreviousDrag.height + value.translation.height)
|
||||
}
|
||||
.onEnded { _ in
|
||||
previewVideoOffsetPreviousDrag = previewVideoOffset
|
||||
}
|
||||
)
|
||||
|
||||
.offset(x: previewVideoOffset.width, y: previewVideoOffset.height)
|
||||
}
|
||||
.padding(10)
|
||||
.padding(.trailing, abs(angleDegree/2))
|
||||
}
|
||||
.frame(
|
||||
maxWidth: fullscreenVideo && !telecomManager.isPausedByRemote ? geometry.size.width : geometry.size.width - 8,
|
||||
maxHeight: fullscreenVideo && !telecomManager.isPausedByRemote ? geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom : geometry.size.height - (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78) - 40 - 20 + geometry.safeAreaInsets.bottom
|
||||
)
|
||||
}
|
||||
|
||||
if telecomManager.outgoingCallStarted {
|
||||
VStack {
|
||||
ActivityIndicator(color: .white)
|
||||
|
|
@ -676,16 +695,34 @@ struct CallView: View {
|
|||
Spacer()
|
||||
VStack {
|
||||
Spacer()
|
||||
LinphoneVideoViewHolder { view in
|
||||
coreContext.doOnCoreQueue { core in
|
||||
core.nativePreviewWindow = view
|
||||
HStack {
|
||||
LinphoneVideoViewHolder { view in
|
||||
coreContext.doOnCoreQueue { core in
|
||||
core.nativePreviewWindow = view
|
||||
}
|
||||
}
|
||||
.aspectRatio(callViewModel.callStatsModel.sentVideoWindow.widthFactor/callViewModel.callStatsModel.sentVideoWindow.heightFactor, contentMode: .fill)
|
||||
.frame(maxWidth: callViewModel.callStatsModel.sentVideoWindow.widthFactor * 256,
|
||||
maxHeight: callViewModel.callStatsModel.sentVideoWindow.heightFactor * 256)
|
||||
.clipped()
|
||||
}
|
||||
.frame(width: angleDegree == 0 ? 120*1.2 : 160*1.2, height: angleDegree == 0 ? 160*1.2 : 120*1.2)
|
||||
.frame(width: angleDegree == 0 ? 120*1.2 : 160*1.2, height: angleDegree == 0 ? 160*1.2 : 120*1.2) // 144*192
|
||||
.cornerRadius(20)
|
||||
.padding(10)
|
||||
.padding(.trailing, abs(angleDegree/2))
|
||||
.gesture(
|
||||
DragGesture(coordinateSpace: .global)
|
||||
.onChanged { value in
|
||||
previewVideoOffset = CGSize(width: previewVideoOffsetPreviousDrag.width + value.translation.width,
|
||||
height: previewVideoOffsetPreviousDrag.height + value.translation.height)
|
||||
}
|
||||
.onEnded { _ in
|
||||
previewVideoOffsetPreviousDrag = previewVideoOffset
|
||||
}
|
||||
)
|
||||
|
||||
.offset(x: previewVideoOffset.width, y: previewVideoOffset.height)
|
||||
}
|
||||
.padding(10)
|
||||
.padding(.trailing, abs(angleDegree/2))
|
||||
}
|
||||
.frame(
|
||||
maxWidth: fullscreenVideo && !telecomManager.isPausedByRemote ? geometry.size.width : geometry.size.width - 8,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,20 @@
|
|||
import Foundation
|
||||
import linphonesw
|
||||
|
||||
class SentVideoWindow: ObservableObject {
|
||||
var widthFactor: CGFloat = 1
|
||||
var heightFactor: CGFloat = 1
|
||||
var isVertical = true
|
||||
init(videoWidth: UInt, videoHeight: UInt) {
|
||||
self.isVertical = videoWidth < videoHeight
|
||||
if isVertical {
|
||||
self.widthFactor = videoHeight == 0 ? 1 : CGFloat(videoWidth) / CGFloat(videoHeight)
|
||||
} else {
|
||||
self.heightFactor = videoWidth == 0 ? 1 : CGFloat(videoHeight) / CGFloat(videoWidth)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CallStatsModel: ObservableObject {
|
||||
var coreContext = CoreContext.shared
|
||||
|
||||
|
|
@ -32,6 +46,7 @@ class CallStatsModel: ObservableObject {
|
|||
@Published var videoCodec = ""
|
||||
@Published var videoBandwidth = ""
|
||||
@Published var videoLossRate = ""
|
||||
@Published var sentVideoWindow = SentVideoWindow(videoWidth: 480, videoHeight: 640)
|
||||
@Published var videoResolution = ""
|
||||
@Published var videoFps = ""
|
||||
|
||||
|
|
@ -88,6 +103,8 @@ class CallStatsModel: ObservableObject {
|
|||
let lossRateLabel = "Lossrate: ↑ \(senderLossRate)% ↓ \(receiverLossRate)%"
|
||||
|
||||
let sentResolution = call.currentParams!.sentVideoDefinition!.name
|
||||
let sentVideoWindow = SentVideoWindow(videoWidth: call.currentParams!.sentVideoDefinition!.width
|
||||
, videoHeight: call.currentParams!.sentVideoDefinition!.height)
|
||||
let receivedResolution = call.currentParams!.receivedVideoDefinition!.name
|
||||
let resolutionLabel = "Resolution: " + "↑ \(sentResolution!) ↓ \(receivedResolution!)"
|
||||
|
||||
|
|
@ -99,6 +116,7 @@ class CallStatsModel: ObservableObject {
|
|||
self.videoCodec = codecLabel
|
||||
self.videoBandwidth = bandwidthLabel
|
||||
self.videoLossRate = lossRateLabel
|
||||
self.sentVideoWindow = sentVideoWindow
|
||||
self.videoResolution = resolutionLabel
|
||||
self.videoFps = fpsLabel
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ struct MeetingsFragment: View {
|
|||
.shadow(color: .black.opacity(0.2), radius: 4)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
if let meetingModel = model.model {
|
||||
if let meetingModel = model.model, meetingModel.confInfo.state != ConferenceInfo.State.Cancelled {
|
||||
meetingViewModel.loadExistingMeeting(meeting: meetingModel)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue