Music suddenly wont play anymore on android from auto load script.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Barina
:warning: Old Version Published before Godot 3 was released.

Hi
I am working on a simple game with a background music (an OGG file) which works great on Windows and worked well on android devices too until some day it just stopped playing the background music (other sounds still working ok)
I tried to look at the logcat but I can’t point to the problem… here’s the log:

...
...
08-04 19:24:19.921: I/godot(4665): S3TC: 0 ATITC: 1
08-04 19:24:20.007: I/godot(4665): OpenSL Init OK!
08-04 19:24:20.029: W/AudioTrack(4665): AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 1, track 44100 Hz, output 48000 Hz
08-04 19:24:22.303: I/godot(4665): MAGIC: 1128612935
08-04 19:24:22.303: I/godot(4665): MODE: 1
08-04 19:24:22.305: I/godot(4665): e[1;31mERROR: set_file: e[0me[1mCondition ' err ' is true. returned: err
08-04 19:24:22.305: I/godot(4665): e[0;31m   At: drivers/vorbis/audio_stream_ogg_vorbis.cpp:265.e[0m
08-04 19:24:22.305: I/godot(4665): e[1;31mERROR: setup: e[0me[1mCondition ' p_channels!=1 && p_channels!=2 && p_channels!=4 && p_channels!=6 ' is true. returned: ERR_INVALID_PARAMETER
08-04 19:24:22.305: I/godot(4665): e[0;31m   At: servers/audio/audio_rb_resampler.cpp:268.e[0m
08-04 19:24:22.305: I/godot(4665): e[1;31mERROR: _load_stream: e[0me[1mCondition ' !stream_valid ' is true. returned: ERR_UNCONFIGURED
08-04 19:24:22.305: I/godot(4665): e[0;31m   At: drivers/vorbis/audio_stream_ogg_vorbis.cpp:304.e[0m
08-04 19:24:22.305: I/godot(4665): MAGIC: 1128612935
08-04 19:24:22.306: I/godot(4665): MODE: 1
08-04 19:24:24.664: I/godot(4665): MAGIC: 1128612935
08-04 19:24:24.664: I/godot(4665): MODE: 1
08-04 19:24:41.481: I/godot(4665): MAGIC: 1128612935
08-04 19:24:41.481: I/godot(4665): MODE: 1
08-04 19:25:38.099: I/godot(4665): BACK PRESSED

What I’m doing is loading a StreamPlayer instance and an instance of my music resource
Then playing it after my global.gd (autoload) script done loading
as shown here:

extends Node

... other stuff here ...

var music_player = StreamPlayer.new()
var music = ResourceLoader.load("res://assets/mfx/main_loop.ogg")

... other stuff here ...

func _ready():
	... other stuff here ...
	play_music()

... other stuff here ...
	
func play_music():
	music.set_path("main_loop")
	music_player.set_stream(music)
	music_player.set_volume(.4)
	music_player.set_loop(true)
	music_player.play()

Am I doing something wrong?

EDIT:
I also tried to create a singleton AutoLoad StreamPlayer based scene to play my bg music exactly as shown here:

Same results. on Windows runs perfect. Android WON’T play any music!
I also tried changing the audio channels with Auditor but it’s matter not…
Changing to another audio file doesn’t matter too.

Another edit:
It seems that every export cause loosing background music even when exporting to Windows
The only way it works is when I test it on Windows

:bust_in_silhouette: Reply From: Barina

The problem occurs when exporting. it didn’t export “by dependency” like it was intended and I had to include the ogg\wav file in the export (resources page when exporting)
The whole time it was exported without those files so the background music file was missing therefore there’s nothing to play… I wish there were a feature warning you when there’s a file necessary not being exported.

To be honest yes you’re right…Yet i moved my music to the res// folder and everything started working perfectly the problem for me was the music were all placed in sub folder
(a folder in a folder)

GRANDGAMES.INC | 2022-02-03 17:44