I want to do a live sound analysis on the iPhone. Therefor I use the webkitAudioContext Analyser.
我想在iPhone上进行现场声音分析。因此我使用webkitAudioContext Analyzer。
var ctx = new (window.AudioContext || window.webkitAudioContext);
var audioGoodmorning = new Audio('assets/sounds/greeting.m4a');
var audioSrc = ctx.createMediaElementSource(audioGoodmorning);
var analyser = ctx.createAnalyser();
analyser.fftSize = 32;
audioSrc.connect(analyser);
audioSrc.connect(ctx.destination);
var frequencyData = new Uint8Array(analyser.fftSize);
analyser.getByteFrequencyData(frequencyData);
This works well in Chrome on Mac. It also works on Safari, when adding the Website to the homescreen, with
这适用于Mac上的Chrome。当将网站添加到主屏幕时,它也适用于Safari
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="CHAR">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
It doesn't work on Safari without adding the Site to the homescreen. It doesn't work when using the Site embedded with iOS wkwebview. That is what I want to achieve. When not working, the frequencyData Array is full of zeroes.
如果没有将网站添加到主屏幕,它在Safari上不起作用。使用嵌入iOS wkwebview的网站时,它不起作用。这就是我想要实现的目标。不工作时,frequencyData数组充满零。
Anyone having experienced this kinda issue?
有没有经历过这种问题的人?
Thanks in advance
提前致谢
1 个解决方案
#1
0
Just in case this hasn't been solved yet, according to https://caniuse.com/#search=webaudio Safari still doesn't support createMediaElementSource
, so I think you're out of luck here. Safari's support for the WebAudio API is not great, unfortunately.
如果还没有解决,根据https://caniuse.com/#search=webaudio Safari仍然不支持createMediaElementSource,所以我认为你在这里运气不好。不幸的是,Safari对WebAudio API的支持并不是很好。
#1
0
Just in case this hasn't been solved yet, according to https://caniuse.com/#search=webaudio Safari still doesn't support createMediaElementSource
, so I think you're out of luck here. Safari's support for the WebAudio API is not great, unfortunately.
如果还没有解决,根据https://caniuse.com/#search=webaudio Safari仍然不支持createMediaElementSource,所以我认为你在这里运气不好。不幸的是,Safari对WebAudio API的支持并不是很好。