Chromecast support

Hi. I would like to suggest Chromecast support. On windows PC I could just use the Chromecast built into Chrome, but on mobile is where I really want it.
What I’m looking for in a DAM is something I can access on my PCs and Android devices (iOS would be a bonus) that I can then find photos I want easily and then Chromecast them to my TV. So far Photo structure is looking good and future updates at some stage will add the niceties like have face detection etc that I also want. But Chromecast is the top of my requirements. Mirroring my devices screen is a way to get around this, but I find this clunky and especially with video, not very reliable.
Thanks
David

:+1:

Note that you can technically do this right now, if you use Chrome on your android device, and point it to the PhotoStructure instance running on your LAN: then just click the “cast” button.

A beta user did some preliminary research for me to implement this as a native chromecast channel (which wouldn’t require an android device to “drive” the UI):

To implement Chromecast requires:

A sender. There is a JS framework. Integrate Cast SDK into Your Web Sender App  |  Google for Developers Requires the user to be running Chrome. As best as I can understand, the Chrome App, is just a webapp. Fortunately, you’re already doing that on port

A receiver. To support images appears to need a custom receiver. Again, this is also a JS app.

Custom receiver

If your app provides content such as an image gallery, requires DRM, or custom business logic, then you need to build a custom receiver application. A custom receiver is an HTML5 app that you host on your own servers and that must be implemented using the JavaScript CAF Receiver API.

For details about how to build your receiver application with the Receiver API, see the Create a Basic CAF Receiver guide.

Cast supports JPEG and other image formats. Supported Media for Google Cast  |  Google for Developers

Another beta user wrote this blog post (complete with demo):

https://fjordaan.medium.com/wanted-my-photo-library-on-a-connected-tv-ae272c68abec

As an aside, I’m a bit hesitant to build on (any!) Google API, given how joyfully they kill their own products, but at least for now, it seems to be the simplest way to broadcast to a TV.

1 Like

Hi.

Thanks very much for the detailed post. I can understand your reluctance to build on any Google API, seeing how they do kill products quite often. I’ve worked in IT/Support for 17 years and have seen some of our devs build on platforms that they think will have a longish life, but are depreciated a year or 2 later. So I very much understand.

As far as I understand you can’t cast from android chrome, so that won’t work. If you could it would wonderful. But you have to go into Google Home and share your screen with the chromecast. I’m happy to be proven wrong if there is another way. I’ve just found especially with videos, screen sharing to chromecast is not ideal.

I’ll check out the Photo library on a connected TV post. Thanks for the suggestion.

Good luck with the project. It looks great and I really like your philosophy behind it. You might still have me as a paying customer going forward when you go into production.

Cheers
David

I wonder what’s different between my setup and yours? My Google Pixel 1, 2, 4 and OnePlus 7 Pro all have a “Screen Cast” toggle in the quick-settings (available from pulling down from the top menu bar), where you can share the (entire) screen. I only have ancient Chromecasts (the black HDMI sticks), fwiw.

If you click “Add to Home screen” from your mobile’s Chrome or Firefox, when logged into your LAN’s PhotoStructure instance, and then launch the browser from that home-screen bookmark, it’ll hide the URL titlebar, too.

Hmmm. I’ve got a HTC U11, Samsung A8 and a Vivo Y11 in the house and none of those have a “Screen Cast” toggle in the quick settings. Googling it, it seems to be screen mirroring, not sure if it’s the same way screen mirroring is done in Google Home app, but I would think they would be similar.
Pixel : Project your Pixel phone's screen - Pixel Phone Help
Android in general : Cast from Chrome to your TV - Streaming Help

I’ll set it up with LAN access and give it a try with the mirroring and add it to the home screen

Cheers
David

A new user asked for NVIDIA Shield support today, and we discussed options: seems that the above chromecast receiver would still be the best option for Android TV.

As the aforementioned beta user, I am still interested in this topic. This has become more important for me because my phone filled up,and I am now removing images from my phone (after backing up to the NAS) . I would previously just cast from Google Photos on my Pixel phone.

However, the only place that I can now view all my “old” photos from my phone is in PhotoStructure (I don’t push to google cloud). As a Pixel user, I can just cast my phone, but the experience from PS is not great compared with casting from the Photos app on the phone.

The killer feature for me on Google Photos on android is browsing the photo list while the previous photo is showing on the TV. Whereas in PS, I am casting my whole phone to the TV, and my viewers can see me navigating around in PS.

That was a long way of saying, I am seriously looking at this again now. I have found a cast receiver called castDeck. I had a quick play with this, and here are my findings.

Chromecast Receivers support loading local media over HTTP (sort of)

From my reading, it should be possible to send local (eg, not internet) photos to a Chromecast receiver, even over http (as opposed to over TLS). For me “local” is the PS instance on my LAN.

I have tried this using the castDeck Sender (on GH pages), but it’s a three way conversation, which PS returns with a CORS header, and castDesk prints a useful message on the Chromecast that it can’t display the image due to a (possible) CORS restriction.

I thought I understood CORS, and was trying to work around this by running the “sender” on the same Apache instance as the one that proxies PS. The sender makes requests to PS to preview the content before sending it to the Chromecast. However it’s failing and my hunch is that “senders” need to be https, whereas my PS is over http.

However, there is a chance that PS is treating the connection from the Chromecast as a dodgy client, and not allowing it to fetch due to CORS. Given we don’t know the address of the session from which Chromecast makes the request to PS, this would be hard to fix except by allowing CORS to the world from PS. I’ll keep digging. As I write this, I realise that I can probably look at the Apache logs and try to determine whether Chromecast actually requested the image, or whether the receiver bailed before that.

Receivers and Senders must be rendered over https (if I recall correctly)

I read this somewhere, although I have read so many docs, I can’t find the reference anymore. However, this might be the reason that I was not successful getting the castDesk sender working on my local Apache. I am starting to go down the rabbithole of setting up a local CertAuthority and issuing a TLS cert to Apache. I am hoping that I can work around this, because otherwise any PS user that wants Chromecast support from PS will need to run their PS on TLS.

BTW, as part of my research on CAs, I found that there is a home.arpa DNS that is supposed to be non-routable. Sort of the DNS equivalent of the 192.168 ranges.

Receivers are not as hard to write as I originally thought

It should be quite easy to write a PS specific receiver (branded, etc), and it would therefore be able to support Images and movies. I am basing this on the castDeck sender, which seems fairly trivial.

PS appears to already have some sort of support for built in scaling

I see there are little suffixes on images in PS. Things like /img/19285/fit/1620 which appears to get a version of the image that will fit into 1620 pixels. I think I found one with a height limit too. I say that because I read somewhere that Chromecast Receivers can only render up to 720p. I am not sure whether that is the standard receivers, or whether a PS custom receiver would also has this limitation. The recommendation is to treat the Chromecast as a very low spec’d device, and do as much processing server side as possible. PS seems perfect for that.

Does PS transcode stuff?

The Chromecast has a limited set of codecs for image and video support. I can imagine that there are some image formats that Chromecast can’t handle (eg, HIEC). Can I lean on PS for transcoding? This is probably even more relevant for video files. The castDesk receiver appears to support only images from my limited test, so video support would require a smarter receiver.

How do I choose what to show on the Chromecast?

Thinking some more of the actual UX of Chromecast for PhotoStructure, I am stuck trying to determine how to best select the photos to show on the Chromecast. In my head there are a few user modes.

  1. Pick a “set” of photos and have them Slideshow on the Chromecast. I originally though this would be the feature, but realised I don’t use my Chromecast that way. I suspect this would still be a useful feature though. Manually advancing or going back might be useful too.

  2. I personally tend to select a photo, and then show that whilst I am browsing for another. This is a required feature in my view.

This then brings to mind some further queries:

  1. How do I select an “album” or “set” in PS. I see conversations about this sort thing but don’t seem to be able to find it in my version. 2024.3.3-beta
  2. How to choose to “cast” a photo or a set. I am really unsure how to integrate this into PS short of building a new UI that requests stuff from the PS API and controls the Chromecast. However I confess now, UI is not my Forte. Ideally, there would be a hook in PS that allows “plugins” to add small pieces of functionality to PS.
  3. Maybe I could work with @mrm to inline the sender into the PS code. However he seemed reluctant to support 3rd party systems that might change in future, which is understandable.