no message

videocall_popup
Zohaib Iqbal Kambrani 5 years ago
parent 693f57a13e
commit 1a158f49bb

@ -39,6 +39,7 @@
<subviews>
<view contentMode="scaleToFill" restorationIdentifier="VideoCallNavigationViewController" translatesAutoresizingMaskIntoConstraints="NO" id="eOT-Jr-GUl" userLabel="remoteVideo">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="videoMutedIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="CL1-2v-m1L" userLabel="remoteVideoMutedIndicator">
<rect key="frame" x="147" y="398" width="120" height="100"/>
@ -50,7 +51,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XHG-Db-3Px">
<rect key="frame" x="270" y="40" width="124" height="174"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0ZP-s2-kM5" userLabel="localVideo">
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0ZP-s2-kM5" userLabel="localVideo">
<rect key="frame" x="0.0" y="0.0" width="124" height="174"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<userDefinedRuntimeAttributes>
@ -78,6 +79,11 @@
<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"/>
@ -134,6 +140,7 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="UZ6-EY-a59" firstAttribute="height" secondItem="NUO-2p-pzL" secondAttribute="height" id="kK6-uF-bf6"/>
<constraint firstItem="N2h-FX-kF5" firstAttribute="height" secondItem="NUO-2p-pzL" secondAttribute="height" id="o4R-49-iMe"/>
@ -150,6 +157,7 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="r9w-8l-Zxj" firstAttribute="top" secondItem="sK0-tB-H9u" secondAttribute="top" constant="15" id="00C-1i-sGc"/>
<constraint firstItem="AoF-Up-Yu5" firstAttribute="bottom" secondItem="r9w-8l-Zxj" secondAttribute="bottom" id="1kB-OK-b0L"/>
@ -160,20 +168,19 @@
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="XHG-Db-3Px" firstAttribute="top" secondItem="PoR-7r-yNe" secondAttribute="top" constant="40" id="11Y-Ag-YNc"/>
<constraint firstItem="eOT-Jr-GUl" firstAttribute="top" secondItem="PoR-7r-yNe" secondAttribute="top" id="1GX-fj-ce8"/>
<constraint firstItem="eOT-Jr-GUl" firstAttribute="top" secondItem="PoR-7r-yNe" secondAttribute="top" id="8zP-pG-g2P"/>
<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="sK0-tB-H9u" firstAttribute="leading" secondItem="PoR-7r-yNe" secondAttribute="leading" id="Itp-Pe-kh9"/>
<constraint firstAttribute="bottom" secondItem="eOT-Jr-GUl" secondAttribute="bottom" id="KQg-N0-9AK"/>
<constraint firstItem="eOT-Jr-GUl" firstAttribute="leading" secondItem="PoR-7r-yNe" secondAttribute="leading" id="P4J-Tm-yNd"/>
<constraint firstAttribute="trailing" secondItem="eOT-Jr-GUl" secondAttribute="trailing" id="Pcn-K9-H92"/>
<constraint firstAttribute="bottom" secondItem="sK0-tB-H9u" secondAttribute="bottom" id="Tu5-Op-mnF"/>
<constraint firstItem="CL1-2v-m1L" firstAttribute="centerY" secondItem="PoR-7r-yNe" secondAttribute="centerY" id="UGv-46-ri8"/>
<constraint firstItem="CL1-2v-m1L" firstAttribute="centerX" secondItem="PoR-7r-yNe" secondAttribute="centerX" id="Xt8-k3-fDj"/>
<constraint firstItem="XHG-Db-3Px" firstAttribute="width" secondItem="PoR-7r-yNe" secondAttribute="width" multiplier="0.3" id="dH2-dK-Fbg"/>
<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 firstItem="eOT-Jr-GUl" firstAttribute="leading" secondItem="PoR-7r-yNe" secondAttribute="leading" id="rI9-oh-p8L"/>
<constraint firstAttribute="trailing" secondItem="eOT-Jr-GUl" secondAttribute="trailing" id="suy-vB-rXS"/>
<constraint firstAttribute="trailing" secondItem="XHG-Db-3Px" secondAttribute="trailing" constant="20" id="ubC-LX-bj4"/>
</constraints>
</view>

@ -47,8 +47,10 @@ extension MainAppViewController : ICallProtocol{
func prepareVideoCallView(){
videoCallContainer = UIView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height))
videoCallContainer.alpha = 0.0
videoCallContainer.backgroundColor = UIColor.black
videoCallContainer.isHidden = true
videoCallContainer.clipsToBounds = true
view.addSubview(videoCallContainer)
setVideoViewConstrints()
NSLayoutConstraint.activate(vdoCallViewMaxConstraint)
@ -97,12 +99,13 @@ extension MainAppViewController : ICallProtocol{
}
private func showVideoCallView(_ value:Bool){
videoCallContainer.alpha = value ? 0.0 : 1
self.videoCallContainer.isHidden = !value
UIView.animate(withDuration: 0.5) {
self.videoCallContainer.alpha = value ? 1.0 : 0.0
} completion: { complete in
if(value == false){
self.videoCallContainer.removeFromSuperview()
}
self.videoCallContainer.isHidden = !value
}
}

@ -9,25 +9,31 @@
import Foundation
extension UIView {
func fill(to parent: UIView) {
topAnchor.constraint(equalTo: parent.topAnchor).isActive = true
leadingAnchor.constraint(equalTo: parent.leadingAnchor).isActive = true
bottomAnchor.constraint(equalTo: parent.bottomAnchor).isActive = true
trailingAnchor.constraint(equalTo: parent.trailingAnchor).isActive = true
func fill(to parent: UIView, animateDuration:Double = 0.5) {
self.topAnchor.constraint(equalTo: parent.topAnchor).isActive = true
self.leadingAnchor.constraint(equalTo: parent.leadingAnchor).isActive = true
self.bottomAnchor.constraint(equalTo: parent.bottomAnchor).isActive = true
self.trailingAnchor.constraint(equalTo: parent.trailingAnchor).isActive = true
UIView.animate(withDuration: animateDuration) {
parent.layoutIfNeeded()
}
}
func fillToParent() {
func fillToParent(animateDuration:Double = 0.5) {
if let parent = self.superview{
topAnchor.constraint(equalTo: parent.topAnchor).isActive = true
leadingAnchor.constraint(equalTo: parent.leadingAnchor).isActive = true
bottomAnchor.constraint(equalTo: parent.bottomAnchor).isActive = true
trailingAnchor.constraint(equalTo: parent.trailingAnchor).isActive = true
self.topAnchor.constraint(equalTo: parent.topAnchor).isActive = true
self.leadingAnchor.constraint(equalTo: parent.leadingAnchor).isActive = true
self.bottomAnchor.constraint(equalTo: parent.bottomAnchor).isActive = true
self.trailingAnchor.constraint(equalTo: parent.trailingAnchor).isActive = true
UIView.animate(withDuration: animateDuration) {
parent.layoutIfNeeded()
}
}
}
func fillTo(view:UIView) {
func fillInTo(view:UIView) {
view.addSubview(self)
fill(to: view)
fillToParent()
}
}

@ -101,17 +101,19 @@ class VideoCallViewController: UIViewController {
sender.isSelected = minimized
onMinimize?(minimized)
self.videoMuteBtn.isHidden = minimized
self.micMuteBtn.isHidden = minimized
let min_ = minimized
UIView.animate(withDuration: 1) {
UIView.animate(withDuration: 0.5) {
self.actionsHeightConstraint.constant = min_ ? 30 : 60
self.localvideoTopMargin.constant = min_ ? 20 : 40
self.videoMuteBtn.isHidden = min_
self.micMuteBtn.isHidden = min_
let vdoBound = self.localVideo.bounds
self.publisher?.view?.frame = CGRect(x: 0, y: 0, width: vdoBound.size.width, height: vdoBound.size.height)
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()
}
}
@ -324,14 +326,8 @@ class VideoCallViewController: UIViewController {
extension VideoCallViewController: OTSessionDelegate {
func sessionDidConnect(_ session: OTSession) {
print("The client connected to the OpenTok session.")
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(VideoCallViewController.updateTimer)), userInfo: nil, repeats: true)
print("The client connected to the OpenTok session.")
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(VideoCallViewController.updateTimer)), userInfo: nil, repeats: true)
setupPublisher()
}
@ -373,27 +369,23 @@ extension VideoCallViewController: OTSessionDelegate {
func session(_ session: OTSession, streamCreated stream: OTStream) {
subscriber = OTSubscriber(stream: stream, delegate: self)
guard let subscriber = subscriber else {
return
}
subscriber = OTSubscriber(stream: stream, delegate: self)
guard let subscriber = subscriber else {
return
}
var error: OTError?
session.subscribe(subscriber, error: &error)
guard error == nil else {
print(error!)
return
}
var error: OTError?
session.subscribe(subscriber, error: &error)
guard error == nil else {
print(error!)
return
}
guard let subscriberView = subscriber.view else {
return
}
subscriberView.frame = UIScreen.main.bounds
view.insertSubview(subscriberView, at: 0)
// if nil == subscriber {
// setupSubscribe(stream)
// }
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)
}
func setupSubscribe(_ stream: OTStream?) {

Loading…
Cancel
Save