Ejemplo n.º 1
0
        private void Load_1(object sender, EventArgs e)
        {
            string version = ZegoExpressEngine.GetVersion();

            System.Diagnostics.Debug.WriteLine("version:" + version);
            //填写自己申请的appId和appSign
            engine = ZegoExpressEngine.CreateEngine(GetAppIdConfig.appId, GetAppIdConfig.appSign, true, ZegoScenario.General, new SynchronizationContext());
            engine.SetDebugVerbose(true, ZegoLanguage.Chinese);
            engine.onDebugError = (errorCode, funcName, info) =>
            {
                System.Diagnostics.Debug.WriteLine("onDebugError errorCode:" + errorCode + "  funcName:" + funcName + "  info" + info);
            };
            engine.onRoomStateUpdate = (roomId, state, errorCode, extendedData) =>
            {
                System.Diagnostics.Debug.WriteLine("onRoomStateUpdate roomId:" + roomId + "  state:" + state);
            };
            engine.onPublisherStateUpdate = (streamId, state, errorCode, extendedData) =>
            {
                System.Diagnostics.Debug.WriteLine("onPublisherStateUpdate streamId:" + streamId + "  state:" + state + "  errorCode:" + errorCode);
            };
            engine.onPublisherQualityUpdate = (streamId, quality) =>
            {
                System.Diagnostics.Debug.WriteLine("onPublisherQualityUpdate streamId:" + streamId + "  quality:" + quality.quality);
            };
            engine.onPlayerQualityUpdate = (streamId, quality) =>
            {
                System.Diagnostics.Debug.WriteLine("onPlayerQualityUpdate streamId:" + streamId + "  quality:" + quality.quality);
            };
        }
    // Start is called before the first frame update
    void Start()
    {
#if (UNITY_2018_3_OR_NEWER)
        permissionList.Add(Permission.Microphone);
        permissionList.Add(Permission.Camera);
#endif
        info = GameObject.Find("InformationText").GetComponent <Text>();
        if (infos.ContainsKey(sdkVersion))
        {
            infos[sdkVersion] = "SDK Version:" + ZegoExpressEngine.GetVersion() + "\n";
        }
        else
        {
            infos.Add(sdkVersion, "SDK Version:" + ZegoExpressEngine.GetVersion() + "\n");
        }
        NotifyTextDisplay();
    }
 void OnApplicationQuit()
 {//It must be added for unity editor debugging, otherwise it will cause unity to be stuck
     ZegoExpressEngine.DestroyEngine();
 }
 public void DestroyEngine()
 {
     ZegoExpressEngine.DestroyEngine(() => { Debug.Log("destroy engine callback success"); });
 }
 public void CreateEngine()
 {
     engine = ZegoExpressEngine.CreateEngine(GetAppIdConfig.appId, GetAppIdConfig.appSign, true, ZegoScenario.General);
 }