-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
Nuxt 2.15.3 + webpack 4.47.0
Pixi version: 7.2.4
@pixi/sound version: 5.2.1
I tried to use @pixi/sound with new Pixi.Assets loading system like this:
import * as PIXI from 'pixi.js'
import '@pixi/sound'
const url = item.data.src // path to .mp3 file
const sound = await PIXI.Assets.load(url)
I successfully load images this way, but in this example I get this error:
[Assets] <path> could not be loaded as we don't know how to parse it, ensure the correct parser has been added
Seems like LoaderParser for sound files does not add to Pixi extension system. I tried to add the extensions manually:
import {soundAsset} from '@pixi/sound/lib/soundAsset.js'
PIXI.extensions.add(soundAsset)
PIXI.extensions.add(soundAsset.loader)
But I get this error that I cannot even explain:
Error: [Loader.load] Failed to load <src>.
TypeError: Cannot read properties of undefined (reading 'useLegacy')
at _callee2$ (Loader.ts:200:1)
at tryCatch (Loader.js:7:1062)
at Generator.eval (Loader.js:7:3012)
at Generator.eval [as throw] (Loader.js:7:1699)
at asyncGeneratorStep (Loader.js:8:103)
at _throw (Loader.js:9:291)
Finally I gave up and used old preloading system wrapper in promise, like this:
const sound = await new Promise((resolve, reject) => {
Sound.from({
url,
preload: true,
loaded: function(err, sound) {
resolve(sound)
}
})
})
But eventually I'd like to revert it back to new Assets system. Where do I do something wrong?
Also I've tried to revert to old versions of pixi.js and @pixi/sound but I kept getting same errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels