/// <summary> /// Called via UI /// </summary> public void StartTestButtonPressed() { if (WebRtcNetwork.IsAvailable() == false) { WebRtcNetwork.InjectJsCode(); } //Starts the test after 1 sec waiting to give the java script side of the library //time to download needed libraries //waiting time not needed if everything is included properly in the webgl template/sorrounding website StartCoroutine(CoroutineStartTestDelayed()); }
private void StartTest() { if (WebRtcNetwork.IsAvailable() == false) { Debug.LogWarning("WebRtcNetwork not available. Please run it in WebGL to test WebRtcNetwork!"); } else { Debug.Log("WebRtcNetwork available. Starting test."); mServer = new WebRtcNetwork(); mClient = new WebRtcNetwork(); Debug.Log("Instance created"); mState = State.ServerInit; Debug.Log("Start test " + mState); mServer.StartServer(); } }
void Start() { DebugHelper.ActivateConsole(); if (WebRtcNetwork.IsAvailable() == false) { //if the libray isn't available this could mean the JS part of the library is missing //(wrong template, webrtcnetworplugin.js not included -> try adding it via ExternalEval) Append("Try to initialize WebRTCNetwork"); WebRtcNetwork.InjectJsCode(); } if (WebRtcNetwork.IsAvailable()) { //default version //mNetwork = new WebRtcNetwork(); //custom configuration mNetwork = new WebRtcNetwork(mWebRtcConfig); Append("WebRtcNetwork available"); } else { Append("WebRtcNetwork not available"); if (UnityNetwork.IsAvailable()) { mNetwork = UnityNetwork.Get(); Append("Using unity network instead. TESTING ONLY! You can't connect to browsers."); Append("Build a WebGL example to use WebRTC!"); } else { Append("No network module available. Build and run a WebGL version or switch the platform to Standalone to use the Debugversion."); } } }