添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
SmartHomePrimer:

How do I play mp3 files with the Chromecast integration and an actuator custom command? What do I put in the string value?

So first initially using actuator is a way to get the devices exposed.

on the next screen choose playtrack as the custom command.

as parameters i use string. The files are on my webserver I use for HP. So I just use the dircet url as the string.

http://192.168.x.xxx/music/mymusic.mp3

I had NO idea this would work this way. I have been using @Cobra 's MP3 Event Player app to get this to work but it works perfectly. I even used the "raw" URL from my GitHub (where I store my music files). It took a second to pull it down but it played almost instantly. I was totally ready to call this one untrue. I had no idea this would work!

This is very interesting because @mike.maxwell specifically didn't want to add the music player capability to the native integration which prevented me from using @Cobra 's app with the native integration. But now it seems to work perfectly. That's great!

Ryan780:

I even used the "raw" URL from my GitHub (where I store my music files). It took a second to pull it down but it played almost instantly. I was totally ready to call this one untrue. I had no idea this would work!

That is cool. I like that very much.

@mike.maxwell Unfortunately PlayTrack is working a few times on my GH Mini, but then the Chromecast Integration throws an error.

dev:2866 2019-03-23 10:28:17.924 pm error su.litvak.chromecast.api.v2.ChromeCastException: Unable to load media (playTrack)

Could be just trying to play an MP3 consistently from Github. @cwwilson08 and @Ryan780 , are you having better results? I'm using the Chromecast Integration from the released platform build, not the beta hub platform.

Same result when attempting to play the url string from the driver settings. Works a few times and then stops. I'm wondering if the custom command stop() is responsible. I was setting up two rules to start and stop the sound via different triggers.

From the driver device details, the speak string works every time.

I have tried it with and without a stop rule. I'm not sure what wrong on my setup. When I just create the custom command stop() , it won't play after that. The reason I was trying to stop was I was having my doorbell button trigger the MP3 and then I wanted to stop it as soon as my front door contact sensor opened.

I just cleaned up a lot of problems on my hub due my poor maintenance, so I'll try it again.

Hi there,
I have been following this thread as it is on the same trail as what I want to achieve.

The bit I am unsure of is where to put the soundfile (.mp3) and what is the actual music player?

I have tried using a sound file on my local network and also tried a file hosted on Github and I keep getting the same error.
Dog Alarm Error.PNG 1104×54 11.5 KB

I am new to to HE and very new to Rule engine, but following the above instructions I think I have that part sorted. Also, would this work with Spotify Link?

Any pointers Greatly appreciated

The file has to be hosted on webserver accessible from the Chromecast and the hubitat hub. You have to put the url for the file into the command playTrack. I use Github since it is publicly accessible and free.

This will not work with a spotify link because you have to log in to get spotify to play.

Ahh. @woodsy [quote="Ryan780, post:36, topic:11176"]
The file has to be hosted on webserver
[/quote]

If you’re able to paste a URL to the file stored on your “local ( on devices) ”, into a browser and it plays without you having to do anything further, then you’re good to go.

Works great on the browser, will not chromecast.

file:///storage/emulated/0/Music/somebody.mp3

I do hear the "meep" that indicates CC is alerted.
2019-08-04 19:26:11.803 error java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection (playTrack)

Remove the "file",

/storage/emulated/0/Music/somebody.mp3

2019-08-04 19:28:20.222 error su.litvak.chromecast.api.v2.ChromeCastException: Unable to load media (playTrack)

Android tablet, RCA Viking 10, Android Version 6.