Control Chrome audio play/pause button

Hello guys,
Would anyone here know if it would be possible to control the chrome audio play/pause button right next to the cast button on the broswer? Are there any available APIs?
I think it could be a create feature for software optimisationand using it in automations:

  • I’m thinking for example when I get a phone call, all the media playing in chrome (youtube videos, spotify, others) would automatically pause?

  • Another example would be to pause all media when I start playing some songs on spotify since I don’t want to listen to multiple audio sources at the same time.

Thanks a lot for your help :slightly_smiling_face:

It’s a media player, so if you’ve added it to home assistant it has these services available:

Hello, thanks a lot for your feedback.
Do you have examples for the configuration, how to I make my chrome browser become a media player?
And to be very clear, I’m not talking about chromecast or google homes, I’m talking about the chrome browser of my laptop on windows 10.
I’m a bit new to those type of integrations!
Thanks :slight_smile:

Ok, I missed the browser bit. Sorry.

Good news though, you can do it with this:

If you cant get it working from the examples on the page ask for advice here ( I’ve never used the audio player feature):

Oh great I found out by myself the same custom component :slight_smile:
This is a great one! Unfortunately it doesn’t seem to be able to control other medias playing for example spotify or youtube.
Maybe some update/ new features could unable that fonctionnality?
Thanks

Your best bet would be to play your PC sound through a device that Home Assistant can control. e.g. a second hand networked receiver/amplifier.

Yes I already have two speakers on a relay switch so I can cut them off when needed but I’m also using them to stream my phone call :slightly_smiling_face:
i would like to control this chrome browser button, just like I can do manually
image

sorry for recall this old post…

In fact, I’m looking for this kind of project too.
And as I’m using Chrome as media player to watch youtube and other platforms (on macOS)

I made a back-end for Chrome (as media player) via macOS.

It works good for me. I create this backend as a HTTP Request Server. And use some Shell Command in Home Assistant below

# commandline
shell_command:
    smt_playorpause: curl http://IP-address:16250/run/0/
    smt_rwd: curl http://IP-address:16250/run/1/
    smt_fwd: curl http://IP-address:16250/run/2/
    smt_volup: curl http://IP-address:16250/run/3/
    smt_voldown: curl http://IP-address:16250/run/4/
    smt_nextvideo: curl http://IP-address:16250/run/5/
    smt_fullscreen: curl http://IP-address:16250/run/6/

I believe this might be a way to create some kind of “backend” for Windows… but I’m not good at that.