我正在尝试开发一个在动画 cc 中工作的播放器栏,并在 html5 画布上播放视频和动画前面的视频。
我希望它可以加快音频速度,因为屏幕上的视频会走得很远,但它正在以正确的速度播放。所以我尝试了这个:
//Position the scrubber, handle press/release events for scrubber
this.addEventListener("tick", fl_MouseClickHandler.bind(this));
function fl_MouseClickHandler()
{
if(isDragging == false){
proportion = this.currentFrame/this.totalFrames;
if(Math.round(this.currentFrame/30) % 10 == 0){ // do this every 10 seconds
audioSync(proportion);
}
this.scrubber.x = scrubberStart + (proportion * barWidth);
}
else {
if (stage.mouseX > scrubberStart && stage.mouseX < (scrubberStart + barWidth)) {
proportion = (stage.mouseX-scrubberStart)/barWidth;
this.scrubber.x = stage.mouseX;
}
}
}
function audioSync(var p){
audioInstance.setPosition(p * audioInstance.duration);
//is there a better way to do this without it getting choppy?
//currently sounds like
//fo-o-o-d-d-d S-s-aaaaffttey-y-y when set to 2 seconds
//(it gets off that fast)
//it does those glitchy sounds for a few seconds when you increase the interval
//(if set to do it 10 seconds, ~3 seconds glitch, ~7 seconds normal)
}
现在,当他们放慢人声并且变得非常波涛汹涌时,它最终听起来有点像愚蠢的朋克。(参见“Alive 2007”第 7 轨的 0:00 到 1:30,“面对面/短路”(c)Daft Punk Legals,作为一个很好的例子)。
这是仅不同步的演示:http: //mhardingfoodsafe.github.io/player-audio-messed-up/
当我尝试什么都不做audioInstance.currentTime = video.currentTime;
时,当我这样做时,video.currentTime = audioInstance.currentTime;
我收到一条错误消息,说它无法读取非有限值。
这是它实际上正在做我所描述的事情(不是我想要的): http: //mhardingfoodsafe.github.io/player-bar-v2/