I am working on implementing the oovoo sdk in my sample application. The video transmission is working fine but the Delegate methods of the ooVooAVChatdelegate is not being called. I am not sure what is the issue. Any Help is appreciated.
Please find the below code snippet. Thanks!!!!
import UIKit
class ViewController: UIViewController,ooVooAVChatDelegate,ooVooVideoControllerDelegate,ooVooAudioControllerDelegate {
var oovoo:ooVooClient!
var avchat:ooVooAVChat!
var oovoopanel:ooVooVideoPanel!
var videorender:ooVooVideoRender!
@IBOutlet weak var VideoView: UIView!
@IBAction func Join(sender: UIButton) {
}
@IBOutlet weak var UserName: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
oovoo = ooVooClient.sharedInstance()
authorize()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func authorize()
{
oovoo.authorizeClient("App Token Here", completion: { (result:SdkResult!) -> Void in
let err :sdk_error!=result.Result;
if (err==sdk_error.OK)
{
NSLog("authorization ok");
self.login()
}
else
{
NSLog("fail autorization");
}
});
}
func login()
{
self.oovoo.Account.login("sample", completion: { (result:SdkResult!) -> Void in
if result.Result != sdk_error.OK
{
NSLog("login ok");
self.actJoin()
}
else
{
NSLog("login failed");
}
})
}
// oovooAVChat Delegate
func actJoin(){
oovoo = ooVooClient.sharedInstance()
oovoopanel = ooVooVideoPanel.init(frame: self.view.frame)
self.view.addSubview(oovoopanel)
self.oovoo.AVChat!.delegate=self;
self.oovoo.AVChat.VideoController.delegate = self;
self.oovoo.AVChat.VideoController.bindVideoRender(nil, render: oovoopanel);
self.oovoo.AVChat.VideoController.openCamera();
self.oovoo.AVChat.VideoController.startTransmitVideo()
self.oovoo.AVChat.join("1234", user_data: "bhavin");
}
func didParticipantJoin(participant: ooVooParticipant!, user_data: String!) {
print(participant.participantID)
self.oovoo.AVChat.VideoController.bindVideoRender(participant.participantID, render: oovoopanel)
self.oovoo.AVChat.VideoController.registerRemoteVideo(participant.participantID)
}
func didParticipantLeave(participant: ooVooParticipant!) {
}
func didConferenceStateChange(state: ooVooAVChatState, error code: sdk_error) {
if state == .Joined && code == sdk_error.OK
{
self.oovoo.AVChat.VideoController.openCamera()
}
self.oovoo.AVChat.AudioController.initAudio({ (result:SdkResult!) -> Void in
if result.Result == sdk_error.OK{
self.oovoo.AVChat.AudioController.setPlaybackMute(false)
}
})
print("conference state changed")
}
func didReceiveData(uid: String!, data: NSData!) {
}
func didConferenceError(code: sdk_error) {
print("conference error")
}
func didNetworkReliabilityChange(score: NSNumber!) {
}
func didSecurityState(is_secure: Bool) {
}
// ooVooVideoControllerDelegate
func didRemoteVideoStateChange(uid: String!, state: ooVooAVChatRemoteVideoState, width: Int32, height: Int32, error code: sdk_error) {
}
func didCameraStateChange(state: ooVooDeviceState, devId: String!, width: Int32, height: Int32, fps: Int32, error code: sdk_error) {
self.oovoo.AVChat.VideoController.openPreview()
self.oovoo.AVChat.VideoController.startTransmitVideo()
}
func didVideoTransmitStateChange(state: Bool, devId: String!, error code: sdk_error) {
self.navigationItem.rightBarButtonItem?.title = state ? "Leave" : "Join";
}
func didVideoPreviewStateChange(state: Bool, devId: String!, error code: sdk_error) {
print("VideoPreviewStateChange")
}
func didAudioTransmitStateChange(state: Bool, error code: sdk_error) {
}
func didAudioReceiveStateChange(state: Bool, error code: sdk_error) {
}
func didAudioHold() {
}
func didAudioUnHold() {
}
}
Whenever a participant is joined, it should call didParticipantJoin but it is not calling any method of ooVooAVChatDelegate.
Please help!!!