[Webkit-unassigned] [Bug 180522] New: Can't analyse local MediaStream input audio level using webkitAudioContext on iOS
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 6 22:41:06 PST 2017
https://bugs.webkit.org/show_bug.cgi?id=180522
Bug ID: 180522
Summary: Can't analyse local MediaStream input audio level
using webkitAudioContext on iOS
Product: WebKit
Version: Safari 11
Hardware: iPhone / iPad
OS: iOS 11
Status: NEW
Severity: Normal
Priority: P2
Component: WebRTC
Assignee: webkit-unassigned at lists.webkit.org
Reporter: adam at tokbox.com
CC: youennf at gmail.com
We use the following code to analyse the audio input level in a local MediaStream coming from getUserMedia. This works fine in Safari on a Mac but on iOS you get constant 0 (because timeDomainData[idx] always returns 128).
navigator.mediaDevices.getUserMedia({audio:true}).then(stream => {
const context = new (window.AudioContext || window.webkitAudioContext)();
const sourceNode = context.createMediaStreamSource(stream);
const analyser = context.createAnalyser();
sourceNode.connect(analyser);
const timeDomainData = new Uint8Array(analyser.frequencyBinCount);
setInterval(() => {
analyser.getByteTimeDomainData(timeDomainData);
let max = 0;
for (let idx = 0; idx < timeDomainData.length; idx++) {
max = Math.max(max, Math.abs(timeDomainData[idx] - 128));
}
audioLevel.innerHTML = (max / 128);
}, 100);
}).catch(err => {
alert(err.name + ' ' + err.message);
});
You can see it working at https://output.jsbin.com/rexolan
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171207/4e0a241d/attachment-0001.html>
More information about the webkit-unassigned
mailing list