Wrong Bus for play_stream
in Web Export Only (in 4.3, worked in 4.2) #100696
Open
Description
Tested versions
System information
Windows 11 - Google Chrome
Issue description
The method play_stream
has a new argument bus
in 4.3.
- 4.3. https://docs.godotengine.org/en/4.3/classes/class_audiostreamplaybackpolyphonic.html
- 4.2. https://docs.godotengine.org/en/4.2/classes/class_audiostreamplaybackpolyphonic.html
When testing DESKTOP (run), the same code works in both 4.2 and 4.3 versions.
When testing WEB export, the same code works in 4.2 but does not work in 4.3. version.
(Uses Master bus instead of set e.g. "Music" bus.)
(Note that in web export, you need to click on the project window to grab focus to allow creation of audio context.)
Steps to reproduce
The minimal code below:
- in 4.3. it is muted in desktop but playing in web
- in 4.2. it is muted in both desktop and web
extends Node2D
func _ready():
AudioServer.set_bus_mute(AudioServer.get_bus_index("Music"), true)
var audio = load("res://menu_doodle_2_loop.ogg")
var player = AudioStreamPlayer.new()
var stream = AudioStreamPolyphonic.new()
player.stream = stream
player.process_mode = process_mode
player.bus = "Music"
player.stream.polyphony = 1
player.max_polyphony = 1
add_child(player)
player.play()
var playback = player.get_stream_playback() as AudioStreamPlaybackPolyphonic
var stream_id = playback.play_stream(audio as AudioStream)
Temporary workaround (in GDScript) for 4.3. web export is to set bus explicitly in the new argument (pass it player.bus
).
But this is not compatible with 4.2. or earlier because the new argument exists only in newer versions.
Minimal reproduction project (MRP)
Metadata
Assignees
Type
Projects
Status
For team assessment
Activity