|
@@ -75,6 +75,7 @@ class SeminarViewController: UIViewController {
|
|
|
}
|
|
|
|
|
|
var statusView = UIView()
|
|
|
+ var viewCountViewer = UIView()
|
|
|
|
|
|
lazy var status: UILabel = {
|
|
|
let label = UILabel()
|
|
@@ -88,24 +89,28 @@ class SeminarViewController: UIViewController {
|
|
|
lazy var tvCameraPreviewB: UIImageView = {
|
|
|
let imageView = UIImageView()
|
|
|
imageView.contentMode = .scaleAspectFit
|
|
|
+ imageView.backgroundColor = .black
|
|
|
return imageView
|
|
|
}()
|
|
|
|
|
|
lazy var tvCameraPreviewS: UIImageView = {
|
|
|
let imageView = UIImageView()
|
|
|
imageView.contentMode = .scaleAspectFit
|
|
|
+ imageView.backgroundColor = .black
|
|
|
return imageView
|
|
|
}()
|
|
|
|
|
|
lazy var ivRemoteViewS: UIImageView = {
|
|
|
let imageView = UIImageView()
|
|
|
imageView.contentMode = .scaleAspectFit
|
|
|
+ imageView.backgroundColor = .black
|
|
|
return imageView
|
|
|
}()
|
|
|
|
|
|
lazy var ivRemoteViewM: UIImageView = {
|
|
|
let imageView = UIImageView()
|
|
|
imageView.contentMode = .scaleAspectFit
|
|
|
+ imageView.backgroundColor = .black
|
|
|
return imageView
|
|
|
}()
|
|
|
|
|
@@ -363,7 +368,6 @@ class SeminarViewController: UIViewController {
|
|
|
}
|
|
|
|
|
|
func addCountViewerView() {
|
|
|
- let viewCountViewer = UIView()
|
|
|
view.addSubview(viewCountViewer)
|
|
|
viewCountViewer.anchor(top: view.safeAreaLayoutGuide.topAnchor, left: view.leftAnchor, paddingLeft: 20, height: 40)
|
|
|
viewCountViewer.backgroundColor = .white.withAlphaComponent(0.2)
|
|
@@ -377,7 +381,7 @@ class SeminarViewController: UIViewController {
|
|
|
|
|
|
viewCountViewer.addSubview(countViewer)
|
|
|
countViewer.anchor(left: imageEye.rightAnchor, right:viewCountViewer.rightAnchor, paddingLeft: 5.0, paddingRight: 5.0, centerY: viewCountViewer.centerYAnchor)
|
|
|
- countViewer.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showListViewer(sender:))))
|
|
|
+ viewCountViewer.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showListViewer(sender:))))
|
|
|
}
|
|
|
|
|
|
override func viewWillDisappear(_ animated: Bool) {
|
|
@@ -496,7 +500,7 @@ class SeminarViewController: UIViewController {
|
|
|
guard let blog = streamingData["blog"] as? String else {
|
|
|
return
|
|
|
}
|
|
|
- _ = Nexilis.write(message: CoreMessage_TMessageBank.getStartSeminarInvited(title: title, type: type, typeValue: "", category: "3", blog_id: blog))
|
|
|
+ _ = Nexilis.write(message: CoreMessage_TMessageBank.getStartSeminarInvited(title: "1~\(title)", type: type, typeValue: "", category: "3", blog_id: blog))
|
|
|
}
|
|
|
|
|
|
private func sendJoin() {
|
|
@@ -523,11 +527,9 @@ class SeminarViewController: UIViewController {
|
|
|
}
|
|
|
|
|
|
@objc func showListViewer(sender: Any?){
|
|
|
- guard hasRaiseHand else {
|
|
|
- return
|
|
|
- }
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "seminarListNav") as! UINavigationController
|
|
|
if let vc = controller.viewControllers.first as? SeminarListViewController {
|
|
|
+ vc.data = viewers
|
|
|
vc.makeSpeaker = { viewer in
|
|
|
API.sabc(sAudienceID: viewer.f_pin)
|
|
|
self.viewers.first(where: {$0.f_pin == viewer.f_pin})?.isRaise = false
|
|
@@ -607,6 +609,9 @@ class SeminarViewController: UIViewController {
|
|
|
view.bringSubviewToFront(stack)
|
|
|
view.bringSubviewToFront(statusView)
|
|
|
view.bringSubviewToFront(toolbarView)
|
|
|
+ if isLive {
|
|
|
+ view.bringSubviewToFront(viewCountViewer)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -754,10 +759,12 @@ extension SeminarViewController: SeminarDelegate {
|
|
|
}
|
|
|
}
|
|
|
} else if state == 32 { // initBCA (3* is from Broadcaster PoV)
|
|
|
- tvCameraPreviewB.removeConstraints(tvCameraPreviewB.constraints)
|
|
|
- tvCameraPreviewB.anchor(top: view.topAnchor, left: view.leftAnchor, bottom: view.bottomAnchor, right: view.rightAnchor)
|
|
|
- view.bringSubviewToFront(tvCameraPreviewB)
|
|
|
- btf()
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ self.tvCameraPreviewB.removeConstraints(self.tvCameraPreviewB.constraints)
|
|
|
+ self.tvCameraPreviewB.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, bottom: self.view.bottomAnchor, right: self.view.rightAnchor)
|
|
|
+ self.view.bringSubviewToFront(self.tvCameraPreviewB)
|
|
|
+ self.btf()
|
|
|
+ }
|
|
|
} else if state == 33 { // startAudience (3* is from Broadcaster PoV)
|
|
|
let m = message.split(separator: ",")
|
|
|
let f_pin = m[0]
|
|
@@ -772,7 +779,9 @@ extension SeminarViewController: SeminarDelegate {
|
|
|
viewers.first(where: {$0.f_pin == currentSpeakingBC})?.isSpeak = false
|
|
|
}
|
|
|
if currentSpeakingBC != f_pin {
|
|
|
- forceRevertSwitch()
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ self.forceRevertSwitch()
|
|
|
+ }
|
|
|
}
|
|
|
viewers.first(where: {$0.f_pin == currentSpeakingBC})?.isRaise = false
|
|
|
viewers.first(where: {$0.f_pin == currentSpeakingBC})?.isSpeak = true
|
|
@@ -782,7 +791,9 @@ extension SeminarViewController: SeminarDelegate {
|
|
|
let m = message.split(separator: ",")
|
|
|
let f_pin = m[0]
|
|
|
if currentSpeakingBC == f_pin {
|
|
|
- forceRevertSwitch()
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ self.forceRevertSwitch()
|
|
|
+ }
|
|
|
currentSpeakingBC = "-666"
|
|
|
}
|
|
|
DispatchQueue.main.async {
|
|
@@ -804,78 +815,82 @@ extension SeminarViewController: SeminarDelegate {
|
|
|
} else if state == 42 { // joinBC (4* is from Audience PoV)
|
|
|
let m = message.split(separator: ",")
|
|
|
let camera = Int(m[2])
|
|
|
- let x = m[5]
|
|
|
- let camera2 = Int(m[6])
|
|
|
+ var x = "NONE"
|
|
|
+ if m.indices.contains(5){
|
|
|
+ x = String(m[5])
|
|
|
+ }
|
|
|
let rotation = camera == 1 ? CGFloat.pi * 2.5 : CGFloat.pi * 0.5
|
|
|
+ let rotation2 = -(self.ivSRotation)
|
|
|
DispatchQueue.main.async {
|
|
|
- self.ivRemoteViewM.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9).rotated(by: rotation - self.ivMRotation)
|
|
|
- self.ivMRotation = rotation
|
|
|
+ self.ivRemoteViewM.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9).rotated(by: rotation - self.ivMRotation)
|
|
|
+ self.ivMRotation = rotation
|
|
|
+ self.ivRemoteViewM.removeConstraints(self.ivRemoteViewM.constraints)
|
|
|
+ self.ivRemoteViewM.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, bottom: self.view.bottomAnchor, right: self.view.rightAnchor)
|
|
|
+ self.view.bringSubviewToFront(self.ivRemoteViewM)
|
|
|
+ self.ivRemoteViewS.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9).rotated(by: rotation2)
|
|
|
+ self.ivSRotation = 0
|
|
|
+ if x != "NONE" {
|
|
|
+ let camera2 = Int(m[6])
|
|
|
+ let rotation3 = camera2 == 1 ? CGFloat.pi * 2.5 : CGFloat.pi * 0.5
|
|
|
+ let scaleY = camera2 == 1 ? -1.0 : 1.0
|
|
|
+ self.ivRemoteViewS.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9 * scaleY).rotated(by: rotation3 - self.ivSRotation)
|
|
|
+ self.ivSRotation = rotation3
|
|
|
+ self.view.bringSubviewToFront(self.ivRemoteViewS)
|
|
|
+ }
|
|
|
+ self.btf()
|
|
|
}
|
|
|
- ivRemoteViewM.removeConstraints(ivRemoteViewM.constraints)
|
|
|
- ivRemoteViewM.anchor(top: view.topAnchor, left: view.leftAnchor, bottom: view.bottomAnchor, right: view.rightAnchor)
|
|
|
- view.bringSubviewToFront(ivRemoteViewM)
|
|
|
- DispatchQueue.main.async {
|
|
|
- let rotation = -(self.ivSRotation)
|
|
|
- self.ivRemoteViewS.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9).rotated(by: rotation)
|
|
|
- self.ivSRotation = 0
|
|
|
- }
|
|
|
- if x != "NONE" {
|
|
|
- let rotation2 = camera2 == 1 ? CGFloat.pi * 2.5 : CGFloat.pi * 0.5
|
|
|
- let scaleY = camera2 == 1 ? -1.0 : 1.0
|
|
|
- DispatchQueue.main.async {
|
|
|
- self.ivRemoteViewS.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9 * scaleY).rotated(by: rotation - self.ivSRotation)
|
|
|
- self.ivSRotation = rotation
|
|
|
- }
|
|
|
- view.bringSubviewToFront(ivRemoteViewS)
|
|
|
- }
|
|
|
- btf()
|
|
|
+ sendJoin()
|
|
|
} else if state == 43 { // startAudience (4* is from Audience PoV)
|
|
|
let m = message.split(separator: ",")
|
|
|
let f_pin = String(m[0])
|
|
|
- tvCameraPreviewS.removeConstraints(tvCameraPreviewS.constraints)
|
|
|
- tvCameraPreviewS.anchor(top: view.topAnchor, left: view.leftAnchor, bottom: view.bottomAnchor, right: view.rightAnchor)
|
|
|
- currentSpeakingVW = f_pin
|
|
|
let me = UserDefaults.standard.string(forKey: "me")
|
|
|
- if currentSpeakingVW == me {
|
|
|
- hasRaiseHand = false
|
|
|
- switchRaiseHand(raiseHand: false)
|
|
|
- }
|
|
|
- else {
|
|
|
- switchRaiseHand(raiseHand: true)
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ self.tvCameraPreviewS.removeConstraints(self.tvCameraPreviewS.constraints)
|
|
|
+ self.tvCameraPreviewS.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, bottom: self.view.bottomAnchor, right: self.view.rightAnchor)
|
|
|
+ self.currentSpeakingVW = f_pin
|
|
|
+
|
|
|
+ if self.currentSpeakingVW == me {
|
|
|
+ self.hasRaiseHand = false
|
|
|
+ self.switchRaiseHand(raiseHand: false)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ self.switchRaiseHand(raiseHand: true)
|
|
|
+ }
|
|
|
+ // TODO: set whiteboard can draw here
|
|
|
}
|
|
|
- // TODO: set whiteboard can draw here
|
|
|
} else if state == 44 { // endAudience (4* is from Audience PoV)
|
|
|
let m = message.split(separator: ",")
|
|
|
let f_pin = String(m[0])
|
|
|
let camera = Int(m[1])
|
|
|
+ let rotation = camera == 1 ? CGFloat.pi * 2.5 : CGFloat.pi * 0.5
|
|
|
+ let scaleY = camera == 1 ? -1.0 : 1.0
|
|
|
+ let rotation2 = -(self.ivSRotation)
|
|
|
if f_pin != "NONE" {
|
|
|
- if mIsSwitch {
|
|
|
- forceRevertSwitch()
|
|
|
- }
|
|
|
- currentSpeakingVW = f_pin
|
|
|
- let rotation = camera == 1 ? CGFloat.pi * 2.5 : CGFloat.pi * 0.5
|
|
|
- let scaleY = camera == 1 ? -1.0 : 1.0
|
|
|
DispatchQueue.main.async {
|
|
|
+ if self.mIsSwitch {
|
|
|
+ self.forceRevertSwitch()
|
|
|
+ }
|
|
|
+ self.currentSpeakingVW = f_pin
|
|
|
self.ivRemoteViewS.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9 * scaleY).rotated(by: rotation - self.ivSRotation)
|
|
|
self.ivSRotation = rotation
|
|
|
+ self.view.bringSubviewToFront(self.ivRemoteViewS)
|
|
|
}
|
|
|
- view.bringSubviewToFront(ivRemoteViewS)
|
|
|
} else {
|
|
|
- if mIsSwitch {
|
|
|
- forceRevertSwitch()
|
|
|
- }
|
|
|
- let me = UserDefaults.standard.string(forKey: "me")
|
|
|
- if me == f_pin {
|
|
|
- currentSpeakingVW = "-666"
|
|
|
- }
|
|
|
DispatchQueue.main.async {
|
|
|
- let rotation = -(self.ivSRotation)
|
|
|
- self.ivRemoteViewS.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9).rotated(by: rotation)
|
|
|
+ if self.mIsSwitch {
|
|
|
+ self.forceRevertSwitch()
|
|
|
+ }
|
|
|
+ let me = UserDefaults.standard.string(forKey: "me")
|
|
|
+ if me == f_pin {
|
|
|
+ self.currentSpeakingVW = "-666"
|
|
|
+ }
|
|
|
+ self.ivRemoteViewS.transform = CGAffineTransform.init(scaleX: 1.9, y: 1.9).rotated(by: rotation2)
|
|
|
self.ivSRotation = 0
|
|
|
+
|
|
|
+ self.hasRaiseHand = false
|
|
|
+ self.switchRaiseHand(raiseHand: true)
|
|
|
+ // TODO: set whiteboard can draw here
|
|
|
}
|
|
|
- hasRaiseHand = false
|
|
|
- switchRaiseHand(raiseHand: true)
|
|
|
- // TODO: set whiteboard can draw here
|
|
|
}
|
|
|
} else if state == 45 { // CCPb Br.ID Br.Title Br.CameraID Br.OS : (4* is from Audience PoV) broadcaster change camera
|
|
|
let m = message.split(separator: ",")
|