我们有一个大型 Web 应用程序,但我们发现它在 iPad 上的 Safari 中无法正常工作。虽然我们有一台 iPad 用于测试,但它似乎无法在 Safari 中看到 JavaScript 错误。Web Inspector 功能似乎需要 Mac,而我们没有。
转到https://desktoplawyer.secureclient.co.uk/dtl/index.cfm?event=base:tryDocument&rapidocsid=5700,单击 Next,单击“England and Wales”,单击 Next:所有其他浏览器现在都会带您到一个页面标题为“初步问题”,但在 iPad 上的 Safari 中,它停留在标题为“住所”的页面上。
我有哪些选择?并且请不要只是告诉我我们必须购买 Mac ;-)
我试图避免在停止振荡器时发出丑陋的"咔哒"声,所以我决定尝试一些淡出效果exponentialRampToValueAtTime.像这样:
var playButton = document.getElementById('play');
var stopButton = document.getElementById('stop');
var context = new AudioContext();
var gainNode = context.createGain();
var oscillator = context.createOscillator();
gainNode.connect(context.destination);
oscillator.connect(gainNode);
gainNode.gain.setValueAtTime(1, context.currentTime);
oscillator.start();
gainNode.gain.exponentialRampToValueAtTime(0.0001, context.currentTime + 1);Run Code Online (Sandbox Code Playgroud)
这很有效,没有"咔嗒"声,而且减速是平滑的.但是,只要我使用按钮和事件监听器这样做,丑陋的点击就会回来,不知何故,斜坡下降更加粗暴
顺便说一句,请在按下"停止"之后等待1秒钟,然后重新按"播放"或丑陋的事情发生:)
var playButton = document.getElementById('play');
var stopButton = document.getElementById('stop');
var context = new AudioContext();
var gainNode = context.createGain();
var oscillator;
gainNode.connect(context.destination);
playButton.addEventListener('click', function() {
oscillator = context.createOscillator();
oscillator.connect(gainNode);
gainNode.gain.setValueAtTime(1, context.currentTime);
oscillator.start();
}, false);
stopButton.addEventListener('click', function() {
gainNode.gain.exponentialRampToValueAtTime(0.0001, context.currentTime + 1);
setTimeout(function(){
oscillator.stop();
}, 1000)
}, false); …Run Code Online (Sandbox Code Playgroud)