protected void Awake()
        {
            LoadTwitchLibraries();

            m_CoreApi = CoreApi.Instance;

            if (Application.platform == RuntimePlatform.WindowsEditor ||
                Application.platform == RuntimePlatform.WindowsPlayer)
            {
                if (m_CoreApi == null)
                {
                    m_CoreApi = new StandardCoreApi();
                }

                m_UnityBroadcastApi  = new DesktopUnityBroadcastApi();
                m_AudioCaptureMethod = GameAudioCaptureMethod.SystemCapture;
            }
            else if (Application.platform == RuntimePlatform.OSXEditor ||
                     Application.platform == RuntimePlatform.OSXPlayer)
            {
                if (m_CoreApi == null)
                {
                    m_CoreApi = new StandardCoreApi();
                }

                m_UnityBroadcastApi  = new DesktopUnityBroadcastApi();
                m_AudioCaptureMethod = GameAudioCaptureMethod.Passthrough;
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                if (m_CoreApi == null)
                {
                    m_CoreApi = new UnityIosCoreApi();
                }

                m_UnityBroadcastApi  = new UnityIosBroadcastApi();
                m_AudioCaptureMethod = GameAudioCaptureMethod.Passthrough;
            }
            else if (Application.platform == RuntimePlatform.Android)
            {
                // TODO: not supported yet
            }
            else
            {
                // TODO: not supported yet
            }

            m_BroadcastApi = m_UnityBroadcastApi;
        }
        private void Update()
        {
            // Find the UnityBroadcastController
            if (m_BroadcastController == null)
            {
                UnityEngine.Object[] arr = GameObject.FindObjectsOfType(typeof(UnityBroadcastController));
                if (arr != null && arr.Length > 0)
                {
                    m_BroadcastController = arr[0] as UnityBroadcastController;
                    m_Api = m_BroadcastController.UnityBroadcastApi;
                    m_AudioQueue = m_BroadcastController.PassthroughAudioQueue;
                    m_SampleRate = AudioSettings.outputSampleRate;
                    m_UsingPassthroughAudio = m_BroadcastController.AudioCaptureMethod == BroadcastController.GameAudioCaptureMethod.Passthrough;

                    // We don't need to receive samples if the system isn't configured for passthrough
                    if (!m_UsingPassthroughAudio)
                    {
                        // NOTE: There is currently no way to reenable the capturer if the game changes the capture method at runtime but this should never be the case
                        this.enabled = false;
                    }
                }
            }
        }
Example #3
0
        private void Update()
        {
            // Find the UnityBroadcastController
            if (m_BroadcastController == null)
            {
                UnityEngine.Object[] arr = GameObject.FindObjectsOfType(typeof(UnityBroadcastController));
                if (arr != null && arr.Length > 0)
                {
                    m_BroadcastController = arr[0] as UnityBroadcastController;
                    m_Api                   = m_BroadcastController.UnityBroadcastApi;
                    m_AudioQueue            = m_BroadcastController.PassthroughAudioQueue;
                    m_SampleRate            = AudioSettings.outputSampleRate;
                    m_UsingPassthroughAudio = m_BroadcastController.AudioCaptureMethod == BroadcastController.GameAudioCaptureMethod.Passthrough;

                    // We don't need to receive samples if the system isn't configured for passthrough
                    if (!m_UsingPassthroughAudio)
                    {
                        // NOTE: There is currently no way to reenable the capturer if the game changes the capture method at runtime but this should never be the case
                        this.enabled = false;
                    }
                }
            }
        }
        protected void Awake()
        {
            LoadTwitchLibraries();

            m_CoreApi = CoreApi.Instance;

            if (Application.platform == RuntimePlatform.WindowsEditor ||
                Application.platform == RuntimePlatform.WindowsPlayer)
            {
                if (m_CoreApi == null)
                {
                    m_CoreApi = new StandardCoreApi();
                }

                m_UnityBroadcastApi = new DesktopUnityBroadcastApi();
                m_AudioCaptureMethod = GameAudioCaptureMethod.SystemCapture;
            }
            else if (Application.platform == RuntimePlatform.OSXEditor ||
                     Application.platform == RuntimePlatform.OSXPlayer)
            {
                if (m_CoreApi == null)
                {
                    m_CoreApi = new StandardCoreApi();
                }

                m_UnityBroadcastApi = new DesktopUnityBroadcastApi();
                m_AudioCaptureMethod = GameAudioCaptureMethod.Passthrough;
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                if (m_CoreApi == null)
                {
                    m_CoreApi = new UnityIosCoreApi();
                }

                m_UnityBroadcastApi = new UnityIosBroadcastApi();
                m_AudioCaptureMethod = GameAudioCaptureMethod.Passthrough;
            }
            else if (Application.platform == RuntimePlatform.Android)
            {
                // TODO: not supported yet
            }
            else
            {
                // TODO: not supported yet
            }

            m_BroadcastApi = m_UnityBroadcastApi;
        }