首页 > 解决方案 > Unity 中带有 Photon Voice 2 的 Hololens 2018.2.13

问题描述

我对 Hololens 上的 Photon Voice 2 有疑问。我有一个 Unity 2017.4.13 应用程序,可以在设备上正常运行 Photon Voice 2。

但是,当迁移到 Unity 2018.2.13 时,它无法启动麦克风,Microphone.Start我可以通过传递一个空字符串作为麦克风类型来解决此错误,Unity 文档建议将使用默认麦克风,但随后我在设备上遇到异常。

Unable to load DLL webrtc-audio: The specific module could not be found

有其他人在 Unity 2018 或 Photon Voice 2 中遇到过麦克风问题吗?

我应该添加我正在使用 IL2CPP 作为脚本后端,并且在构建设置中启用了麦克风权限。还要澄清从 Unity 2017.4.13 构建时这项工作没有错误。

Microphone.Start 在 Photon Voice 2 库中的 MicWrapper 脚本中调用。

public MicWrapper(string device, int suggestedFrequency)
        {
            if (Microphone.devices.Length < 1)
            {
                return;
            }
            this.device = device;
            int minFreq;
            int maxFreq;
            Microphone.GetDeviceCaps(device, out minFreq, out maxFreq);
            var frequency = suggestedFrequency;
            //        minFreq = maxFreq = 44100; // test like android client
            if (suggestedFrequency < minFreq || maxFreq != 0 && suggestedFrequency > maxFreq)
            {
                Debug.LogWarningFormat("[PV] MicWrapper does not support suggested frequency {0} (min: {1}, max: {2}). Setting to {2}",
                    suggestedFrequency, minFreq, maxFreq);
                frequency = maxFreq;
            }
            this.mic = Microphone.Start(device, true, 1, frequency);
        }

标签: unity3dmicrophonevoicehololensphoton

解决方案


推荐阅读