Sfoglia il codice sorgente

Audio: Safari support.

Mr.doob 11 anni fa
parent
commit
16d66991c7

+ 1 - 1
editor/js/Menubar.js

@@ -11,4 +11,4 @@ var Menubar = function ( editor ) {
 
 	return container;
 
-}
+};

+ 1 - 1
editor/js/Sidebar.js

@@ -12,4 +12,4 @@ var Sidebar = function ( editor ) {
 
 	return container;
 
-}
+};

+ 1 - 1
src/Three.js

@@ -21,7 +21,7 @@ if ( Math.sign === undefined ) {
 		return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : 0;
 
 	};
-	
+
 }
 
 // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button

+ 2 - 2
src/extras/audio/Audio.js

@@ -34,7 +34,7 @@ THREE.Audio.prototype.load = function ( file ) {
 
 			scope.source.buffer = buffer;
 			scope.source.connect( scope.panner );
-			scope.source.start();
+			scope.source.start( 0 );
 
 		} );
 
@@ -58,7 +58,7 @@ THREE.Audio.prototype.setRolloffFactor = function ( value ) {
 };
 
 THREE.Audio.prototype.updateMatrixWorld = ( function () {
-	
+
 	var position = new THREE.Vector3();
 
 	return function ( force ) {

+ 2 - 2
src/extras/audio/AudioListener.js

@@ -8,7 +8,7 @@ THREE.AudioListener = function () {
 
 	this.type = 'AudioListener';
 
-	this.context = new AudioContext();
+	this.context = new ( window.AudioContext || window.webkitAudioContext )();
 
 };
 
@@ -26,7 +26,7 @@ THREE.AudioListener.prototype.updateMatrixWorld = ( function () {
 	var positionPrev = new THREE.Vector3();
 
 	return function ( force ) {
-	
+
 		THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
 
 		var listener = this.context.listener;