Git Product home page Git Product logo

go-cast's Introduction

Build status

go-cast

A command line tool to control Google Chromecast devices.

Installation

Download the latest binaries from: https://github.com/barnybug/go-cast/releases/latest

$ sudo mv cast-my-platform /usr/local/bin/cast
$ sudo chmod +x /usr/local/bin/cast

Usage

$ cast help

Play a media file:

$ cast --name Hifi media play http://url/file.mp3

Stop playback:

$ cast --name Hifi media stop

Set volume:

$ cast --name Hifi volume 0.5

Close app on the Chromecast:

$ cast --name Hifi quit

Bug reports

Please open a github issue including cast version number cast --version.

Pull requests

Pull requests are gratefully received!

  • please 'gofmt' the code.

Credits

Based on go library port by ninjasphere

go-cast's People

Contributors

barnybug avatar djeebus avatar elliots avatar fomojola avatar muesli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-cast's Issues

what video format does it support

i'm actually trying to play a simple tvshow mp4 and it fails
cast --name Cast media play test.mp4

Connecting to 192.168.0.138:8009...
Connected
Load media failed

but it works using the built-in chrome feature Cast a file
what file formats does this library support?

cast version 0.1.0

Stops casting after a minute

Running in Bash:
/usr/local/bin/cast --host 10.0.6.14 url load 'http://grafana.example.com:3000/d/TndUWSRZk/main?orgId=1&refresh=5m&kiosk'
Output:

Connecting to 10.0.6.14:8009...
Connected
Failed to send load command: context deadline exceeded

Results:
Successfully casts the webpage, but then stops after a minute or two.

NOTE: The chromecast device is on a different subnet from the host. Works fine when casting from Chrome.

Request for mute command

Would it be possible to add a mute command rather than me having to set the volume to 0? I see if a device is muted in the home app it will show the volume using the status command suffixed by "muted". Could the volume command be adjusted to allow it to be muted and retain the existing volume level?

I use your go-cast binary in a bash script to mute the volume when the radio commercials play. I have a work around by getting current volume level before setting it to zero and then setting it back to the previous level but it's very messy.

build problem GOARCH=mipsle

GOOS=linux GOARCH=mipsle go build -ldflags '-w -s -X github.com/barnybug/go-cast.Version=' -o release/cast-linux-mipsle ./cmd/cast

github.com/hashicorp/go.net/ipv6

../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv6/sockopt_rfc3493_unix.go:105:42: undefined: setsockopt
../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv6/sockopt_rfc3493_unix.go:114:42: undefined: setsockopt
../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv6/sockopt_rfc3542_unix.go:54:12: undefined: getsockopt
../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv6/sockopt_rfc3542_unix.go:75:12: undefined: getsockopt
../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv6/sockopt_rfc3542_unix.go:82:42: undefined: setsockopt

github.com/hashicorp/go.net/ipv4

../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv4/sockopt_asmreqn_unix.go:20:12: undefined: getsockopt
../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv4/sockopt_asmreqn_unix.go:41:42: undefined: setsockopt
../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv4/sockopt_unix.go:29:12: undefined: getsockopt
../../work/pkg/mod/github.com/hashicorp/[email protected]/ipv4/sockopt_unix.go:51:42: undefined: setsockopt

cast does not accept --name option

$ cast --version
cast version 0.0.5

On the examples presented on the main page, global option "--name" is used however version 0.0.5 downloaded from latest does not accept the option. Output returned:

$ cast --name patio quit
Incorrect Usage.

NAME:
cast - Command line tool for the Chromecast

USAGE:
cast [global options] command [command options] [arguments...]

VERSION:
0.0.5

New CAF.

do you knwo if this works with the new CAF ?
They seem to be promoting the idea of Remote access via chrome cast now for gams etc.

"Let others control your casted media"

It seems that this tool only works for open Chromecasts where the "Let others control your casted media" setting is enabled. If I turn that switch off then the commands fail with an INVALID_MEDIA_SESSION_ID error. Is it possible to login or somehow supply a media session id so I can use this command without having an open Chromecast?

Discovery Error

Receiving this error trying to receive.

casting discover
Running discovery for 15s...
2020/06/12 22:00:24.044289 [INFO] mdns: Closing client {0xc42009e038 0xc42009e040 0xc42009e048 0xc42009e050 true 0xc42007c300 {1 0}}
2020/06/12 22:00:24.044489 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:53802: use of closed network connection
2020/06/12 22:00:24.044513 [ERR] mdns: Failed to read packet: read udp6 [::]:40635: use of closed network connection
2020/06/12 22:00:24.044575 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:5353: use of closed network connection
2020/06/12 22:00:24.044766 [ERR] mdns: Failed to read packet: read udp6 [::]:5353: use of closed network connection
2020/06/12 22:00:32.045662 [INFO] mdns: Closing client {0xc42017e000 0xc42017e008 0xc42017e010 0xc42017e018 true 0xc420186000 {1 0}}
2020/06/12 22:00:32.045801 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:58229: use of closed network connection
2020/06/12 22:00:32.045841 [ERR] mdns: Failed to read packet: read udp6 [::]:33413: use of closed network connection
2020/06/12 22:00:32.045889 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:5353: use of closed network connection
2020/06/12 22:00:32.046059 [ERR] mdns: Failed to read packet: read udp6 [::]:5353: use of closed network connection

Sending to port other then 8009

Hey i have another script connecting to one of my google homes on port 8009

is it possible to send audio to all my google homes? and or can i send the data throuugh another unused port to my other google home in my room

casting .ts file

hey I want to thank you for this amazing library first.
and a quick question, do you think it may be possible to transfer directly a ts file from url load to the chromecast or i will have to edit this project for my need to transcode the ts file in golang to mp4

edit: a bit more info, i'm using streamlink to get a m3u8 file from the web and i host the feed using that same tool, it goes to 127.0.0.1:any and then it waits for clients. so i can't give a link to go-cast including the extension.

Casting in 1080

Hello,

/usr/local/bin/cast --version
cast version 0.1.0

An issue regarding this is that it seems to not be casting in 1080. I have had to re-format many dashboards in order to fit, but it would be fantastic if it actually casted in 1080 as it does normally.

Is this a setting I have missed?

[ERR] mdns: Failed to bind to udp6 port: listen udp6 [ff02::fb]:5353: setsockopt: not supported by windows

I tried both the x86 and amd64 versions.
An example of a command I tried:
D:\temp_work>cast-windows-amd64.exe discover
Running discovery for 15s...
2019/03/22 19:50:56.377536 [ERR] mdns: Failed to bind to udp6 port: listen udp6 [ff02::fb]:5353: setsockopt: not supported by windows
2019/03/22 19:51:01.379887 [INFO] mdns: Closing client {0xc042004040 0xc042004048 0xc042004050 true 0xc042016480 {1 0}}
2019/03/22 19:51:01.380818 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:54025: use of closed network connection
2019/03/22 19:51:01.380818 [ERR] mdns: Failed to read packet: read udp6 [::]:54026: use of closed network connection
2019/03/22 19:51:01.381719 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:5353: use of closed network connection
2019/03/22 19:51:06.384058 [ERR] mdns: Failed to bind to udp6 port: listen udp6 [ff02::fb]:5353: setsockopt: not supported by windows
2019/03/22 19:51:09.386568 [INFO] mdns: Closing client {0xc042138000 0xc042138008 0xc042138010 true 0xc04214c000 {1 0}}
2019/03/22 19:51:09.388418 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:54027: use of closed network connection
2019/03/22 19:51:09.388418 [ERR] mdns: Failed to read packet: read udp6 [::]:54028: use of closed network connection
2019/03/22 19:51:09.388418 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:5353: use of closed network connection
Done

Is go-cast supported on raspberry pi

I would like to know if one of the Linux installs (cast-linux-386, cast-linux-amd64, cast-linux-arm) would work on a raspberry pi? If it is supported is there any variation in the install?

context deadline exceeded

Resume

Hi,
is there any chance a Resume function could be added? Or how to resume after Pause? The feature should be supported by Chromecast, Chrome Cast popup allows pausing and resuming (even foreign streams).

Thanks in advance,
Aleq

Error with using hostname

I have been using go-cast for a few weeks now and have found that the DHCP changes the ip address. I have addressed this issue with the physical speakers by reserving the ip address, but I am not able to reserve the ip for the Chromecast groups. So I have been trying to use the --name= option in place of the --host= option, and I am getting the following error output.

Command with --host and no error:

root@opendns:/usr/local/bin# sudo /usr/local/bin/cast --host=192.168.85.48 --port=42626 media play http://audiocdn.mainstreaming.tv/101156/mmc
Connecting to 192.168.85.48:42626...
Connected

The command with --name= and error:

root@opendns:/usr/local/bin# sudo /usr/local/bin/cast --name=Upstairs --port=42626 media play http://audiocdn.mainstreaming.tv/101156/mmc
Connecting to 192.168.85.48:42626...
Connected
2018/11/21 07:46:06.686064 [INFO] mdns: Closing client {0x11878410 0x11878418 0x11878420 0x11878428 true 0x11882280 {1 0}}
2018/11/21 07:46:06.686877 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:59740: use of closed network connection
2018/11/21 07:46:06.687015 [ERR] mdns: Failed to read packet: read udp6 [::]:49238: use of closed network connection
2018/11/21 07:46:06.687140 [ERR] mdns: Failed to read packet: read udp4 0.0.0.0:5353: use of closed network connection
2018/11/21 07:46:06.687262 [ERR] mdns: Failed to read packet: read udp6 [::]:5353: use of closed network connection

Note: Despite getting the error the music still casts out to the speakers in the group. I am using the 0.1.0 cast-linux-arm release on a raspberry pi.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.