How can I use Chromecast?

The documentation from Google indicates that the Google Cast extension is not supported in Linux, but it actually does work.

To get this working in Ubuntu:

  • Make sure you are running either Chromium or Chrome version 28 or higher. Earlier versions will get a "This application is not supported on this computer. Installation has been disabled." error. The 'chromium-browser' package in Ubuntu 13.04 works fine.

  • Make sure iptables is configured to allow the UPnP/SSDP traffic used by the Google Cast browser extension to discover the ChromeCast device.

    The browser will send a multicast UDP packet from the local IP and an ephemeral (random) port to 239.255.255.250 port 1900. The ChromeCast device will respond with a unicast UDP packet from the ChromeCast device's IP and another ephemeral port to the source IP/port of the multicast packet. Note that this is slightly different than most other UPnP devices, which will usually respond with a unicast UDP packet from port 1900 instead of an ephemeral port.

    The typical iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT rule WILL NOT match the response packet, as iptables does not currently have a conntrack helper that supports SSDP. In addition, the iptables -A INPUT -p udp --sport 1900 -j ACCEPT rule typically used for UPnP/SSDP will not work since the replies from the ChromeCast device do not come from port 1900.

    Therefore, you will need to add a rule to accept UDP packets on all ephemeral ports. The ephemeral port range for the initial multicast packet should be 32768-61000 (Verify with cat /proc/sys/net/ipv4/ip_local_port_range), so the following rule should work (note it inserts at the top of the input rules):

    iptables -I INPUT -p udp -m udp --dport 32768:61000 -j ACCEPT

    After the ChromeCast device has been discovered (each time the browser starts), the browser will control it using TCP (HTTP) connections to port 8008, which should not require any special iptables rules.

  • Install the Google Cast browser extension in either Chromium or Chrome. Note that an app/extension called ChromeCast is available, but this is not what you want.

  • If you have not yet set up your ChromeCast device, follow the instructions that come with the device to set it up.

  • Once your device is configured, you should be able to simply click the Cast button in Chromium to Cast your current tab.


This answer no longer works because the extension has been discontinued; this answer is, however, being left as-is for historical reasons.

It looks as if all you need is the browser Chrome or Chromium and the extension below: https://chrome.google.com/webstore/detail/google-cast/boadgeojelhgndaghljhdicfkmllpafd


pulseaudio-dlna

This project is in active development. From version >= 0.4.6 Chromecast is supported in addition to DLNA.

From Ubuntu >=16.10 pulseaudio-dlna is in the Universe repository.

For older versions the ppa ppa:qos/pulseaudio-dlna needs to be added first:

sudo apt-add-repository ppa:qos/pulseaudio-dlna
sudo apt-get update

We can then install pulseaudio-dlna it with:

sudo apt-get install pulseaudio-dlna

It then can be run from a terminal or script with

pulseaudio-dlna [options]

It will add all DLNA and Chromecast client(s) available in the local network as an audio output device to select from the sound settings menu.

We can then stream the audio from any media player (or browser) to our Chromecast client.

For all options see the project's documentation at GIT.

Tags:

Chromecast