Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError just by following the Tutorial #256

Open
Tobi33Ee opened this issue Oct 19, 2023 · 2 comments
Open

Uncaught TypeError just by following the Tutorial #256

Tobi33Ee opened this issue Oct 19, 2023 · 2 comments

Comments

@Tobi33Ee
Copy link

Hello, i am having some trouble. for some reason this simple function doesnt work. I hope someone can help out
(and sorry if this is the wrong place to ask for questions, I'm new to git)

package.json:

"dependencies": {
        "@pixi/sound": "^5.2.1",
        "@pixi/ui": "^0.9.0",
        "pixi.js": "^7.3.1"
}

imported pixi/sound like this:
import { sound } from '@pixi/sound';

app.js line 160, which causes some kind of hiccup:

  sound.Sound.from({
    url: 'music/theme.mp3',
    autoPlay: true,
    complete: function() {
        console.log('Sound finished');
    }
});

Error:

Uncaught TypeError: Cannot read properties of undefined (reading 'from')
    at title_screen (app.js:160:14)
    at app.js:292:1

Tried so many times but i just cant find the error.

  sound.add('my_sound', 'music/theme.mp3');
  sound.play('my_sound');

above code (sound.add & .play) works, but i thought that using Sound instead of sound would be the correct way of doing this.
I hope somebody can help, and sorry if i am in the wrong place. I will happely move to somewhere more suited

@Tobi33Ee Tobi33Ee changed the title Uncaught TypeError just following the Tutorial Uncaught TypeError just by following the Tutorial Oct 19, 2023
@bigtimebuddy
Copy link
Member

Can you create a reproduction? How are you building/bundling?

@Tobi33Ee
Copy link
Author

It's Laravel with Vite.
I'll try using the bundlers that are adviced to use in the Tutorial 😅
A reproduction? I uploaded it as a repository, dont know if that was the best idea but i just hope i won't trigger nin____os copyright department

Famous Last Words:

haha this just a project to learn, hopefully there wont be a lawsuit xD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants