For a estim webtease I'm trying to adjust the volume of the left and right channel independently.
Do you know how?
Since EOS uses Howler for audio playback I was trying to use the panning feature of howler.spatial (see https://github.com/goldfire/howler.js#stereopan-id), but no luck so far... I could not even access the this.sound variable in the AudioClip class from an EOS page. Here is the code of AudioClip.js for the refernce:
Code: Select all
import { Howl } from 'howler'
import _debug from 'debug'
const debug = _debug('eos:audio:AudioClip')
export default class AudioClip {
constructor({ url, loops, volume, onDestroy }) {
this.url = url
this.loops = loops
this.loopsRemaining = loops - 1
this.onDestroy = onDestroy
this.isDestroyed = false
this.sound = new Howl({
src: [url],
format: ['mp3'],
volume,
onend: this.handleEnded.bind(this),
html5: false
})
}
play() {
if (this.isDestroyed) return
debug('playing sound %s', this.url)
this.sound.play()
}
pause() {
if (this.isDestroyed) return
this.sound.pause()
}
stop() {
if (this.isDestroyed) return
debug('stopping sound %s', this.url)
this.sound.stop()
}
seek(time) {
if (this.isDestroyed) return
this.sound.seek(time)
}
setVolume(volume) {
if (this.isDestroyed) return
this.sound.volume(volume)
}
destroy() {
if (this.isDestroyed) return
this.stop()
this.isDestroyed = true
if (typeof this.onDestroy === 'function') {
this.onDestroy()
}
}
handleEnded() {
if (this.isDestroyed) return
if (this.loopsRemaining > 0) {
this.loopsRemaining--
this.sound.play()
}
}
}
Thanks for your feedback!