繁体   English   中英

HTML音频播放导致iPhone中的闪烁

[英]HTML audio playback causing flickering in iPhone

我正在尝试在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

从:

iPad Safari:点击链接后如何禁用快速闪烁效果

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

-webkit-tap-highlight-color: rgba(0,0,0,0);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM