示例#1
0
 void  RecieveSDP(Action <RTCSessionDescription> act)
 {
     _signalingNCMB.FetchObject((obj) => {
         string json = NCMB_RTC.GetJson_SDPData(obj, _IsOffer);
         var data    = JsonConverter.FromJson <RTCSendData>(json);
         var result  = new RTCSessionDescription();
         result.type = (_IsOffer) ? RTCSdpType.Answer : RTCSdpType.Offer;
         result.sdp  = data._sdp;
         act.Invoke(result);
     });
 }
示例#2
0
 void RecieveIceCandidate()
 {
     _signalingNCMB.FetchObject((obj) =>
     {
         var json      = NCMB_RTC.GetJson_SDPData(obj, _IsOffer);
         var data      = JsonConverter.FromJson <RTCSendData>(json);
         var remoteICE = new List <RTCIceCandidate>();
         foreach (var target in data.candidateJson)
         {
             remoteICE.Add(JsonConverter.FromJson <RTCIceCandidate>(target));
         }
         remoteICE.ForEach(x => localConnection.AddIceCandidate(ref x));
         Debug.Log($"recieveJson {gameObject.name}");
     });
 }
示例#3
0
    void SendIceCandidata(List <string> jsonlist)
    {
        _signalingNCMB.FetchObject((obj) =>
        {
            var json           = NCMB_RTC.GetJson_SDPData(obj, _IsOffer);
            var data           = JsonConverter.FromJson <RTCSendData>(json);
            data.candidateJson = jsonlist;
            json           = JsonConverter.ToJson(data);
            var json_state = (_IsOffer) ? JsonConverter.ToJson(new NCMBStateData(NCMBStateData.MyNCMBstate.CONNECTED_sdp))
                                        : JsonConverter.ToJson(new NCMBStateData(NCMBStateData.MyNCMBstate.SENDED_ice));
            var saveobj = NCMB_RTC.SetJson_SDPData(obj, _IsOffer, json);
            saveobj     = NCMB_RTC.SetJson_connectState(saveobj, json_state);

            _signalingNCMB.UpdateObject(saveobj);
            Debug.Log($"sendJson");
        });
    }