void StartSignalingIfReady() { if (!_isTurnComplete || !_isRegisteredWithRoomServer) { return; } SetState(ARDAppClientState.Connected); RTCMediaConstraints constrains = DefaultPeerConnectionConstraints(); _peerConnection = _factory.PeerConnectionWithICEServers(_iceServers, constrains, this); RTCMediaStream localStream = CreateLocalMediaStream(); _peerConnection.AddStream(localStream); if (_isInitiator) { SendOffer(); } else { WaitForAnswer(); } }
public IPeerConnection PeerConnectionWithConfiguration(Core.RTCConfiguration configuration, MediaConstraints constraints, IPeerConnectionDelegate peerConnectionDelegate) { var _configuration = configuration.ToPlatformNative(); var _constraints = new RTCMediaConstraints(null, new NSDictionary <NSString, NSString>(new NSString("DtlsSrtpKeyAgreement"), new NSString(configuration.EnableDtlsSrtp ? "false" : "true"))); var _peerConnection = _peerConnectionFactory.PeerConnectionWithConfiguration(_configuration, _constraints, new PlatformPeerConnectionDelegate(peerConnectionDelegate)); return(_peerConnection == null ? null : new PlatformPeerConnection(_peerConnection, configuration, this)); }
public IPeerConnection CreatePeerConnection(Abstraction.RTCConfiguration configuration, IPeerConnectionListener peerConnectionListener) { var rtcConfiguration = configuration.ToNative(); var constraints = new RTCMediaConstraints(null, new NSDictionary <NSString, NSString>(new NSString("DtlsSrtpKeyAgreement"), new NSString(configuration.EnableDtlsSrtp ? "false" : "true"))); var peerConnectionDelegate = new PeerConnectionListenerProxy(peerConnectionListener); var peerConnection = _factory.PeerConnectionWithConfiguration(rtcConfiguration, constraints, peerConnectionDelegate); return(peerConnection == null ? null : new PeerConnectionNative(peerConnection, configuration, this, peerConnectionDelegate)); }
public void DidSetSessionDescriptionWithError(RTCPeerConnection peerConnection, NSError error) { // dispatch_async(dispatch_get_main_queue(), if (error != null) { System.Diagnostics.Debug.WriteLine($"Failed to set session description. Error: {error}"); Disconnect(); // NSDictionary *userInfo = @{ // NSLocalizedDescriptionKey: @"Failed to create session description.", // }; // NSError *sdpError = // [[NSError alloc] initWithDomain:kARDAppClientErrorDomain // code:kARDAppClientErrorCreateSDP // userInfo:userInfo]; _delegate.DidError(this, error); return; } if (!_isInitiator && _peerConnection.LocalDescription == null) { RTCMediaConstraints constraints = DefaultAnswerConstraints(); _peerConnection.CreateAnswerWithDelegate(this, constraints); } }
public static Core.MediaConstraints ToNativePort(this RTCMediaConstraints platformNative) => platformNative.ToNativePort();