Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should be done in the webrtc callback "- (void)peerConnectionOnRenegotiationNeeded:(RTCPeerConnection *)peerConnection"?

I'm trying to get a webRTC app working on iPad (iOS7). I am at the point where both my devices display local video and one tries to display the remote video (the stream is added), but the remote video screen stays black.
While trying to figure out why my remote video screen is black, I found this callback:

- (void)peerConnectionOnRenegotiationNeeded:(RTCPeerConnection *)peerConnection_ {
    NSLog(@"peerConnectionOnRenegotiationNeeded:(RTCPeerConnection *)%@",peerConnection_);
}

In the appRTC example it is implemented like this:

- (void)peerConnectionOnRenegotiationNeeded:(RTCPeerConnection*)peerConnection {
  dispatch_async(dispatch_get_main_queue(), ^{
    NSLog(@"PCO onRenegotiationNeeded - ignoring because AppRTC has a "
           "predefined negotiation strategy");
  });
}

What should be done when this method is called? I'm asking this because I think I have everything almost the same as the example, only the signaling is different, but it still doesn't work. I think I should maybe do something when this callback fires, because I don't have a "predefined negotiation strategy" like the example.

My environment:

  • Testing on an iPad3 and an iPad4
  • Both run the latest iOS
  • Developing using Xcode Version 5.1.1 (5B1008)
  • I have my own signaling server
  • I have not set a stun server, as I'm still testing on LAN
  • I tried setting a stun server, but that made no difference
like image 298
Kevin Avatar asked Aug 21 '14 07:08

Kevin


2 Answers

Turns out I just have to recreate the sdp and send it, I got audio working now.

like image 129
Kevin Avatar answered Nov 20 '22 21:11

Kevin


Although the post is fairly old, the cause of the black screen might not have anything to do with Peer renegotiation.

Personally, I found that the remote feed wasn't being displayed on my device (audio only) because I didn't make a strong reference to the RTCVideoTrack or RTCMediaStream objects, which meant the video track was being dropped whenever I tried to utilise it.

@property (nonatomic, strong) RTCMediaStream *remoteStream;
@property (nonatomic, strong) RTCVideoTrack *remoteVideoTrack;

By having these properties in a subclassed RTCPeerConnection object, and sending the object to my view controller via delegate call when the WebRTC connection has been established, I'm easily able to reference the video track and set a renderer for the video & audio data.

like image 1
Andy Shephard Avatar answered Nov 20 '22 20:11

Andy Shephard