Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delayed audio output with local audio (~4 seconds), compared with default media player (~1 second) #3488

Open
1 task done
ColtonIdle opened this issue Jan 22, 2025 · 19 comments
Labels
HA Integration Improvements or bugs in the integration triage

Comments

@ColtonIdle
Copy link

ColtonIdle commented Jan 22, 2025

What version of Music Assistant has the issue?

2.3.6

What version of the Home Assistant Integration have you got installed?

2.3.6

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

  • Yes

The problem

First, sorry since I'm not sure if my version numbers are correct. I installed Music Assistant today on a HA Green. Nothing special with the setup so I should have latest stable as of today.

The instructions for getting the version number in the "Create new issue" template are wrong I think since I could not find these two paths.

Image

Edit
Oh. "Core" means to click the little engine icon! My issue still stands that I don't know where to grab the second version number that's being asked for.

Onto the actual bug!

My journey with music assistant starts because I have a zigbee button where i want to press a button and it'll play 1 of 3 random sounds. The sounds are short (like 3 seconds long). And so the speed at which they play is sorta important. I was not able to accomplish this task in the regular media player. Media player in HA doesn't seem to allow me to create/play a playlist. Hence I found music assistant. And now I created a playlist with my local files... and i can put them on shuffle. and everything seems to work great! but I noticed that playing media (or even skipping to the next song) takes about ~4 seconds with music assistant. While default media player in HA plays my local files and skips to next file in less than a second (using my stopwatch here 😅).

How to reproduce

Add local files. Nothing else. Try to play them via web interface and see that there's a delay.

Music Providers

Filesystem (local-disk)

Player Providers

I tried using "Blusound" music provider first. and i thought maybe the issue was bluesound. but then i tried the HA Players provider (since i already have my blusound speaker there) and it still took roughly the same amount of time.

Full log output

not sure if this is the right log. i went to MA >> Settings >> Core >> Download Logfile

music-assistant.log

Additional information

I'm running on the Home Assistant green. It doesn't show up in the issue creation drop down.

Image

Another note I've noticed (but I don't think it's related) is that this shows for about 3 seconds in the blusound app when I press next on my button/automation. When I hit next in Music Assistant dashboard then this message doesn't show. To be clear. The delay exists when I'm using my zigbee remote to kick off the automation and when I just use the Music Assistant dashboard. There seems to be no noticeable difference in delay when using MA dashboard to go to next, vs using my button. I think the difference in the error vs no error seems to be because I'm using the deafult "Media Player > Next Song" action. Maybe there's a "Music Assistant Next Song" action I don't know about?

Image

What version of Home Assistant Core are your running

2025.1.3

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Alternative

@ColtonIdle ColtonIdle changed the title Delayed audio output with local audio Delayed audio output with local audio (~4 seconds), compared with default media player (~1 second) Jan 22, 2025
@OzGav
Copy link
Contributor

OzGav commented Jan 22, 2025

@Cyanogenbot is this the normal buffering delay?

@Cyanogenbot
Copy link

4 seconds seems crazy long, @ColtonIdle what bluesound speaker are you using? Additionally, would it help plugging in a LAN cable? For the error ive have some issues myself with loading files to the device too, the HA bluesound implementation seems a bit weird... Let me look into this soon

@ColtonIdle
Copy link
Author

ColtonIdle commented Jan 23, 2025

Indeed. 4 Seconds feels like forever. I feel like it's not a LAN/WIFI issue since using the default media player in HA plays music in less than a second. While with music assistant it is sloooow.

To answer your questions:

  1. In my setup for the bug report I'm using a C700 https://nadelectronics.com/product/c-700/ (it's not the v2, although I don't think that matters.
  2. I'm plugged in via LAN

Other notes:
I have one c700 at home and a few bluesound powernodes https://www.crutchfield.com/p_813PNODEBK/Bluesound-POWERNODE-Black.html. All of them are wired. No issues with the speed of any of them except with music assistant (which I honestly probably wouldn't have noticed if the files weren't local. lol. Since they are local files I know I couldn't blame it on spotify streaming for example) For this bug report I only tried with the c700, but I tried just now with the powernode devices and they all have the same issue. Default HA media player = fast... Music Assistant = slow

I'm fairly technical (I do android dev) and I've also done some android dev with mDns in the past so I can be as helpful as possible here (i just dont know where to start). Very commited to making this work as this basically makes one of my automations useless with such a long delay 😭

@Cyanogenbot
Copy link

Cyanogenbot commented Jan 23, 2025

@marcelveldt I suspect this has something to do with URL formatting, seeing that the error in the BluOS app resembles the same error I've encountered earlier due to some files not wanting to be played or having trouble being loaded when there was a lot of additional info added to the link after the .mp3 or .flac file extension. I mentioned this before in the discord afaik. How would this best be solved, do I need to intercept the links sent and modify these?

Furthermore; BluOS does have some form of announcement ping but that's not integrated in the API that is in use yet.

@marcelveldt
Copy link
Member

@marcelveldt I suspect this has something to do with URL formatting, seeing that the error in the BluOS app resembles the same error I've encountered earlier due to some files not wanting to be played or having trouble being loaded when there was a lot of additional info added to the link. I mentioned this before in the discord afaik. How would this best be solved, do I need to intercept the links sent and modify these?

Furthermore; BluOS does have some form of announcement ping but that's not integrated in the API that is in use yet.

Please discuss that in discord, way easier.
For such expensive products, it keeps surprising me how limited they actually are, especially the API.

I don't think that these delays have anything to do with query parameters in the stream URL, which are NOT a lot at all, just the player id.

@ColtonIdle
Copy link
Author

ColtonIdle commented Jan 23, 2025

Let me be clear about the "error" message in the screenshot from the BluOS app. That error only appears when I run the Home Assistant action of

action: media_player.media_next_track
data: {}

If I instead just use the UI in music assistant to hit next song, then I do not see the BluOS app URL error.

Image

In both cases there is a 4 second delay though. I don't think my error message is all that helpful (and might actually be distracting the real issue), but on the off-chance that it is part of the problem I wanted to post it since it seemed like it could be helpful. Like I said earlier, since Default Media Player in Home Assistant plays without a 4 second delay... it seems like Music Assistant is doing something different.

@ColtonIdle
Copy link
Author

I ordered one of this speaker. I'll see if I can get it running and see if the delay exists there as well. I suppose at that point we'd be able to tell if it's a BluOS related issue or something more general to MA?

If anyone has any other tips to help me debug, let me know!

Image

@OzGav
Copy link
Contributor

OzGav commented Feb 7, 2025

Is there an update available for this one?

@Cyanogenbot
Copy link

Is there an update available for this one?

Not from my end, it's a music assistant core related issue rather than the provider, I'm not sure how to help with that... I did some troubleshooting and sent that to Marcel, he might have more details :)

@OzGav
Copy link
Contributor

OzGav commented Feb 13, 2025

Thanks. Just wondering if the OP got that other speaker…..

@ColtonIdle
Copy link
Author

i tried that speaker and just had issues in general and returned it. FWIW, I ended up quitting on my project so I no longer need this issue open. you can close the issue if anything.

@OzGav
Copy link
Contributor

OzGav commented Feb 14, 2025

@Cyanogenbot is it worth keeping this open? I don’t see any other reports like this so it’s not being seen elsewhere?

@OzGav OzGav closed this as completed Feb 21, 2025
@Cyanogenbot
Copy link

@OzGav in the current state it was better to close it! The issue is still there but its more related to homeassistant I think

@ColtonIdle
Copy link
Author

FWIW, I don't think it's home assistant since when playing from home assistant built in media player there is no delay.
Of course you all would know better, but I just wanted to make sure it's clear that the issue does not exist with default media player vs music assistant.

@OzGav
Copy link
Contributor

OzGav commented Feb 22, 2025

See how version 2.4 works when it ships. There are so many improvements in there

@ColtonIdle
Copy link
Author

will do and will report back. thanks @OzGav

@ColtonIdle
Copy link
Author

Very interesting. was debugging another issue with music assistant (had a bunch of duplicated players) so i deleted music assistant integration. then restarted HA. now HA tells me music assistant has a 2.4 update available. so going to try that now! just weird it didn't prompt me about the update before.

@ColtonIdle
Copy link
Author

Actually. looks like 2.4 was recently released. so nothing strange there. just funny timing on my part. cheers

@ColtonIdle
Copy link
Author

FWIW. same result. 4+ second delay.

@marcelveldt marcelveldt reopened this Feb 26, 2025
@OzGav OzGav removed the More info label Mar 5, 2025
@Cyanogenbot Cyanogenbot added the HA Integration Improvements or bugs in the integration label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HA Integration Improvements or bugs in the integration triage
Projects
None yet
Development

No branches or pull requests

4 participants