# Casting to TV from Chromium



## balanga (Apr 6, 2020)

Can anyone tell me if you can cast to TV from Chromium on FreeBSD?

I can cast from Chrome on Windows, but can't see any way of doing this on FreeBSD.... Can't remember what I did on Windows but I did configure it some months ago. It would be nice to know if it is possible on FreeBSD before I spend any more time looking for a solution.


----------



## balanga (Apr 6, 2020)

Just noticed that I'm actually able to cast from Chrome but from YouTube whilst running under Chrome.

When using YouTube I see an extra icon among the controls at the bottom right hand side of the screen. When the cursor is over this icon it shows 'Play on TV'.
From what I have read it is possible to cast any Chrome tab to TV by clicking on the Chrome Control icon (three vertical dots at the top right hand corner of the screen). One of the options is (or may be) Cast which show which device you can cast to.. On my  system, it identifies a device but then tells me it is not suitable even though YouTube has no problems using it.

Now when using Chromium on FreeBSD, I get a msg saying that no devices are detected for Casting. Does this suggest a missing device driver in FreeBSD or Chromium being built without options to enable casting?


----------



## drhowarddrfine (Apr 6, 2020)

You can't using Chromium. Chrome, itself, only runs on Windows.


----------



## balanga (Apr 6, 2020)

So is Casting a feature only available in Chrome because of underlying capabilities of Windows?


----------



## rawthey (Apr 8, 2020)

balanga said:


> Can anyone tell me if you can cast to TV from Chromium on FreeBSD?
> 
> I can cast from Chrome on Windows, but can't see any way of doing this on FreeBSD.... Can't remember what I did on Windows but I did configure it some months ago. It would be nice to know if it is possible on FreeBSD before I spend any more time looking for a solution.



Click the 3 vertical dots icon at the top right


Then select 'cast' from the dropdown menu.

Works here with chromium-80.0.3987.149 on FreeBSD 12.1-RELEASE


----------



## balanga (Apr 8, 2020)

rawthey said:


> Click the 3 vertical dots icon at the top right
> View attachment 7717
> Then select 'cast' from the dropdown menu.
> 
> Works here with chromium-80.0.3987.149 on FreeBSD 12.1-RELEASE


Good to know that it works for. Can you also cast YouTube?

I did previously see that a device was found but it wasn't suitable, the I came across this link

https://askubuntu.com/questions/825...romecast-no-longer-works-and-cant-find-device

and tried changing a few things after opening up  *chrome://flags/#media-router* so must have messed up something.

Will try to 'unmess' it.


----------



## rawthey (Apr 9, 2020)

balanga said:


> Good to know that it works for. Can you also cast YouTube?
> 
> I did previously see that a device was found but it wasn't suitable, the I came across this link
> 
> ...



Yes the cast icon appears in YouTube videos and works just the same way as the cast option from the Chromium toolbar.

I'm using s bog standard installation of Chromium without any extensions.

I've searched chrome://flags for all instances of the word 'media' and they're all set to default as listed in the attached PDF although the word 'Default' on the buttons didn't get through to the file.


----------



## balanga (Apr 13, 2020)

What I can't get a handle on is the underlying technology on which casting works... Is there a particulary device driver included in FreeBSD which enables it to work? And is there a command line program which can be run to scan for suitable devices to cast to?


----------



## rawthey (Apr 13, 2020)

balanga said:


> What I can't get a handle on is the underlying technology on which casting works... Is there a particulary device driver included in FreeBSD which enables it to work? And is there a command line program which can be run to scan for suitable devices to cast to?


As I understand it (and I could well be wrong) Chromium just sends the URL of the current web page to the Chromecast dongle and leaves it to get on with it.
This seems plausible for web pages but I've no idea how it does things when you ask it to cast the entire desktop


----------



## balanga (Apr 13, 2020)

But how does it know where to send it? On Windows the Cast tab identifies the target. I don't have a dongle, my TV decoder must have some sort of built in receiver, and Windows lists it as Netia Player [B4:2E:0F]. Looks like you can select which device to use if you have several. In the case of FreeBSD, at least for me, clicking on the Cast tab brings up a dialog box saying 'Looking for devices'... '? No devices found'

Clicking on '?' takes me to a Chrome support page so I'll try wading through that to see if anything turns up, but sounds unlikely.


----------



## tingo (Apr 13, 2020)

I'm not sure this is the way cast devices are discovered, but they "advertise" over avahi. Here is mine:

```
tingo@kg-core2$ avahi-browse -a
...
+    re0 IPv4 Chromecast-55d16d8fc84e55f6ec1586ba30495e0f   _googlecast._tcp     local
...
```


----------



## balanga (Apr 13, 2020)

tingo said:


> I'm not sure this is the way cast devices are discovered, but they "advertise" over avahi. Here is mine:
> 
> ```
> tingo@kg-core2$ avahi-browse -a
> ...


Never (knowingly) used avahi, and not really sure what it is but when I tried your command, I got 





> Failed to create client object: Daemon not running


----------



## rawthey (Apr 13, 2020)

balanga said:


> But how does it know where to send it? On Windows the Cast tab identifies the target. I don't have a dongle, my TV decoder must have some sort of built in receiver, and Windows lists it as Netia Player [B4:2E:0F]. Looks like you can select which device to use if you have several. In the case of FreeBSD, at least for me, clicking on the Cast tab brings up a dialog box saying 'Looking for devices'... '? No devices found'
> 
> Clicking on '?' takes me to a Chrome support page so I'll try wading through that to see if anything turns up, but sounds unlikely.


Looking at the output from `Wireshark` I see some occasional multicast packets from my Chromecast dongle to 224.0.0.251 then when I fire up Chromium and cast a YouTube video I see some light TCP traffic between my PC and the dongle but it's well below 1 KB/s so definitely not actually sending the video from the PC. So it looks like Chromium has just sent the URL to the dongle and then just keeps in touch to check on progress.

If I use `VLC` to play a video from my hard drive and then get Chromium to cast the entire desktop the traffic goes up to about 0.5GB/sec as the PC sends the data direct to the dongle..

Do you have any firewall rules on your FreeBSD box that could be blocking multicast packets to 224.0.0.251


----------



## tingo (Apr 14, 2020)

balanga said:


> Never (knowingly) used avahi, and not really sure what it is but when I tried your command, I got


Yes, you need to install some packages first:

```
root@kg-core2# pkg info avahi* *mdns*
avahi-app-0.7_3
avahi-autoipd-0.7
avahi-libdns-0.7
nss_mdns-0.10_3
```
You also need to configure /etc/nsswitch.conf correctly. IIRC, one of the packages tells you how.


----------



## rawthey (Apr 15, 2020)

tingo said:


> Yes, you need to install some packages first:
> 
> ```
> root@kg-core2# pkg info avahi* *mdns*
> ...


You might manage with less than that. Casting works fine here with the following:

```
curlew:/home/mike% pkg info -x avahi mdns
avahi-app-0.7_3
avahi-libdns-0.7
pkg: No package(s) matching mdns
```
I've never made any changes to /etc/nsswitch.conf and it's identical to /usr/src/lib/libc/net/nsswitch.conf

```
curlew:/home/mike% cat /etc/nsswitch.conf
#
# nsswitch.conf(5) - name service switch configuration file
# $FreeBSD: releng/12.1/lib/libc/net/nsswitch.conf 338729 2018-09-17 18:56:47Z brd $
#
group: compat
group_compat: nis
hosts: files dns
netgroup: compat
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files

curlew:/home/mike% sum /etc/nsswitch.conf /usr/src/lib/libc/net/nsswitch.conf
22776 1 /etc/nsswitch.conf
22776 1 /usr/src/lib/libc/net/nsswitch.conf
```


----------

