2016-10-01 9 views
0

サンプルアプリケーションでoovoo sdkを実装しようとしています。ビデオの送信は正常に動作していますが、ooVooAVChatdelegateのDelegateメソッドは呼び出されていません。私は何が問題なのか分かりません。どのようなヘルプがありがとうございます。ooVooAVChatDelegateは参加者が迅速に参加するときに呼び出されません

以下のコードスニペットをご覧ください。ありがとう!!!!参加者が参加しているときはいつでも

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() { 

} 

} 

、それはdidParticipantJoinを呼び出す必要がありますが、それはooVooAVChatDelegateの任意のメソッドを呼び出していません。

助けてください!

答えて

0

ここに示すObjective-CライブラリとSwiftの間にブリッジヘッダーを作成しましたか? https://github.com/eranmalovany/Documentation-1/blob/master/iOS%20Documentation/Swift%20Integration%20Guide.md

**編集** ここで使用したコードはdidParticipantJoinデリゲートをトリガーできました。それを実行するときは、アプリケーショントークンを追加して、承認とログインの手順が成功していることを確認してください。私はその後、ooVoo SDKに含まれているサンプルアプリを実行しました。サンプルアプリケーションが実行されると、ユーザーIDと表示名が設定され、ログインします。そこから、 "会議室ID"として123456と入力し、参加をクリックします。しばらく待つと、didParticipantJoinデリゲートがアプリで起動するはずです。

import UIKit 

class ViewController: UIViewController, ooVooAVChatDelegate, ooVooVideoControllerDelegate, ooVooAudioControllerDelegate { 

    var oovoo:ooVooClient! 
    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() 
    self.oovoo = ooVooClient.sharedInstance() 
    authorize() 
    } 

    override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
    } 

    func authorize() 
    { 
    oovoo.authorizeClient("Your App Token", 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("UserName", completion: { (result:SdkResult!) -> Void in 
     if result.Result == sdk_error.OK 
     { 

     NSLog("login ok"); 
     self.actJoin() 

     } 
     else 
     { 
     NSLog("login failed"); 

     } 

    }) 

    } 

    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.openCamera(); 
    self.oovoo.AVChat.VideoController.startTransmitVideo() 

    self.oovoo.AVChat.join("123456", user_data: "UserId"); 
} 

    /** 
    * listener method is being called when audio unhold. 
    */ 
    func didAudioUnHold() { 

    } 

    /** 
    * listener method is being called when audio hold. 
    */ 
    func didAudioHold() { 

    } 

    /** 
    * listener method is being called when audio receive state was changed. 
    * @param state - new audio receive state (ON/OFF). 
    * @param errorCode - conference error code. 
    */ 
    func didAudioReceiveStateChange(state: Bool, error code: sdk_error) { 

    } 

    /** 
    * listener method is being called when audio transmit state was changed. 
    * @param state - new audio transmit state (ON/OFF). 
    * @param errorCode - conference error code. 
    */ 
    func didAudioTransmitStateChange(state: Bool, error code: sdk_error) { 

    } 

    /** 
    * listener method is being called when preview video state was changed. 
    * @param state - new preview video state (ON/OFF). 
    * @param errorCode - conference error code. 
    */ 
    func didVideoPreviewStateChange(state: Bool, devId: String!, error code: sdk_error) { 

    } 

    /** 
    * listener method is being called when video transmit state was changed. 
    * @param state - new video transmit state (ON/OFF). 
    * @param errorCode - conference error code. 
    */ 
    func didVideoTransmitStateChange(state: Bool, devId: String!, error code: sdk_error) { 

    } 

    /** 
    * listener method is being called when camera state was changed. 
    * @param state - new camera state . 
    * @param errorCode - conference error code. 
    */ 
    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() 
    } 

    /** 
    * listener method is being called when remote video state has changed. 
    * @param uid -user id of remote video. 
    * @param state - new remote video state. 
    * @param width - picture width. 
    * @param height - picture height. 
    * @param errorCode - conference error code. 
    */ 
    func didRemoteVideoStateChange(uid: String!, state: ooVooAVChatRemoteVideoState, width: Int32, height: Int32, error code: sdk_error) { 

    } 

    /** 
    * listener method which indicates if user is in secure mode. 
    * @param score - true for secured otherwise false. 
    */ 
    func didSecurityState(is_secure: Bool) { 

    } 

    /** 
    * listener method is being called when network reilability change. 
    * @param score - a number from 1 - 4 1 indicate that network is worse 4 network is best. 
    */ 
    func didNetworkReliabilityChange(score: NSNumber!) { 

    } 

    /** 
    * listener method is being called when conference error is received. 
    * @param errorCode - conference error code. 
    */ 
    func didConferenceError(code: sdk_error) { 

    } 

    /** 
    * listener method is being called when message is received. 
    * @param uid -user id of remote video. 
    * @param buffer - data which contains the message. 
    * @param size - buffer size. 
    */ 
    internal func didReceiveData(uid: String!, data: NSData!) { 

    } 

    /** 
    * listener method is being called when conference state has changed. 
    * @param state - new conference state. 
    * @param errorCode - conference error code. 
    */ 
    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") 
    } 

    /** 
    * listener method is being called when new participant left conference. 
    * @param uid - user id of participant. 
    */ 
    func didParticipantLeave(participant: ooVooParticipant!) { 

    } 

    /** 
    * listener method is being called when new participant joined conference. 
    * @param uid - user id of new participant. 
    * @param userData - user data. 
    */ 
    func didParticipantJoin(participant: ooVooParticipant!, user_data: String!) { 
    NSLog("Participant Joined!"); 
    } 
} 
+0

私はブリッジヘッダーを作成し、すべての必要な手順を実行しました。私はvideocontrollerにアクセスできますが、oovooavchatdelegateにはアクセスできません。 – Chika

+0

あなたの参加方法に、コードoovoopanel = ooVooVideoPanel.init(frame:self.view.frame) self.view.addSubview(oovoopanel)を2回追加しました。 actJoin()関数のビデオウィンドウの初期化をコメントアウトし、デリゲートが呼び出されているかどうかを調べることはできますか? – BoulderEE

+0

私もそれを試しました。しかし、同じこと。それが可能な場合は、あなたのために働いている場合は、例を使って私を助けることができます。 didparticipantjoinはまったく呼ばれていないので。理由はわかりません。 – Chika

関連する問題