godotengine / godotengine/godot

Wrong Bus for `play_stream` in Web Export Only (in 4.3, worked in 4.2)

Open
#100,696 10 comments 1 reaction 1 assignee Claimed by @adamscott View on GitHub
bug platform:web topic:audio topic:platforms
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: v4.3.stable.official [77dcf97d8]
- Not reproducible in: v4.2.stable.official [46dc27791]

### 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

```gdscript
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)

[new-project-4_3.zip](https://github.com/user-attachments/files/18218458/new-project-4_3.zip)
[new-project-4_2.zip](https://github.com/user-attachments/files/18218459/new-project-4_2.zip)

_**Edit by the bugsquad:** added syntax highlighting to code block._

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.