|
|
|
|
@ -23,6 +23,8 @@ class ViewController: UIViewController {
|
|
|
|
|
var kToken:String = ""
|
|
|
|
|
|
|
|
|
|
var callBack: ICallProtocol?
|
|
|
|
|
var timer = Timer()
|
|
|
|
|
var seconds = 30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
|
@ -208,6 +210,15 @@ class ViewController: UIViewController {
|
|
|
|
|
|
|
|
|
|
@IBOutlet weak var localVideoMutedIndicator: UIImageView!
|
|
|
|
|
|
|
|
|
|
@objc func updateTimer(){
|
|
|
|
|
seconds -= 1 //This will decrement(count down)the seconds.
|
|
|
|
|
print(seconds)
|
|
|
|
|
if seconds == 0 {
|
|
|
|
|
sessionDisconnect();
|
|
|
|
|
timer.invalidate()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -216,11 +227,17 @@ extension ViewController: OTSessionDelegate {
|
|
|
|
|
|
|
|
|
|
func sessionDidConnect(_ session: OTSession) {
|
|
|
|
|
print("The client connected to the OpenTok session.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(ViewController.updateTimer)), userInfo: nil, repeats: true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setupPublisher()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func setupPublisher() {
|
|
|
|
|
let settings = OTPublisherSettings()
|
|
|
|
|
settings.name = UIDevice.current.name
|
|
|
|
|
@ -304,6 +321,18 @@ extension ViewController: OTSessionDelegate {
|
|
|
|
|
subscriber?.view!.removeFromSuperview()
|
|
|
|
|
subscriber = nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func session(
|
|
|
|
|
_ session: OTSession?,
|
|
|
|
|
connectionCreated connection: OTConnection?
|
|
|
|
|
) {
|
|
|
|
|
// startTimer(callDuration, warningDuration)
|
|
|
|
|
if let connectionId = connection?.connectionId {
|
|
|
|
|
print("session connectionCreated (\(connectionId))")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timer.invalidate()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|