gpt4 book ai didi

javascript - 无法通过 https 读取未定义的属性 'getusermedia'

转载 作者:行者123 更新时间:2023-12-05 00:27:13 26 4
gpt4 key购买 nike

我有一个 react 应用程序,它应该从麦克风录制音频并将其发送到后端。
麦克风输入通过 navigator.mediaDevices.getUserMedia 实现。该页面在 localhost 和我的 wifi 网络中的其他设备上完美运行(为此我必须使用 https 启动我的 react 应用程序)。
但是当我用这个网站测试它时:http://appsimulator.net/webapp/?frame=apple_iphone_6_v ,我收到以下错误:TypeError:无法读取未定义的属性“getUserMedia”。
我不知道为什么无法通过此站点测试应用程序。

最佳答案

直接在 MDN documentation for MediaDevices.getUserMedia() 中回答。 :

Note: If the current document isn't loaded securely, navigator.mediaDevices will be undefined, and you cannot use getUserMedia(). See Security for more information on this and other security issues related to using getUserMedia().


AppSimulator.net 没有安全地呈现,所以这个调用总是会以你观察到的方式失败。通过 HTTPS 提供页面。

关于javascript - 无法通过 https 读取未定义的属性 'getusermedia',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67663961/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com