2.0.6 Chromecast / playTrack


#21

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


#22

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


Chirping (Piezzo Buzzer) when opening a door or window
#23

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!


#24

I don't recall seeing Mike write that he didn't want to. He said he didn't have time for a full blown media player, but that he would add PlayTrack.

That is cool. I like that very much.


#25

That works so well pointing to the raw URL! Never even considered using it that way.

[Edit] Has to be small. A 3.6 MB MP3 worked only once and couldn't play it again, but a 12 KB is no problem.


#26

Lol why would I make that up.

You guys can check from the device page to see which url will work.


#27

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

dev:28662019-03-23 10:28:17.924 pm errorsu.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.


#28

What are your triggers for stop? Try pausing those rules. I don't see why it would stop. He doesn't download the media, just passes the URL to GH, I think. Try pausing your stop rules and see what happens.


#29

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.


#30

If I delete the file and upload it again, it will play. So I assume the token is expiring. Other than storing it local, is there anyway to access it via an unsecured connection?


#31

If you're storing on github there should be no token required as it's a public file, right? Are you using the 'raw' file link?


#32

Ah duh, I set that repo to private because the file is copyright protected.


#33

That was it. Made it public and it played right away. :grimacing:


#34

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.

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


#35

That is crazy cool.
Thx man


#36

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.


#37

Will it work with a local (on devices) media track?


#38

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.


#39

You need a URL.


#40

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 errorjava.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 errorsu.litvak.chromecast.api.v2.ChromeCastException: Unable to load media (playTrack)

Android tablet, RCA Viking 10, Android Version 6.