Cast to TV Gnome Shell Extension
Casting Pearls
![](/var/linux_magazin/storage/images/issues/2020/233/cast-to-tv/coverstoryimage-1_233.png/764766-1-eng-US/CoverStoryImage-1_233.png_medium.png)
Cast to TV is a Gnome extension that streams media files from a PC to a Chromecast-enabled device.
A Chromecast [1] is a small USB dongle that lets you stream audio-visual content from a mobile device to your TV. Just attach Chromecast to your TV, and you can stream to the TV using an Android or other device that supports Google Cast technology.
Google originally developed Chromecast to support streaming from Android phones, but the open source community has never been slow to grasp an opportunity. Cast to TV is a Gnome Shell extension that lets you send pictures, music, and video to a Chromecast-enabled TV from the Gnome desktop. And if you don't happen to have a Chromecast device, use the Playercast app on a Raspberry Pi or other Linux computer to receive the stream and act as an interface to your TV.
Cast to TV for Gnome
You'll find Cast to TV at the Gnome Extensions [2] website. Simply flip the switch from Off to On. For the installation to work, you also must install the native host connector and a browser add-on available for Chrome/Chromium and Firefox (see the "Installing Gnome Extensions" box).
Installing Gnome Extensions
To install from the Gnome Extensions web portal, the system must meet two requirements: Both the native host connector and the appropriate web browser add-on must be installed. On Debian, Ubuntu, and Linux Mint, first set up the host connector with the chrome-gnome-shell package, and then install the appropriate add-on for Chrome/Chromium [3] or Firefox [4]. The Gnome wiki describes the procedure for all other common distributions [5].
Cast to TV depends on the packages npm, nodejs, and ffmpeg. On the project's GitHub site, the developers provide installation instructions for all major Linux distributions [6]. The following command installs these background packages on a recent Ubuntu:
$ sudo apt install npm nodejs ffmpeg
Keep in mind that Node.js is a heavyweight with numerous sub-packages; the installation will take a while, especially on older machines.
When these packages are installed, a new entry appears in the Gnome menu in the upper right corner called Cast Media. Unfold it and open Cast Settings, from which you install the required Node Package Manager (npm) modules as a final step: Open Modules and click Install npm modules (Figure 1). In just a few seconds, the system installs all the required files on the computer.
![](/var/linux_magazin/storage/images/issues/2020/233/cast-to-tv/figure-1/764769-1-eng-US/Figure-1_large.png)
All requirements are now met and the configuration is complete. Now open the Gnome menu again and click Cast Media and then Turn On, which closes the menu. When you open the Gnome menu a third time, you will find a Cast Media entry with the sub-items Video, Music, and Picture, as well as Turn Off and the ubiquitous Cast Settings (Figure 2).
![](/var/linux_magazin/storage/images/issues/2020/233/cast-to-tv/figure-2/764772-1-eng-US/Figure-2_large.png)
From Your Computer to the TV Set
Casting is now as easy as clicking on one of the media formats and selecting the files to play. Cast to TV lets you select several files in one step, as long as they are in the same directory. Then, you need to check the TV set, which should be playing the selected media files. Additionally, a new menu appears in the Gnome panel at the top of the screen labeled Chromecast. (See also the box "Two or More Chromecast Devices.")
Two or More Chromecast Devices
If you use multiple Chromecast dongles or Chromecast-enabled devices in your household, you need to tell Cast to TV the device to which you want to send the stream. For this purpose, go to the Cast Settings | Chromecast tab, and beside the Device selection item, Cast to TV lists all the Chromecast devices it finds. If necessary, devices that are not found can be configured manually by their IP addresses from the gear icon.
Clicking on the entry brings up a dialog in which you can find a progress bar, playback control buttons, and – after clicking Playback – a playlist (Figure 3). If you tap the Stop icon, Cast to TV immediately stops streaming and the menu disappears. From the Gnome menu, you can open Cast Settings during playback to pop up a lightweight configuration dialog where you can adjust the Chromecast menu.
![](/var/linux_magazin/storage/images/issues/2020/233/cast-to-tv/figure-3/764775-1-eng-US/Figure-3_large.png)
If you enable Nautilus | Nemo Integration under the Cast Settings | Other tab, it is even easier to select a video or track to stream. Restart the file manager completely (e.g., nautilus -q
) to stop all background services, as well; a new Playercast entry appears in the context menu for multimedia files. With the Play Files and Add to Playlist options (Figure 4), you can then send the selected files to the Chromecast receiver.
![](/var/linux_magazin/storage/images/issues/2020/233/cast-to-tv/figure-4/764778-1-eng-US/Figure-4_large.png)
On the other hand, Cast to TV cannot yet transfer the complete desktop to the TV. At press time, this function only worked with Chrome or Chromium by opening the web browser and selecting Cast from the menu. You will then find a new icon to the right of the address line. From this menu, you can choose between the Chromecast devices active on the network and the options to stream either a tab, the whole desktop, or a file (Figure 5). Note that streaming the desktop only works with the classic X server, not with Wayland. To switch desktops, you need to log out of the desktop and, after selecting the user account from the gear menu, select GNOME on Xorg.
![](/var/linux_magazin/storage/images/issues/2020/233/cast-to-tv/figure-5/764781-1-eng-US/Figure-5_large.png)
Installing Playercast
Even if you do not have a Chromecast dongle or a device with an integrated Chromecast receiver, you do not have to give up on the idea of streaming media content with Cast to TV. Equipped with Playercast [7], a Raspberry Pi connected to a TV over HDMI is the ideal receiver. (See also the "HDMI-CEC" box.) Alternatively, any other Linux PC will work, as well.
HDMI-CEC
Playercast cannot be controlled by a smartphone, but HDMI-CEC (Consumer Electronics Control) lets you forward control commands from your TV's remote control to devices connected over HDMI, so you can control playback without walking over to the streaming computer. The Raspberry Pi's Raspbian operating system supports this technology out of the box after you install the cec-utils package.
Playercast can be downloaded by npm to the computer you will be using to receive the streams, but first, you have to install npm and the MPV media player [8] as dependencies with the conventional package manager:
$ sudo apt install npm mpv $ sudo npm install -g playercast $ playercast <IP address>:<Port> ### Default port is 4000
Executing the playercast
command on the third line tests the installation. The parameters are the IP address of the computer on which Cast to TV is installed and the port number (port 4000 in the standard configuration). Next, go to Cast Settings on the sending computer and change the Receiver type under the Main tab from Chromecast to Playercast app. As the Listening port, accept the default 4000.
Streaming with Cast to TV is now no longer any different from streaming with a Chromecast dongle. To select the desired media files, use Cast Media from the Gnome panel. The Gnome add-on then immediately transfers the data to the system equipped with Playercast – whether pictures, music, or videos. Again, an additional menu in the panel provides controls, but it is now labeled Playercast. The elements in the dialog are no different from those of the Chromecast variant.
Calling Playercast manually at every start-up is not very practical, especially if you install the system on a Raspberry Pi (e.g., in an attempt to make a "dumb" TV "smart"). Therefore, you should set up Playercast as a system service after completing the initial tests (Listing 1). Now, the software will start automatically when you power on the computer, which you can hide behind the TV set without a keyboard or mouse.
Listing 1
Playercast as a System Service
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.