public bool ReciveRemoteConnection(string machineId, SdpInfo remoteOfferInfo) { this.remoteMachine = MachineLogic.GetMachineById(machineId); this.InitlizeConnetion(); var answerInfo = this.PeerConnection.SetRemoteDescription(remoteOfferInfo.sdp, remoteOfferInfo.type).Result; if (answerInfo == null) { this.showInfo("流媒体设备启动失败"); return(false); } WebSocketClient.SendMessage(machineId, answerInfo, msgType.client_onCallee_CreateAnswer); return(true); }
/// <summary> /// 主动呼叫 /// </summary> /// <param name="mmachineId"></param> public bool ConnectRemote(string machineId) { this.remoteMachine = MachineLogic.GetMachineById(machineId); if (this.remoteMachine == null) { return(false); } this.InitlizeConnetion(); this.keyMouseChannel = this.PeerConnection.CreateDataChannel(ChannelName.keyMouseChannel.ToString()); this.fileChannel = this.PeerConnection.CreateDataChannel(ChannelName.fileChannel.ToString()); FileChannelMessageDeal.RegisterFileChannel(fileChannel); var offerInfo = this.PeerConnection.CreateOffer().Result; if (offerInfo == null) { this.showInfo("流媒体设备启动失败"); } WebSocketClient.SendMessage(machineId, offerInfo, msgType.client_onCaller_CreateOffer); return(true); }