#MA failing to play BBC Radio 4 stream on Voice PE

1 messages · Page 1 of 1 (latest)

keen finch
#

I've been working with @ember plume on the ESPHome PE topic and found that MA is failing intermittently to stream BBC R4.
Before I post the MA logs shall I create a new thread?

#

this was after my automation tried to start steaming on 2x PE's. It has been working >90% of the time

ionic vine
#

Are you from the UK perhaps ?

#

BBC is doing really fancy things to block access to the BBC streams when you are IN the UK while they work fine outside UK

keen finch
#

I am

#

But 99% of the time before getting the PE's it worked, albeit from inside the HA media player. It's only since I got the PE's that I started trying to use this frequenty (I want it to replaced my clock radio).

#

After the above I tried to manually play it serveral time including from inside MA UI and had to bounce MA addon before it worked.

ionic vine
#

Well, I believe these issues are popping up more recently as we got other people complaining about it as well. It might be completely unrelated to the Voice PE even. There is somebody working on a BBS Sounds provider but not sure what the state of that is.

I will have to investigate this a bit with a VPN to UK because from here it works fine.
You can see the "401 Unauthorized" messages in your log which is basicaly the BBC telling us to back off

#

BTW: How did you start the stream ? By selecting it from Radiobrowser within MA ?

#

Because it looks like you are trying a manual link here and that might be the culrprit

#

Because those links you find everywhere have issues. With radiobrowser, we get a dynamic link to the correct stream

#

NVM about that question, got my answer from your log already. You are starting the radiobrowser item

keen finch
#

Both. I also did a ma action call with url from the automation.

ionic vine
#

Yeah, confirmed. With VPN to UK I was able to reproduce your issue in 2 seconds

#

So this is yet another security measure from BBC

ionic vine
#

Yep, this is definitely the issue. BBC blocks access to their streams from within UK. I tried several stream URLs. All blocked

#

hmmm, vlc works so maybe I can work around it with some user agent trick

ionic vine
#

These all work with MA as well

ionic vine
#

That is yet another error where apparantly the connection to HA seems to be lost ?

#

How stable is the connection between MA and HA and HA and the Voice PE ?

#

Is this Home Assistant OS running the MA add-on or a dockerized setup ?

#

Anyways, to recover restart MA or reload the HA provider. I'll add a patch to the code to better handle this

keen finch
#

Very stable connection. The wifi is very high grade. I'm running HAOS

#

MA addon in HAOS (I run the beta MA latest)

ionic vine
#

OK good, then its a bit strange why the connection to HA got lost but I will anyways add a bit of handling for that to happen.

#

Did you try the url after reloading the ha provider in MA ?

keen finch
#

yes. worked well on living room

ionic vine
#

OK so now question is if it keeps playing

keen finch
#

the other one had a wierd one. it lost power (as someone was moving furniture) so when i just now saw it was unavailable it plugged it in. ran the action and it completed but nothing in the MA logs. In MA it now how hourglass and says not yet available.

keen finch
#

idle

ionic vine
#

Ah ok so somehow MA didn’t get notified that the player came back online. I’ll look into that as well

keen finch
#

would i need to bounce the MA addon?

ionic vine
keen finch
#

HA provider is what?

ionic vine
# keen finch HA provider is what?

Within Music Assistant go to Settings --> Providers (first page)
All the way at the bottom you should have the Home Assistant plugin provider. Click on the 3 dots next to it to show the contextmenu and press reload.

#

anyways, both bugs should have been fixed - I'll release a new beta within 20 minutes

keen finch
#

still fails. different reason i think. again i was calling from an action

keen finch
#

A new occurence. I restarted home asistant without restarting MA and got these errors.

#

Here are the logs

ionic vine
keen finch
#

And then at 0700 the radio4 start script failed...

ionic vine
#

So the connection to HA seems to callapse all the time.

#

Do you have a large HA setup ?

keen finch
#

define large

ionic vine
#

Are you 100% sure you updated to beta23 because I see some logging from an error which I should have fixed yesterday

ionic vine
#

ah beta24 is what I mean

#

I didnt have my morning coffee yet

keen finch
#

i will upgrade it now

#

ok. script worked and both playing. i'll keep an eye

#

i think it's great - your commitment to getting this ever better is excellent

#

i dont understand the presence now of media_player.voice_living_room_media_player_2 off the back of my PE media_player.voice_living_room_media_player

#

i guess it doesn't matter but is there a way of getting the current playing name in the player entity as an attribute (for the dashboard)

ionic vine
#

BTW: BBC does not expose any "now playing" info such as current program name or artist/title so you will only see the radio name in the dashboard.

keen finch
#

so should i do all my player commands such as volume and stop on the HA one or the MA one

ionic vine
#

You can even mark the original/HA one as hidden in UI

#

At some point in the future I hope we can manage to automaticlaly merge these entities but for now it is like this

keen finch
#

ok.

#

In my MA entity it shows media_title: bbc_radio_fourfm-audio%3d96000 as the media title. i think this is coming from the URL media_content_id: builtin://radio/http://as-hls-ww-live.akamaized.net/pool_55057080/live/ww/bbc_radio_fourfm/bbc_radio_fourfm.isml/bbc_radio_fourfm-audio%3d96000.norewind.m3u8

is there a way of making this user defined or more friendly. i dont know if they stream the station name in metadata. (I dont mind so much about currently playing)

ionic vine
#

Go to the MA interface, Radio section.
Click the add button top right
Enter the URL, give it a pretty name and a logo

keen finch
#

This is working great now. I’ll keep an eye

#

From an action can you play a favourite or added media by reference, rather than having enter the url. I’d like to maintain that in one place

ionic vine
keen finch
#

You’ve thought of everything!

ionic vine
#

Well not everything but yeah.. a lot..

#

🙂

#

Now lets see if your BBC stream keeps running without issues

keen finch
#

Pressing play in MA worked 07:21 but stopped 2 minutes later (nothing in the logs about stopping)

2025-02-10 07:21:49.721 DEBUG (MainThread) [music_assistant.webserver] Handling command players/cmd/play
2025-02-10 07:21:49.728 DEBUG (MainThread) [music_assistant.players] Handling command cmd_play for player Voice Master Bedroom Media Player
2025-02-10 07:21:49.732 DEBUG (MainThread) [music_assistant.audio] Getting streamdetails for library://radio/2
2025-02-10 07:21:50.112 WARNING (MainThread) [music_assistant.audio] Error while parsing radio URL http://lstn.lv/bbcradio.m3u8?station=bbc_radio_fourfm%22&bitrate=320000%22: No content found in playlist
2025-02-10 07:21:50.144 DEBUG (MainThread) [music_assistant.audio] retrieved streamdetails for library://radio/2 in 411 milliseconds
2025-02-10 07:21:50.249 DEBUG (MainThread) [music_assistant.players] Handling command play_media for player Voice Master Bedroom Media Player
2025-02-10 07:21:50.355 INFO (MainThread) [music_assistant.streams] Start serving audio stream for QueueItem BBC Radio 4 (library://radio/2) to Voice Master Bedroom Media Player
2025-02-10 07:21:50.355 DEBUG (MainThread) [music_assistant.player_queues] PlayerQueue Voice Master Bedroom Media Player loaded item 03a241a8f6df4c48b92ded6dc963712b in buffer
2025-02-10 07:21:50.362 DEBUG (MainThread) [music_assistant.audio] Generated ffmpeg params for player media_player.voice_master_bedroom_media_player: ['alimiter=limit=-2dB:level=false:asc=true']
2025-02-10 07:21:50.449 DEBUG (MainThread) [music_assistant.audio.media_stream] Started media stream for radiobrowser://radio/d594bffd-a494-46a0-b60e-109ad4fd3249 - using streamtype: http - volume normalization: measurement_only - pcm format: f32le - ffmpeg PID: 95
2025-02-10 07:21:50.568 DEBUG (MainThread) [ffmpeg.95] Detected (input) content type: aac (aac)
ionic vine
#

That is again the blocked URL - if you want to play BBC from within UK, you need to use one of the URL's from that lik I shared above.

#

BBC is actively blocking listening to their url's

keen finch
#

Huh? My script is calling the favourite I created

  - action: music_assistant.play_media
    data:
      media_id: BBC Radio 4
    target:
      entity_id:
        - media_player.voice_master_bedroom_media_player_2
#

In MA when I find that favourite how do I inspect it (to see the URL is correct)

#

there must be multiple BBC Radio 4 eg from the radiobrowser external library

ionic vine
#

Ah, I think that the internals matched the Radiobrowser BBC4 with your custom URL

keen finch
#

is there a way to reference the MA unique id from a script

ionic vine
#

As a test, you could consider naming your new entry "BBC UK Radio 4" just to prevent collisions - ensure to delete the existing one first.

ionic vine
keen finch
#

then i dont get the friendly name and icon

ionic vine
#

then add the new one by the special URL

#

I will also chew on this for a bit if we can make this a bit easier for BBC listeners

keen finch
#

I don't think parentheses work in friend names BBC Radio 4 (UK)

ionic vine
#

hmm, that should work

keen finch
#

a new occurrence. This morning at 7am it played a completely different 'random' track instead of BBCR4. When I looked in MA radio it was empty (no favourite anymore). When I synchronised it reappeared.

ionic vine
keen finch
#

i'm on b27

ionic vine
keen finch
#

i checked the logs after updating and there was an exception generated on shutdown before it started up again. should i post these in beta? and keep this thread focussed on the streaming problem

ionic vine