никогда не называется
аюсь получить звук захвата с микрофона, работающего в Safari на iOS11после того, как поддержка была недавно добавлена
Однакоonaudioprocess
обратный вызов никогда не вызывается. Вот пример страницы:
<html>
<body>
<button onclick="doIt()">DoIt</button>
<ul id="logMessages">
</ul>
<script>
function debug(msg) {
if (typeof msg !== 'undefined') {
var logList = document.getElementById('logMessages');
var newLogItem = document.createElement('li');
if (typeof msg === 'function') {
msg = Function.prototype.toString(msg);
} else if (typeof msg !== 'string') {
msg = JSON.stringify(msg);
}
var newLogText = document.createTextNode(msg);
newLogItem.appendChild(newLogText);
logList.appendChild(newLogItem);
}
}
function doIt() {
var handleSuccess = function (stream) {
var context = new AudioContext();
var input = context.createMediaStreamSource(stream)
var processor = context.createScriptProcessor(1024, 1, 1);
input.connect(processor);
processor.connect(context.destination);
processor.onaudioprocess = function (e) {
// Do something with the data, i.e Convert this to WAV
debug(e.inputBuffer);
};
};
navigator.mediaDevices.getUserMedia({audio: true, video: false})
.then(handleSuccess);
}
</script>
</body>
</html>
На большинстве платформ вы увидите элементы, добавляемые в список сообщений какonaudioprocess
обратный вызов называется. Однако на iOS этот обратный вызов никогда не вызывается.
Есть ли что-то еще, что я должен сделать, чтобы попытаться вызвать его на iOS 11 с Safari?