瀏覽代碼

Call source.start last and use setValueAtTime instead of value setter

Adrian Stutz 8 年之前
父節點
當前提交
32f69814c7
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/audio/Audio.js

+ 2 - 2
src/audio/Audio.js

@@ -83,8 +83,8 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
 		source.buffer = this.buffer;
 		source.loop = this.loop;
 		source.onended = this.onEnded.bind( this );
+		source.playbackRate.setValueAtTime( this.playbackRate, this.startTime );
 		source.start( 0, this.startTime );
-		source.playbackRate.value = this.playbackRate;
 
 		this.isPlaying = true;
 
@@ -227,7 +227,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		if ( this.isPlaying === true ) {
 
-			this.source.playbackRate.value = this.playbackRate;
+			this.source.playbackRate.setValueAtTime( this.playbackRate, this.context.currentTime );
 
 		}