diff options
Diffstat (limited to 'App.gd')
| -rw-r--r-- | App.gd | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -5,6 +5,7 @@ extends Control # var b = "text" var audioURL +var audioFile = File.new() # Called when the node enters the scene tree for the first time. func _ready(): @@ -15,17 +16,27 @@ func _ready(): # pass func _on_PlayButton_pressed(): - print("Now playing music") - $AudioStreamPlayer.stream = load(audioURL) - $AudioStreamPlayer.play() + if !audioURL == null: + $AudioStreamPlayer.play() + print("Now playing " + audioURL) + else: + print("No music detected") + +func _on_StopButton_pressed(): + pass # Replace with function body. + func _on_BrowseButton_pressed(): print("Opening file dialog") +# $FileDialog.filters $FileDialog.popup_centered() func _on_FileDialog_file_selected(path): - print(path) - audioURL = "file://" + path + audioFile.open(path, File.READ).get_as_text().close() + $AudioStreamPlayer.stream = load(audioFile) + func _on_AudioStreamPlayer_finished(): print("Music has finished playing") + + |
