Skip to content

Commit 86c46eb

Browse files
authored
Merge pull request #15588 from ngokevin/detunefix
Audio: Add checks for detune on audio buffer for Safari
2 parents 54090fd + fe268ed commit 86c46eb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/audio/Audio.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
9595
var source = this.context.createBufferSource();
9696

9797
source.buffer = this.buffer;
98-
source.detune.value = this.detune;
98+
this.setDetune( this.detune );
9999
source.loop = this.loop;
100100
source.onended = this.onEnded.bind( this );
101101
source.playbackRate.setValueAtTime( this.playbackRate, this.startTime );
@@ -228,6 +228,13 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
228228

229229
this.detune = value;
230230

231+
if ( this.source.detune === undefined ) {
232+
233+
console.warn( 'THREE.Audio: AudioBufferSourceNode.detune not supported by the browser.' );
234+
return;
235+
236+
}
237+
231238
if ( this.isPlaying === true ) {
232239

233240
this.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );

0 commit comments

Comments
 (0)