Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Atef |
I am trying to load an audio file from my PC filesystem with FileDialog node and load the file by the load() method, but it returns a null, so how can I implement this?
func _on_FileDialog_file_selected(path):
#The path /home/me/Music/Classic.mp3
audioSreamPlayer.stream = load(filePaht)
audioSreamPlayer.play
You’ve passed in path
but are referencing filePaht
??
jgodfrey | 2022-09-29 17:44
Oh sorry, but this is not the problem, I just typed it wrong.
func _on_FileDialog_file_selected(path):
#The path /home/me/Music/Classic.mp3
audioSreamPlayer.stream = load(path)
audioSreamPlayer.play
Atef | 2022-09-29 17:52
What error do you get?
SteveSmith | 2022-09-29 18:18
The is no error, the load(path) method doesn’t load the path and it returns null.
Atef | 2022-09-30 08:46
Are you sure there’s nothing in either the dos console (if running in Windows) or the Output or Debugger windows in Godot? You can’t normally just call “load” on any old file. And I don’t think Godot can handle mp3s either.
SteveSmith | 2022-09-30 10:25
yeah you’re right there is an error in the Debugger window: E 0:00:19.073 _load: No loader found for resource: /path/to/file.mp3.
Atef | 2022-09-30 10:55