我正在尝试使用QuickBlox-WebRTC创建一个带有视频聊天的iOS应用程序。
我的控制器是一个QBRTCClientDelegate
,一切似乎都很“好”。命中以下调用(不按顺序):
didReceiveNewSession
initializedLocalMediaStream
receivedRemoteVideoTrack
acceptedByUser
但遗憾的是,startedConnectingToUser
和connectedToUser
从未发生过。
在来电方面,我在日志中看到以下内容:
2016-02-09 23:28:38:105 TestProject[1194:4052297] rtc::Did receive signal: accept from: 8760016
2016-02-09 23:28:38:158 TestProject[1194:4052328] rtc::Did receive signal: iceCandidates from: 8760016
2016-02-09 23:28:38:259 TestProject[1194:4052295] rtc::Did receive signal: iceCandidates from: 8760016
2016-02-09 23:28:38:262 TestProject[1194:4052295] rtc::Did receive signal: iceCandidates from: 8760016
2016-02-09 23:28:38:318 TestProject[1194:4052295] rtc::Did receive signal: iceCandidates from: 8760016
2016-02-09 23:28:38:412 TestProject[1194:4052327] rtc::Did receive signal: iceCandidates from: 8760016
2016-02-09 23:28:40:878 TestProject[1194:4052297] rtc::<Peer:0x155793250, UID:8760016, r:Offer> Send local offer sdp
2016-02-09 23:28:45:839 TestProject[1194:4052297] rtc::<Peer:0x155793250, UID:8760016, r:Offer> Send local offer sdp
2016-02-09 23:28:50:876 TestProject[1194:4052299] rtc::<Peer:0x155793250, UID:8760016, r:Offer> Send local offer sdp
2016-02-09 23:28:55:865 TestProject[1194:4052297] rtc::Close connection for user 8760016
2016-02-09 23:28:55:866 TestProject[1194:4052297] rtc::Invalidate timer:dialing timer, background task id 5 ...
2016-02-09 23:28:55:874 TestProject[1194:4052308] rtc::<Peer:0x155793250, UID:8760016, r:Offer> Renegotiation needed
2016-02-09 23:28:55:876 TestProject[1194:4052297] rtc::<Peer:0x155793250, UID:8760016, r:Offer> Remove local media stream: [com.quickblox.mediastream.device-iphone.6.plus_ios-9.2.1_userid-8762474]:A=1:V=1]
2016-02-09 23:28:55.897 TestProject[1194:4052297] dealloc QBRTCLocalAudioTrack
2016-02-09 23:28:55:896 TestProject[1194:4052297] rtc::<Peer:0x155793250, UID:8760016, r:Offer> Ice connection change:Closed
2016-02-09 23:28:55.897 TestProject[1194:4052297] dealloc QBRTCLocalVideoTrack
2016-02-09 23:28:55:898 TestProject[1194:4052307] rtc::Stop rtc video capturer
2016-02-09 23:28:55.902 TestProject[1194:4052297] Destroy local media stream
2016-02-09 23:28:55:902 TestProject[1194:4052297] rtc::<Peer:0x155793250, UID:8760016, r:Offer> Signaling state changed: Closed
2016-02-09 23:28:55:902 TestProject[1194:4052297] rtc::Destroy dialing timer
在被叫方方面,我看到以下内容:
2016-02-09 23:28:36:418 TestProject[97959:2233683] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Signaling state changed: Stable
2016-02-09 23:28:36:418 TestProject[97959:2233683] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Send queued ICE candidates, count: 0
2016-02-09 23:28:37:500 TestProject[97959:2233685] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> ICE gathering changed: Gathering
2016-02-09 23:28:37:500 TestProject[97959:2234170] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Set session description
2016-02-09 23:28:37:500 TestProject[97959:2234170] rtc::Send Answer: <Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer>
2016-02-09 23:28:37:500 TestProject[97959:2234170] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Queued ICE candidates, count: 0
2016-02-09 23:28:37:500 TestProject[97959:2234170] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Send queued ICE candidates, count: 1
2016-02-09 23:28:37:612 TestProject[97959:2234066] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Queued ICE candidates, count: 0
2016-02-09 23:28:37:613 TestProject[97959:2234066] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Send queued ICE candidates, count: 1
2016-02-09 23:28:37:706 TestProject[97959:2234170] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Queued ICE candidates, count: 0
2016-02-09 23:28:37:706 TestProject[97959:2234170] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Send queued ICE candidates, count: 1
2016-02-09 23:28:37:881 TestProject[97959:2234173] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Queued ICE candidates, count: 0
2016-02-09 23:28:37:881 TestProject[97959:2234173] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Send queued ICE candidates, count: 1
2016-02-09 23:28:38:131 TestProject[97959:2233685] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> ICE gathering changed: Complete
2016-02-09 23:28:38:132 TestProject[97959:2234172] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Queued ICE candidates, count: 0
2016-02-09 23:28:38:132 TestProject[97959:2234172] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Send queued ICE candidates, count: 1
2016-02-09 23:28:41:914 TestProject[97959:2234172] rtc::Did receive signal: call from: 8762474
2016-02-09 23:28:41:914 TestProject[97959:2234172] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Queued Remote SDP
2016-02-09 23:28:46:708 TestProject[97959:2234172] rtc::Did receive signal: call from: 8762474
2016-02-09 23:28:46:709 TestProject[97959:2234170] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Queued Remote SDP
2016-02-09 23:28:51:891 TestProject[97959:2234170] rtc::Did receive signal: call from: 8762474
2016-02-09 23:28:51:891 TestProject[97959:2233683] rtc::<Peer:0x7fbbe3b54cb0, UID:8762474, r:Answer> Queued Remote SDP
...它重复最后两行。
我已经检查了它在示例应用程序中是如何发生的,而且当发生以下情况时,我的应用程序似乎永远不会出现:
2016-02-09 12:48:49:006 sample-videochat-webrtc[278:20551] rtc::Did receive signal: iceCandidates from: 2436266
2016-02-09 12:48:49:007 sample-videochat-webrtc[278:19893] rtc::<Peer:0x1477ec80, UID:2436266, r:Answer> Set remote ICE candidates, count: 20
2016-02-09 12:48:50:921 sample-videochat-webrtc[278:20551] rtc::<Peer:0x1477ec80, UID:2436266, r:Answer> Ice connection change:Connected
我在这里缺少什么?比较我的实现和样本,我没有注意到太多差异。
答案 0 :(得分:1)
事实证明这是一个与语法相关的简单错误。在创建会话时,我使用过:
QBRTCSession *newSession = [QBRTCClient.instance
createNewSessionWithOpponents:@[receipientStr]
withConferenceType:QBRTCConferenceTypeVideo];
但正确的语法是
QBRTCSession *newSession = [QBRTCClient.instance
createNewSessionWithOpponents:@[@(receipientStr.intValue)]
withConferenceType:QBRTCConferenceTypeVideo];
通过此修改,视频现已完全正常工作。