HTML音频播放导致iPhone闪烁

时间:2013-03-21 22:19:31

标签: iphone html5 audio flicker paperjs

我正在尝试创建一个在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

1 个答案:

答案 0 :(得分:0)

从:

iPad Safari: How to disable the quick blinking effect when a link has been hit

没有意识到这只是一个闪烁的效果,将其添加到css修复它:

-webkit-tap-highlight-color: rgba(0,0,0,0);
相关问题