我正在尝试在 node.js 堆栈之上创建一个使用 Paper.js 构建的简单调谐器。
调谐器在桌面浏览器中运行良好,但在 iPhone 或 iPad 中,单击六个矩形(或字符串)之一会导致屏幕奇怪闪烁:http: //morning-temple-9106.herokuapp.com/
我尝试了这些与 iphone 上的一般 html 闪烁相关的 css 修复,但没有运气。
canvas {
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
}
这是加载音频的 JS——我在调用 playNote 之前加载文件以加快播放速度。即使我在 playNote 中加载也会发生闪烁。
var audioPlayerE = new Audio();
audioPlayerE.src="strings/E.mp3"
audioPlayerE.load();
var audioPlayerA = new Audio();
audioPlayerA.src="strings/A.mp3"
audioPlayerA.load();
var audioPlayerD = new Audio();
audioPlayerD.src="strings/D.mp3";
audioPlayerD.load();
var audioPlayerG = new Audio();
audioPlayerG.src="strings/G.mp3";
audioPlayerG.load();
var audioPlayerB = new Audio();
audioPlayerB.src="strings/B.mp3";
audioPlayerB.load();
var audioPlayerElittle = new Audio();
audioPlayerElittle.src="strings/Elittle.mp3";
audioPlayerElittle.load();
playNote = function(index,count) {
var noteStr;
if(index-count==0) {audioPlayerE.play()}
if(index-count==1) {audioPlayerA.play()}
if(index-count==2) {audioPlayerD.play()}
if(index-count==3) {audioPlayerG.play()}
if(index-count==4) {audioPlayerB.play()}
if(index-count==5) {audioPlayerElittle.play()}
}
这是我的 github 仓库: https ://github.com/dannycochran/cs184