- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
参见相关问题:Navigator.mediaDevices.getUserMedia not working on iOS 12 Safari
我们正在尝试从用户输入的用户 MediaDevices.getUserMedia 和音频上下文中捕获音频
当用户点击一个按钮时,我们检查可用的设备,然后我们捕获他们的音频流
let enumDevicePromise = navigator.mediaDevices.enumerateDevices()
.then(devices => devices.find(d => d.kind === "audioinput" && d.label !== "" && d.deviceId === "default"))
.catch((error) => {
// handle error
});
this.handleCheckEnumeratedDevices(enumDevicePromise); // capture device in backend
.....
navigator.mediaDevices
.getUserMedia({
audio: true,
video: false,
})
.then(stream => {
let AudioContext = window.AudioContext || window.webkitAudioContext;
if (AudioContext) {
let context = new AudioContext();
let source = context.createMediaStreamSource(stream);
let processor = context.createScriptProcessor(4096, 1, 1);
source.connect(processor);
processor.connect(context.destination);
processor.onaudioprocess = (event) => {
let audioIn = event.inputBuffer.getChannelData(0);
this.sendMessage(this.toInt16(audioIn));
}
} else {
// handle error, ie, Audio Context not supported
}
}).catch((error) => {
// handle error
});
});
这在 Chrome 和 Firefox 上运行良好,但在 Safari 12 上,我们从枚举设备 promise 中得到一个 Null 响应 - 尽管允许麦克风权限 - 因此我们无法捕获音频流
最佳答案
发生这种情况是因为 Mobile Safari 不公开“audioinput”类型的媒体设备。这是一个已知的限制。
关于safari - try catch 音频但 navigator.mediaDevices.enumerateDevices() 在 Safari 12 上为 NULL,即使已授予麦克风权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56047028/
我正在检查Pion Mediadevices并尝试从Windows计算机交叉编译webrtc示例以获取树莓派零。但是,当我尝试构建示例时,我从Windows命令提示符中得到了以下错误: # g
因此,我制作了一个 WebRTC 屏幕共享应用程序作为 Chrome 远程桌面和其他常见远程桌面/游戏流服务的自托管替代方案。 我的困境不是navigator.mediaDevices undefin
我突然得到一个 navigator.MediaDevices.getUserMedia notAllowedError 我不是一个月前。没有代码改变。我正在使用火狐 68.01。当我在 AWS 上运行
有一个我不清楚的情况。 我想要的是:播放音频,音频播放完毕后,开始麦克风录音。 问题:在 FF 和 Chrome 中,代码运行良好。然而,在 Safari 上,当音频停止播放并且麦克风录音功能开始时,
我目前正在开发一个视频聊天项目。它使用navigator.mediaDevies。它工作正常并返回本地主机中的 MediaDevices 对象,但是当我将项目部署到服务器时,它返回未定义。我使用的是谷
我在 Firefox 中收到以下错误(在 Chrome/Edge/Safari 中没有问题): MediaStreamError { name: "AbortError", message: "Sta
背景 我尝试实现此功能的机器包含多个摄像头,我想在代码中选择摄像头。 (所有机器具有相同的硬件) 问题 我试图在请求视频访问之前实现自定义功能,其中我手动设置应该使用哪个设备来防止选择错误的摄像机,但
我目前有一个连续轮询 MediaDevices.enumerateDevices() 的方法,它会返回一组已连接的媒体设备。 let devices = []; function getDevices
我无法同时指定视频质量 和相机朝向 约束。有没有办法结合以下约束条件? { audio: true, video: { width: 1280, height: 720 } } { audio
我正在使用 this code ,但是当它获取源时,高度和宽度由下面代码块中的约束设置,但我想获取视频的实际大小。 navigator.mediaDevices.getUserMedia({
我正在使用这段代码,但是当它获取源代码时,它总是将该窗口移到前面,这有点烦人,但我在这段代码中没有看到任何使其移到前面的选项,所以不确定如何预防。 它将源移到前面,在我的应用程序前面,并将焦点放在那个
我正在尝试构建一个可以捕获用户桌面的网络应用程序。我发现这个 Web api 应该可以完美地完成这项工作,但我似乎无法让它工作。现在,通过启用标志,最新版本的 Edge 和 Chrome 70 都应该
即使我的设备没有连接麦克风,我也想进行 WebRTC 通话并听到声音。我用来加入 VOIP 通话的网络应用程序检测到我没有麦克风,并关闭了音频,因为它假定我想要呼入。 我注意到网络应用程序正在使用 n
我正在为我们的组织开发一个内部网络应用程序。该应用程序将主要(如果不是唯一)在台式机/笔记本电脑上使用。 我需要让用户能够拍摄自己的照片。我关注了 example posted by David Wa
有谁知道使用什么通信标准来检测用于 getUserMedia 的相机硬件? 我推测它是 MTP 或类似的东西,虽然我预计每个浏览器/操作系统的实现都不同,但我已经搜索了两天,但我找不到任何可靠的信息。
我目前正在使用 chrome 开发屏幕捕获功能navigator.mediaDevices.getDisplayMedia我只能打开一个用户选择,用户可以从所有给定的显示媒体中进行选择。有没有办法绕过
我在 Chrome 中用 JavaScript 编写了这段代码: navigator.mediaDevices.enumerateDevices() .then((list) => { c
我正在使用 navigator.mediaDevices.getUserMedia() 创建音频记录应用程序,它会记录我周围的每一个声音,即使是非常安静且距离我 10m 的声音。我不播放这个声音,我只
我试图用 navigator.mediaDevices.getUserMedia 替换已弃用的 navigator.getUserMedia 但在尝试时出现此错误: TypeError: Cannot
使用浏览器 Web API,我想设置 MediaDevices.getUserMedia 约束属性,适合记录音频语音(语音消息),例如设置这些参数: 单声道 16 位 16KHz 这是我的代码:
我是一名优秀的程序员,十分优秀!