In my last blog post, I reported on my initial progress in loading a Visualforce Page on the Google Chromecast, a $35 media player intended for streaming content via HDMI. I was able to deploy the the Google Cast SDK ‘Hello World’ sample to a Visualforce Page on a Force.com Site. That done, my next goal was to display business data from Salesforce on TV via Chromecast. Some investigation and experimentation led me to frontdoor.jsp, formally documented and supported since the Winter ’14 Salesforce release, which “gives users access to Salesforce from a custom Web interface, such as a remote access Force.com site or other API integration, using their existing session ID and the server URL”. To authenticate users with frontdoor.jsp, you pass the server URL and session ID to frontdoor.jsp in this format:

https://instance.salesforce.com/secur/frontdoor.jsp?sid=session_ID&retURL=optional_relative_url_to_open

I found that, with the correct session ID, I could send a frontdoor URL to a ‘receiver’ app on the Chromecast, which would load it into an iframe. To obtain that session ID, I used Kevin O’Hara‘s excellent nforce to build vf-chromecast, a Node.js ‘sender’ app which runs you through the OAuth flow, showing you a list of Visualforce Pages in your org. Pick a Visualforce Page, hit ‘Send’, and the sender app constructs the frontdoor URL, sends it to the receiver app, and you see your page on TV. Since the Chromecast is effectively a tiny Linux computer running Google Chrome, any Visualforce Page will work; pages using the Force.com Streaming API are particularly effective. Here’s one in action:

As soon as I had vf-chromecast running, I realized that I could deploy it on Heroku, so anyone with a Chromecast and API access to Salesforce can display Visualforce Pages on TV via Chromecast. Just go to Visualforce on Chromecast, follow the instructions, and ‘cast’ your charts, tables and dashboards to an HD TV or monitor near you!

If you want to dive deeper, all the code for this project is on GitHub, and I’ve written a series of three posts over at my personal blog with more detail:

Raspberry Pi, Minecraft, and now Chromecast – I’m always looking for new ideas for interesting Salesforce integrations. Leave a comment if you have one!

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS