Capítulo 303 de 859
Class for loading audio buffers. Audios are internally loaded via FileLoader.
const audioListener = new THREE.AudioListener();
const ambientSound = new THREE.Audio( audioListener );
const loader = new THREE.AudioLoader();
const audioBuffer = await loader.loadAsync( 'audio/ambient_ocean.ogg' );
ambientSound.setBuffer( audioBuffer );
ambientSound.play();
Constructor
| Signature |
|---|
new AudioLoader( manager : LoadingManager ) |
Methods
| Method | Description |
|---|---|
.load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) | Starts loading from the given URL and passes the loaded audio buffer to the onLoad() callback. |