guansss / pixi-live2d-display

A PixiJS plugin to display Live2D models of any kind.
https://guansss.github.io/pixi-live2d-display/
MIT License
808 stars 123 forks source link

SoundManager's audio does not work with createMediaElementSource when motion sound was played #140

Open hohoaisan opened 3 months ago

hohoaisan commented 3 months ago

When I use audio element in Motion Manager's callback motionManager.on("motionStart", (group, index, audio) => {}) with createMediaElementSource for output the sound to different audio destination sources, the error message was below

MediaElementAudioSource outputs zeroes due to CORS access restrictions for [file name specified]

Some stackoverflow answers suggested adding crossOrigin attribute with value "anonymous" to audio element, I applied for the build code of pixi-live2d-display and it works just fine. But not for directly modifying the audio element of motion manager's callback above.

I have to patch the SoundManager for the workaround, but still suggest adding extra crossOrigin option than current volume for SoundManager

guansss commented 3 months ago

Yeah this would be a nice feature. There's already a crossOrigin option when creating the model, but that only applies to image elements, I'll make it also work for audios.