/// <summary> /// Initializes the singleton object itself. Will be called after /// the static init completed successfully. /// </summary> private void InitObj() { //TODO: at the moment we are missing the static init process //This should be called right after the all dynamic libraries // / platform specific libraries are loaded but before the // Unity side init if (DEFAULT_LOG_LEVEL != LogLevel.None) { RequestLogLevel(DEFAULT_LOG_LEVEL); } #if UNITY_WEBGL && !UNITY_EDITOR mFactory = new Byn.Awrtc.Browser.BrowserCallFactory(); #elif UNITY_WSA && !UNITY_EDITOR mFactory = new Byn.Awrtc.Uwp.UwpCallFactory(); #else//native platforms only if (NATIVE_VERBOSE_LOG) { Awrtc.Native.NativeAwrtcFactory.SetNativeLogLevel(WebRtcCSharp.LoggingSeverity.LS_INFO); //this will route the log via SLog class to the Unity log. This can cause crashes //and doesn't work on all platforms //Awrtc.Native.NativeWebRtcCallFactory.SetNativeLogToSLog(WebRtcCSharp.LoggingSeverity.LS_NONE); } else { Awrtc.Native.NativeAwrtcFactory.SetNativeLogLevel(WebRtcCSharp.LoggingSeverity.LS_NONE); } var factory = new Awrtc.Native.NativeWebRtcCallFactory(); //old video input system relied on callbacks not supported in IL2CPP if (OBSOLETE_UNITY_CAMERA) { #if ENABLE_IL2CPP Debug.LogWarning(LOG_PREFIX + "UnityVideoCapturerFactory isn't supported with IL2CPP"); #else mVideoFactory = new UnityVideoCapturerFactory(); factory.AddVideoCapturerFactory(mVideoFactory); #endif } factory.LastCallDisposed += LeaveActiveCallState; mFactory = factory; #if UNITY_IOS //workaround for WebRTC / Unity audio bug on ios //WebRTC will deactivate the audio session once all calls ended //This will keep it active as Unity relies on this session as well WebRtcCSharp.IosHelper.InitAudioLayer(); #endif #endif }
/// <summary> /// Initializes the singleton object itself. Will be called after /// the static init completed successfully. /// </summary> private void InitObj() { //TODO: at the moment we are missing the static init process //This should be called right after the all dynamic libraries // / platform specific libraries are loaded but before the // Unity side init if (DEFAULT_LOG_LEVEL != LogLevel.None) { RequestLogLevel(DEFAULT_LOG_LEVEL); } #if UNITY_WEBGL && !UNITY_EDITOR mFactory = new Byn.Awrtc.Browser.BrowserCallFactory(); #elif UNITY_WSA && !UNITY_EDITOR mFactory = new Byn.Awrtc.Uwp.UwpCallFactory(); #else//native platforms only if (NATIVE_VERBOSE_LOG) { Native.NativeAwrtcFactory.SetNativeLogLevel(WebRtcCSharp.LoggingSeverity.LS_INFO); //this will route the log via SLog class to the Unity log. This can cause crashes //and doesn't work on all platforms //Awrtc.Native.NativeWebRtcCallFactory.SetNativeLogToSLog(WebRtcCSharp.LoggingSeverity.LS_NONE); } else { Native.NativeAwrtcFactory.SetNativeLogLevel(WebRtcCSharp.LoggingSeverity.LS_NONE); } //This switches to the old cricket video capturers. They are declared obsolete but //in some cases we might want to still use it: //WebRtcCSharp.RTCPeerConnectionFactory.SetObosoleteVideo(true); var factory = new Native.NativeWebRtcCallFactory(); factory.LastCallDisposed += LeaveActiveCallState; mFactory = factory; #if UNITY_IOS //workaround for WebRTC / Unity audio bug on ios //WebRTC will deactivate the audio session once all calls ended //This will keep it active as Unity relies on this session as well WebRtcCSharp.IosHelper.InitAudioLayer(); WebRtcCSharp.IosHelper.IosKeepAudioActive(true); #endif #endif }