Advertisement
Guest User

Untitled

a guest
Mar 5th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
  2. // Override point for customization after application launch.
  3.  
  4. QBSettings.setApplicationID(K.quickbloxAppID)
  5. QBSettings.setAuthKey(K.quickbloxAuthKey)
  6. QBSettings.setAuthSecret(K.quickbloxAuthSecret)
  7. QBSettings.setAccountKey(K.quickbloxAccountKey)
  8.  
  9. QBRTCClient.initializeRTC()
  10. return true
  11. }
  12.  
  13. class ViewController: UIViewController, QBRTCClientDelegate {
  14.  
  15. override func viewDidLoad() {
  16. super.viewDidLoad()
  17.  
  18.  
  19. QBRequest.logIn(withUserEmail: "login", password: "password", successBlock: { (res, us) in
  20. print((us?.login)! + " logged in")
  21. }, errorBlock: nil)
  22.  
  23.  
  24. QBRTCClient.instance().add(self)
  25.  
  26.  
  27. }
  28.  
  29.  
  30.  
  31. @IBAction func callClicked(_ sender: Any) {
  32. let IDs: [NSNumber] = [NSNumber(value: 24875869)]
  33.  
  34. let user = QBUUser()
  35. user.login = "login"
  36. user.password = "password"
  37. user.id = (QBSession.current().currentUser?.id)!
  38.  
  39. QBChat.instance().connect(with: user) { (err) in
  40. if err != nil {
  41. print("ERROR")
  42. print(err.debugDescription)
  43. }
  44. let newSession = QBRTCClient.instance().createNewSession(withOpponents: IDs, with: QBRTCConferenceType.video)
  45. let userInfo :[String:String] = ["key":"value"]
  46. newSession.startCall(userInfo)
  47.  
  48. }
  49.  
  50. }
  51.  
  52. func didReceiveNewSession(_ session: QBRTCSession, userInfo: [String : String]? = nil) {
  53. print("Session Received")
  54. }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement