1

我正在尝试开发一个在动画 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/

4

1 回答 1

1

发现确保所有动画都在带有音频的视频中更容易,这样它就不那么复杂并保持同步......

为什么:

  • 使用 html5 画布时,视频可以比 animate cc 更好地跟踪同步。

  • 只添加视频控件比一次添加帧、音频和视频更容易。

  • 尝试在许多不同类型的 Internet 连接和设备上实现时不易出错。

基本一样,只是去掉了音频同步功能。只要确保场景有足够的帧来匹配您设置的 fps 的视频长度。

于 2016-05-06T16:14:50.397 回答