Exemplo n.º 1
0
        public BrowserMediaNetwork(NetworkConfig lNetConfig)
        {
            if (lNetConfig.AllowRenegotiation)
            {
                SLog.LW("NetworkConfig.AllowRenegotiation is set to true. This is not supported in the browser version yet! Flag ignored.", this.GetType().Name);
            }
            string signalingUrl = lNetConfig.SignalingUrl;

            IceServer[] iceServers = null;
            if (lNetConfig.IceServers != null)
            {
                iceServers = lNetConfig.IceServers.ToArray();
            }


            //TODO: change this to avoid the use of json

            StringBuilder iceServersJson = new StringBuilder();

            BrowserWebRtcNetwork.IceServersToJson(iceServers, iceServersJson);

            /*
             * Example:
             * {"{IceServers":[{"urls":["turn:because-why-not.com:12779"],"username":"******","credential":"testpassword"},{"urls":["stun:stun.l.google.com:19302"],"username":"","credential":""}], "SignalingUrl":"ws://because-why-not.com:12776/callapp", "IsConference":"False"}
             */

            string conf = "{\"IceServers\":" + iceServersJson.ToString() + ", \"SignalingUrl\":\"" + signalingUrl + "\", \"IsConference\":\"" + false + "\"}";

            SLog.L("Creating BrowserMediaNetwork config: " + conf, this.GetType().Name);
            mReference = UnityMediaNetwork_Create(conf);
        }