public static PeerConnection.PeerConnectionState ToNative(this PeerConnectionState self) { switch (self) { case PeerConnectionState.New: return(PeerConnection.PeerConnectionState.New); case PeerConnectionState.Connecting: return(PeerConnection.PeerConnectionState.Connecting); case PeerConnectionState.Connected: return(PeerConnection.PeerConnectionState.Connected); case PeerConnectionState.Disconnected: return(PeerConnection.PeerConnectionState.Disconnected); case PeerConnectionState.Failed: return(PeerConnection.PeerConnectionState.Failed); case PeerConnectionState.Closed: return(PeerConnection.PeerConnectionState.Closed); default: throw new ArgumentOutOfRangeException(nameof(self), self, null); } }
public void Disconnect() { if (m_remoteID != 0) { Net.Close(m_remoteID); m_remoteID = 0; m_state = PeerConnectionState.Unknown; } }
public void Disconnect() { if (m_remoteID != 0) { Voip.Stop(m_remoteID); Object.Destroy(m_remoteHead.GetComponent <VoipAudioSourceHiLevel>(), 0); m_remoteID = 0; m_state = PeerConnectionState.Unknown; } }
void VoipStateChangedCallback(Message <NetworkingPeer> msg) { Debug.LogFormat("Voip state to {0} changed to {1}", msg.Data.ID, msg.Data.State); if (msg.Data.ID == m_remoteID) { m_state = msg.Data.State; if (m_state == PeerConnectionState.Timeout && // ID comparison is used to decide who initiates and who gets the Callback PlatformManager.MyID < m_remoteID) { // keep trying until hangup! Voip.Start(m_remoteID); } } PlatformManager.SetBackgroundColorForState(); }
void ConnectionStateChangedCallback(Message <NetworkingPeer> msg) { Debug.LogFormat("Connection state to {0} changed to {1}", msg.Data.ID, msg.Data.State); if (msg.Data.ID == m_remoteID) { m_state = msg.Data.State; if (m_state == PeerConnectionState.Timeout && // ID comparison is used to decide who calls Connect and who calls Accept PlatformManager.MyID < m_remoteID) { // keep trying until hangup! Net.Connect(m_remoteID); } } PlatformManager.SetBackgroundColorForState(); }
PeerConnectionState EnsurePeerConnectionReported(string peerConnectionId, Message trigger, Queue <Event> buffer) { PeerConnectionState state; if (reportedPeerConnection.TryGetValue(peerConnectionId, out state)) { return(state); } state = new PeerConnectionState() { ObjectId = peerConnectionId, ConnsRootObjectId = peerConnectionId + ".Connections", CandidatesRootObjectId = peerConnectionId + ".Candidates", StreamsRootObjectId = peerConnectionId + ".Streams", ChannelsRootObjectId = peerConnectionId + ".Channels", TracksRootObjectId = peerConnectionId + ".Tracks", CertsRootObjectId = peerConnectionId + ".Certs", DataChannelsRootObjectId = peerConnectionId + ".DataChannels", SourcesRootObjectId = peerConnectionId + ".Sources", }; reportedPeerConnection.Add(peerConnectionId, state); buffer.Enqueue(new ObjectCreation(trigger, peerConnectionId, peerConnectionTypeInfo)); buffer.Enqueue(new ParentChildRelationChange(trigger, peerConnectionId, peerConnectionTypeInfo, peerConnectionsRootObjectId)); Action <ObjectTypeInfo, string, string> reportCategoryRoot = (typeInfo, objId, displayName) => { buffer.Enqueue(new ObjectCreation(trigger, objId, typeInfo, displayName: displayName)); buffer.Enqueue(new ParentChildRelationChange(trigger, objId, typeInfo, state.ObjectId)); }; reportCategoryRoot(connectionsRootTypeInfo, state.ConnsRootObjectId, "Connections"); reportCategoryRoot(ssrcsRootTypeInfo, state.StreamsRootObjectId, "Streams"); reportCategoryRoot(candidatesRootTypeInfo, state.CandidatesRootObjectId, "Candidates"); reportCategoryRoot(channelsRootTypeInfo, state.ChannelsRootObjectId, "Channels"); reportCategoryRoot(tracksRootTypeInfo, state.TracksRootObjectId, "Tracks"); reportCategoryRoot(certsRootTypeInfo, state.CertsRootObjectId, "Certificates"); reportCategoryRoot(dataChannelsRootTypeInfo, state.DataChannelsRootObjectId, "Data channels"); reportCategoryRoot(mediaSourcesRootTypeInfo, state.SourcesRootObjectId, "Media sources"); return(state); }
public void OnConnectionChange(PeerConnectionState newState) { _executor.Execute(() => { _logger.Debug(TAG, $"PeerConnectionState: {newState}"); switch (newState) { case PeerConnectionState.Connected: _events.OnConnected(); break; case PeerConnectionState.Disconnected: _events.OnDisconnected(); break; case PeerConnectionState.Failed: _peerConnectionClient.ReportError("DTLS connection failed."); break; } }); }
public static RTCPeerConnectionState ToPlatformNative(this PeerConnectionState nativePort) => (RTCPeerConnectionState)nativePort;
public NetworkingPeer(UInt64 id, PeerConnectionState state) { ID = id; State = state; }
public static RTCPeerConnectionState ToNative(this PeerConnectionState self) { return((RTCPeerConnectionState)self); }