no message

videocall_popup
Zohaib Iqbal Kambrani 4 years ago
parent 48874c0efd
commit c1de908777

@ -41,18 +41,94 @@
<rect key="frame" x="0.0" y="0.0" width="428" height="926"/>
<color key="backgroundColor" white="0.0" alpha="0.98999999999999999" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WPH-QE-Fvp">
<rect key="frame" x="0.0" y="0.0" width="428" height="926"/>
<connections>
<action selector="onVideoContainerTapped:" destination="t2c-G5-7AE" eventType="touchUpInside" id="jDS-QU-1VX"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="videoMutedIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="CL1-2v-m1L" userLabel="remoteVideoMutedIndicator">
<rect key="frame" x="160.66666666666666" y="418.33333333333331" width="106.99999999999997" height="89.333333333333314"/>
<constraints>
<constraint firstAttribute="width" secondItem="CL1-2v-m1L" secondAttribute="height" multiplier="6:5" id="xqE-6Q-WAu"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="O5s-CJ-RFv">
<rect key="frame" x="0.0" y="100" width="428" height="731"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XHG-Db-3Px" customClass="AADraggableView" customModule="AADraggableView">
<rect key="frame" x="288" y="10" width="130" height="182"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0ZP-s2-kM5" userLabel="localVideo">
<rect key="frame" x="0.0" y="0.0" width="130" height="182"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
<real key="value" value="0.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6y1-an-W7F">
<rect key="frame" x="0.0" y="0.0" width="130" height="182"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="videoMutedIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="FEH-bC-Hnh" userLabel="localVideoMutedIndicator">
<rect key="frame" x="47" y="76" width="36" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="1iv-w5-GDT"/>
<constraint firstAttribute="width" constant="36" id="AwX-vQ-Ynn"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="FEH-bC-Hnh" firstAttribute="centerX" secondItem="6y1-an-W7F" secondAttribute="centerX" id="dtO-VP-8qV"/>
<constraint firstItem="FEH-bC-Hnh" firstAttribute="centerY" secondItem="6y1-an-W7F" secondAttribute="centerY" id="lpW-Vr-bH2"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="0ZP-s2-kM5" firstAttribute="top" secondItem="XHG-Db-3Px" secondAttribute="top" id="E5A-Yq-Ods"/>
<constraint firstAttribute="trailing" secondItem="6y1-an-W7F" secondAttribute="trailing" id="I0l-x2-rGO"/>
<constraint firstAttribute="width" secondItem="XHG-Db-3Px" secondAttribute="height" multiplier="1:1.4" id="M3V-vM-m0V"/>
<constraint firstAttribute="bottom" secondItem="6y1-an-W7F" secondAttribute="bottom" id="T0D-IE-19P"/>
<constraint firstItem="6y1-an-W7F" firstAttribute="top" secondItem="XHG-Db-3Px" secondAttribute="top" id="T8b-Nd-jdR"/>
<constraint firstItem="6y1-an-W7F" firstAttribute="leading" secondItem="XHG-Db-3Px" secondAttribute="leading" id="brg-bp-MME"/>
<constraint firstAttribute="bottom" secondItem="0ZP-s2-kM5" secondAttribute="bottom" id="hso-Od-7QF"/>
<constraint firstItem="0ZP-s2-kM5" firstAttribute="leading" secondItem="XHG-Db-3Px" secondAttribute="leading" id="k5R-AM-3J6"/>
<constraint firstAttribute="trailing" secondItem="0ZP-s2-kM5" secondAttribute="trailing" id="z8V-qh-Rzq"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="padding">
<integer key="value" value="20"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4S7-45-trL">
<rect key="frame" x="0.0" y="0.0" width="428" height="731"/>
<connections>
<action selector="btnSwipeVideoTapped:" destination="t2c-G5-7AE" eventType="touchUpInside" id="7AQ-6d-4iR"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="4S7-45-trL" firstAttribute="leading" secondItem="O5s-CJ-RFv" secondAttribute="leading" id="AMe-9q-Xk9"/>
<constraint firstAttribute="trailing" secondItem="4S7-45-trL" secondAttribute="trailing" id="CX4-Rs-rep"/>
<constraint firstAttribute="trailing" secondItem="XHG-Db-3Px" secondAttribute="trailing" constant="10" id="Ncy-sD-qeL"/>
<constraint firstAttribute="bottom" secondItem="4S7-45-trL" secondAttribute="bottom" id="iJ9-pg-VXQ"/>
<constraint firstItem="XHG-Db-3Px" firstAttribute="top" secondItem="O5s-CJ-RFv" secondAttribute="top" constant="10" id="nM8-B7-soj"/>
<constraint firstItem="4S7-45-trL" firstAttribute="top" secondItem="O5s-CJ-RFv" secondAttribute="top" id="sNK-WK-tqV"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WPH-QE-Fvp">
<rect key="frame" x="0.0" y="0.0" width="428" height="926"/>
<connections>
<action selector="btnOnScreenTapped:" destination="t2c-G5-7AE" eventType="touchUpInside" id="jDS-QU-1VX"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sK0-tB-H9u" userLabel="controlButtons">
<rect key="frame" x="0.0" y="831" width="428" height="95"/>
<subviews>
@ -210,76 +286,9 @@
<constraint firstAttribute="height" priority="900" constant="25" id="s8H-wK-WPB"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="O5s-CJ-RFv" userLabel="Tap Detect Container">
<rect key="frame" x="0.0" y="100" width="428" height="731"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XHG-Db-3Px" customClass="AADraggableView" customModule="AADraggableView">
<rect key="frame" x="288" y="10" width="130" height="182"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0ZP-s2-kM5" userLabel="localVideo">
<rect key="frame" x="0.0" y="0.0" width="130" height="182"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
<real key="value" value="0.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6y1-an-W7F">
<rect key="frame" x="0.0" y="0.0" width="130" height="182"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="videoMutedIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="FEH-bC-Hnh" userLabel="localVideoMutedIndicator">
<rect key="frame" x="47" y="76" width="36" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="1iv-w5-GDT"/>
<constraint firstAttribute="width" constant="36" id="AwX-vQ-Ynn"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="FEH-bC-Hnh" firstAttribute="centerX" secondItem="6y1-an-W7F" secondAttribute="centerX" id="dtO-VP-8qV"/>
<constraint firstItem="FEH-bC-Hnh" firstAttribute="centerY" secondItem="6y1-an-W7F" secondAttribute="centerY" id="lpW-Vr-bH2"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="0ZP-s2-kM5" firstAttribute="top" secondItem="XHG-Db-3Px" secondAttribute="top" id="E5A-Yq-Ods"/>
<constraint firstAttribute="trailing" secondItem="6y1-an-W7F" secondAttribute="trailing" id="I0l-x2-rGO"/>
<constraint firstAttribute="width" secondItem="XHG-Db-3Px" secondAttribute="height" multiplier="1:1.4" id="M3V-vM-m0V"/>
<constraint firstAttribute="bottom" secondItem="6y1-an-W7F" secondAttribute="bottom" id="T0D-IE-19P"/>
<constraint firstItem="6y1-an-W7F" firstAttribute="top" secondItem="XHG-Db-3Px" secondAttribute="top" id="T8b-Nd-jdR"/>
<constraint firstItem="6y1-an-W7F" firstAttribute="leading" secondItem="XHG-Db-3Px" secondAttribute="leading" id="brg-bp-MME"/>
<constraint firstAttribute="bottom" secondItem="0ZP-s2-kM5" secondAttribute="bottom" id="hso-Od-7QF"/>
<constraint firstItem="0ZP-s2-kM5" firstAttribute="leading" secondItem="XHG-Db-3Px" secondAttribute="leading" id="k5R-AM-3J6"/>
<constraint firstAttribute="trailing" secondItem="0ZP-s2-kM5" secondAttribute="trailing" id="z8V-qh-Rzq"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="padding">
<integer key="value" value="20"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="XHG-Db-3Px" secondAttribute="trailing" constant="10" id="Ncy-sD-qeL"/>
<constraint firstItem="XHG-Db-3Px" firstAttribute="top" secondItem="O5s-CJ-RFv" secondAttribute="top" constant="10" id="nM8-B7-soj"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="WPH-QE-Fvp" secondAttribute="bottom" id="4Fb-l0-7TG"/>
<constraint firstItem="eOT-Jr-GUl" firstAttribute="leading" secondItem="PoR-7r-yNe" secondAttribute="leading" id="4xz-lj-CXd"/>
<constraint firstAttribute="bottom" secondItem="eOT-Jr-GUl" secondAttribute="bottom" id="5Ae-F1-hSz"/>
<constraint firstItem="WPH-QE-Fvp" firstAttribute="leading" secondItem="PoR-7r-yNe" secondAttribute="leading" id="5Yr-p4-csA"/>
@ -300,23 +309,25 @@
<constraint firstItem="O5s-CJ-RFv" firstAttribute="top" secondItem="2nj-Va-L7c" secondAttribute="bottom" id="fLH-dK-xpa"/>
<constraint firstItem="eOT-Jr-GUl" firstAttribute="top" secondItem="PoR-7r-yNe" secondAttribute="top" id="gFm-X8-RIU"/>
<constraint firstAttribute="trailing" secondItem="sK0-tB-H9u" secondAttribute="trailing" id="gSh-7K-3p5"/>
<constraint firstAttribute="bottom" secondItem="WPH-QE-Fvp" secondAttribute="bottom" id="sYs-wp-cot"/>
<constraint firstAttribute="trailing" secondItem="2nj-Va-L7c" secondAttribute="trailing" id="vQp-Bv-IVU"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="s5b-6P-Hwj"/>
<connections>
<outlet property="btnMinimize" destination="UZ6-EY-a59" id="bDC-LS-qlX"/>
<outlet property="btnScreenTap" destination="WPH-QE-Fvp" id="wiN-5a-WJO"/>
<outlet property="camSwitchBtn" destination="lar-xK-rhR" id="tde-s5-Mji"/>
<outlet property="controlButtons" destination="sK0-tB-H9u" id="mDK-cq-oQz"/>
<outlet property="fullVideoView" destination="eOT-Jr-GUl" id="VKE-el-YGR"/>
<outlet property="hideVideoBtn" destination="n8H-om-4LV" id="tTp-Ep-XKS"/>
<outlet property="lblCallDuration" destination="Btq-Ll-BPH" id="Jdh-yK-PEx"/>
<outlet property="lblRemoteUsername" destination="Zct-62-YE6" id="OQ0-mf-mvc"/>
<outlet property="localVideo" destination="0ZP-s2-kM5" id="C68-k7-h5j"/>
<outlet property="localVideoContainer" destination="O5s-CJ-RFv" id="bh9-Yr-UGv"/>
<outlet property="localVideoMutedBg" destination="6y1-an-W7F" id="5FF-Ak-Vxb"/>
<outlet property="micMuteBtn" destination="N2h-FX-kF5" id="zgK-g1-Ndr"/>
<outlet property="remoteVideo" destination="eOT-Jr-GUl" id="VKE-el-YGR"/>
<outlet property="remoteVideoMutedIndicator" destination="CL1-2v-m1L" id="aJ0-QC-m9Y"/>
<outlet property="smallVideoView" destination="0ZP-s2-kM5" id="C68-k7-h5j"/>
<outlet property="topBar" destination="2nj-Va-L7c" id="Zt4-J2-uw8"/>
<outlet property="videoMuteBtn" destination="NUO-2p-pzL" id="XCc-nu-N8P"/>
<outletCollection property="minimizeConstraint" destination="s8H-wK-WPB" collectionClass="NSMutableArray" id="XTM-jR-Cos"/>

@ -9,12 +9,19 @@ import AADraggableView
extension AADraggableView{
func enable(_ enable:Bool){
if enable == false{
isEnabled = enable
if enable == false{
gestureRecognizers?.forEach({ gest in
removeGestureRecognizer(gest)
})
}else{
isEnabled = true
}
}
}
extension UIView{
func hidden(_ hidden:Bool, rootView:UIView){
UIView.transition(with: rootView, duration: 0.5, options: .transitionCrossDissolve, animations: {
self.isHidden = hidden
})
}
}

@ -72,9 +72,7 @@ extension MainAppViewController : ICallProtocol{
}
private func showVideo(show:Bool){
UIView.transition(with: view, duration: 0.5, options: .transitionCrossDissolve, animations: {
self.videoCallContainer.isHidden = !show
})
self.videoCallContainer.hidden(!show, rootView: view)
}
private func startVideoCall(result: @escaping FlutterResult, call:FlutterMethodCall) {
@ -83,23 +81,19 @@ extension MainAppViewController : ICallProtocol{
if let arguments = call.arguments as? NSDictionary{
showVideoCallView(true)
videoCallViewController.onRectFloat = { min in
self.rectFloatVideoCallView(min)
if(min){
self.videoCallContainer.repositionIfNeeded()
}
videoCallViewController.onRectFloat = { isRectFloat in
self.rectFloatVideoCallView(isRectFloat)
}
videoCallViewController.onCircleFloat = { min in
self.circleFloatVideoCallView(min)
self.videoCallContainer.reposition = min ? .free : .edgesOnly
self.videoCallContainer.repositionIfNeeded()
videoCallViewController.onCircleFloat = { isCircleFloat in
self.circleFloatVideoCallView(isCircleFloat)
}
videoCallViewController.onCallConnect = {
self.videoCallChannel?.invokeMethod("onCallConnected",arguments: nil)
}
videoCallViewController.onCallDisconnect = {
self.showVideoCallView(false)
self.videoCallViewController.minimizeVideoState(state: false)
self.videoCallChannel?.invokeMethod("onCallDisconnected",arguments: nil)
}
videoCallViewController.callBack = self
@ -130,7 +124,7 @@ extension MainAppViewController : ICallProtocol{
}
private func circleFloatVideoCallView(_ value:Bool){
videoCallContainer.enable(value)
videoCallContainer.reposition = value ? .sticky : .edgesOnly
UIView.animate(withDuration: 0.5) {
if(value){
@ -152,9 +146,7 @@ extension MainAppViewController : ICallProtocol{
}
private func showVideoCallView(_ value:Bool){
UIView.animate(withDuration: 0.5) {
self.videoCallContainer.isHidden = !value
}
self.videoCallContainer.hidden(!value, rootView: view)
}
func sessionDone(res: Any) {
@ -182,14 +174,14 @@ extension MainAppViewController : ICallProtocol{
videoCallContainer.heightAnchor.constraint(equalToConstant: screen.height)
]
vdoCallViewFloatRectConstraint = [
videoCallContainer.topAnchor.constraint(equalTo: view.topAnchor, constant: 20),
videoCallContainer.topAnchor.constraint(equalTo: view.topAnchor, constant: 40),
videoCallContainer.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20),
videoCallContainer.widthAnchor.constraint(equalToConstant: screen.width/3),
videoCallContainer.heightAnchor.constraint(equalToConstant: screen.height/3.5)
]
vdoCallViewFloatCircleConstraint = [
videoCallContainer.topAnchor.constraint(equalTo: view.topAnchor),
videoCallContainer.leadingAnchor.constraint(equalTo: view.leadingAnchor),
videoCallContainer.topAnchor.constraint(equalTo: view.topAnchor, constant: 40),
videoCallContainer.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20),
videoCallContainer.widthAnchor.constraint(equalToConstant: 70),
videoCallContainer.heightAnchor.constraint(equalToConstant: 70)
]

@ -12,7 +12,8 @@ class VideoCallRequestParameters{
var generalId:String?
var doctorId:Int?
var baseUrl:String?
var patientName:String?
init(dictionary:NSDictionary){
self.apiKey = dictionary["kApiKey"] as? String
self.sessionId = dictionary["kSessionId"] as? String
@ -23,5 +24,6 @@ class VideoCallRequestParameters{
self.generalId = dictionary["generalId"] as? String
self.doctorId = dictionary["DoctorId"] as? Int
self.baseUrl = dictionary["baseUrl"] as? String
self.patientName = dictionary["patientName"] as? String
}
}

@ -57,14 +57,15 @@ class VideoCallViewController: UIViewController {
@IBOutlet weak var remoteVideoMutedIndicator: UIImageView!
@IBOutlet weak var localVideoMutedBg: UIView!
@IBOutlet weak var btnScreenTap: UIButton!
@IBOutlet weak var localVideoContainer: UIView!
@IBOutlet weak var topBar: UIView!
@IBOutlet weak var lblCallDuration: UILabel!
@IBOutlet weak var remoteVideo: UIView!
@IBOutlet weak var localVideo: UIView!{
@IBOutlet weak var fullVideoView: UIView!
@IBOutlet weak var smallVideoView: UIView!{
didSet{
localVideo.layer.borderColor = UIColor.white.cgColor
localVideoDraggable = localVideo?.superview as? AADraggableView
smallVideoView.layer.borderColor = UIColor.white.cgColor
localVideoDraggable = smallVideoView?.superview as? AADraggableView
localVideoDraggable?.reposition = .edgesOnly
}
}
@ -78,16 +79,28 @@ class VideoCallViewController: UIViewController {
gesture.view?.removeFromSuperview()
}
@IBAction func onVideoContainerTapped(_ sender: Any) {
@IBAction func btnOnScreenTapped(_ sender: Any) {
if(hideVideoBtn.isSelected){
circleFloatBtnTapped(hideVideoBtn)
}else if(btnMinimize.isSelected){
btnMinimizeTapped(btnMinimize)
}else if(!btnMinimize.isSelected){
// Swipe video here
}
}
@IBAction func btnSwipeVideoTapped(_ sender: Any) {
// let smallVdoRender = smallVideoView.subviews.first
// let fullVdoRender = fullVideoView.subviews.first
// if let vdo = smallVdoRender{
// fullVideoView.addSubview(vdo)
// }
// if let vdo = fullVdoRender{
// smallVideoView.addSubview(vdo)
// }
//
// layoutVideoRenderViews()
}
@IBAction func didClickMuteButton(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
publisher!.publishAudio = !sender.isSelected
@ -105,7 +118,7 @@ class VideoCallViewController: UIViewController {
} else {
publisher!.publishVideo = true
}
localVideo.isHidden = sender.isSelected
smallVideoView.isHidden = sender.isSelected
localVideoMutedBg.isHidden = !sender.isSelected
}
@ -130,36 +143,41 @@ class VideoCallViewController: UIViewController {
onCircleFloat?(sender.isSelected)
topBar.isHidden = sender.isSelected
controlButtons.isHidden = sender.isSelected
localVideo.isHidden = sender.isSelected
smallVideoView.isHidden = sender.isSelected
self.publisher?.view?.layoutIfNeeded()
}
var floated = false
@IBAction func btnMinimizeTapped(_ sender: UIButton) {
floated = !floated
onRectFloat?(floated)
sender.isSelected = floated
minimizeVideoState(state: !sender.isSelected)
btnScreenTap.isHidden = !sender.isSelected
}
func minimizeVideoState(state:Bool){
btnMinimize.isSelected = state
onRectFloat?(state)
NSLayoutConstraint.activate(floated ? minimizeConstraint : maximisedConstraint)
NSLayoutConstraint.deactivate(floated ? maximisedConstraint : minimizeConstraint)
localVideoDraggable?.enable(!floated)
NSLayoutConstraint.activate(state ? minimizeConstraint : maximisedConstraint)
NSLayoutConstraint.deactivate(state ? maximisedConstraint : minimizeConstraint)
localVideoDraggable?.enable(!state)
lblRemoteUsername.isHidden = floated
hideVideoBtn.isHidden = !floated
lblRemoteUsername.isHidden = state
hideVideoBtn.isHidden = !state
lblCallDuration.superview?.isHidden = !hideVideoBtn.isHidden
let min_ = floated
UIView.animate(withDuration: 0.5) {
self.videoMuteBtn.isHidden = min_
self.micMuteBtn.isHidden = min_
self.camSwitchBtn.isHidden = min_
let localVdoSize = self.localVideo.bounds.size
let remoteVdoSize = self.remoteVideo.bounds.size
self.publisher?.view?.frame = CGRect(x: 0, y: 0, width: localVdoSize.width, height: localVdoSize.height)
self.subscriber?.view?.frame = CGRect(x: 0, y: 0, width: remoteVdoSize.width, height: remoteVdoSize.height)
self.publisher?.view?.layoutIfNeeded()
self.subscriber?.view?.layoutIfNeeded()
self.videoMuteBtn.isHidden = state
self.micMuteBtn.isHidden = state
self.camSwitchBtn.isHidden = state
self.layoutVideoRenderViews()
}
}
func layoutVideoRenderViews(){
if let publisherVdoSize = publisher?.view?.superview?.bounds.size{
publisher?.view?.frame = CGRect(x: 0, y: 0, width: publisherVdoSize.width, height: publisherVdoSize.height)
}
if let subscriberVdoSize = subscriber?.view?.superview?.bounds.size{
subscriber?.view?.frame = CGRect(x: 0, y: 0, width: subscriberVdoSize.width, height: subscriberVdoSize.height)
}
}
@ -179,6 +197,9 @@ class VideoCallViewController: UIViewController {
}
func start(params:VideoCallRequestParameters){
lblRemoteUsername.text = params.patientName ?? "- - -"
btnScreenTap.isHidden = true
hideVideoBtn.isHidden = true
self.kApiKey = params.apiKey ?? ""
self.kSessionId = params.sessionId ?? ""
@ -193,6 +214,7 @@ class VideoCallViewController: UIViewController {
requestCameraPermissionsIfNeeded()
hideVideoMuted()
setupSession()
}
private func changeCallStatus(callStatus:Int){
@ -397,10 +419,11 @@ extension VideoCallViewController: OTSessionDelegate {
showAlert(error?.localizedDescription)
}
publisher?.view!.frame = CGRect(x: 0, y: 0, width: localVideo.bounds.size.width, height: localVideo.bounds.size.height)
publisher?.view?.tag = 11
publisher?.view?.layer.cornerRadius = 5
publisher?.view?.clipsToBounds = true
localVideo.addSubview((publisher?.view)!)
smallVideoView.addSubview((publisher?.view)!)
layoutVideoRenderViews()
}
func sessionDidDisconnect(_ session: OTSession) {
@ -440,9 +463,9 @@ extension VideoCallViewController: OTSessionDelegate {
guard let subscriberView = subscriber.view else {
return
}
subscriberView.frame = CGRect(x: 0, y: 0, width: remoteVideo.bounds.width, height: remoteVideo.bounds.height)
remoteVideo.addSubview(subscriberView)
subscriberView.tag = 22
fullVideoView.addSubview(subscriberView)
layoutVideoRenderViews()
startUpdateCallDuration()
onCallConnect?()

Loading…
Cancel
Save