Browse Source

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

Adrian Stutz 8 years ago
parent
commit
32f69814c7
1 changed files with 2 additions and 2 deletions
  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.buffer = this.buffer;
 		source.loop = this.loop;
 		source.loop = this.loop;
 		source.onended = this.onEnded.bind( this );
 		source.onended = this.onEnded.bind( this );
+		source.playbackRate.setValueAtTime( this.playbackRate, this.startTime );
 		source.start( 0, this.startTime );
 		source.start( 0, this.startTime );
-		source.playbackRate.value = this.playbackRate;
 
 
 		this.isPlaying = true;
 		this.isPlaying = true;
 
 
@@ -227,7 +227,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 
 		if ( this.isPlaying === true ) {
 		if ( this.isPlaying === true ) {
 
 
-			this.source.playbackRate.value = this.playbackRate;
+			this.source.playbackRate.setValueAtTime( this.playbackRate, this.context.currentTime );
 
 
 		}
 		}