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!

tagged , Bookmark the permalink. Trackbacks are closed, but you can post a comment.
  • Matthew Keasling

    What’s the practical advantage of this, over just casting a Chrome tab from your browser?

    • http://blog.superpat.com/ Pat Patterson

      Great question! When you cast a Chrome tab, you’re actually opening a WebRTC session between the Chrome tab and the Chromecast – you’re essentially screen sharing, and you have to keep that tab open, and your laptop on the wifi network, for as long as you want to keep tab casting.

      The mechanism I describe above is the same as running the Netflix or YouTube Chromecast app – you’re actually loading an HTML5 app into the Chrome browser on the device, so, once you select a Visualforce Page, that page is actually loaded on the Chromecast. You can close your laptop, and the page will continue to run indefinitely.

      • Jason Lawrence

        We’re just looking at how to display a customer service dashboard for viewing case information that refreshes regularly during the day.

        This with the new reporting API will go a long way to making things easier.

        Thanks for sharing.

        Jason

  • http://www.EGAFutura.com Juan Manuel Garrido

    Just Awesome!

  • ram_sj

    cool demo! it can be used for new deal alert or leader board stuff in sales team.

  • Kevin O’Hara

    Thanks AGAIN for the nforce love!

  • jeremyb

    We’re looking at digital signage around our manufacturing shop floor. Part of this will include displaying Visualforce pages. It would be perfect if we could integrate this into 3rd party digital signage software such as Rise Vision (built on chrome). Currently we put VF pages onto a Force.com Site and then put the site into an iframe in our digi signage software. That way we can now control rotating VF pages, auto-refresh, and include other things like company announcements and anything else we want displayed. But this requires a connected CPU for the display. Would be cool if it could all be done with Chromecast.

    • http://blog.superpat.com/ Pat Patterson

      A quick search reveals a couple of threads on the Rise Vision community asking about Chromecast, but nothing definite. In principle, it should be possible, but it would need support from RV, I think.

  • IamTheFij

    Instead of using a node/Heroku app, couldn’t this be done directly from a Visualforce page as well by sourcing the Chromecast libraries?

    Cool concept though! I’m sure it’ll be very useful for a lot of people.

    • http://blog.superpat.com/ Pat Patterson

      Yes – you could drop the Cast SDK JS libs into a VF page, but I wanted to avoid having to make changes to existing pages. And you need to run through a ‘full’ OAuth flow to get a token suitable for Frontdoor, so a quick Node app was an efficient way to go. I could have put it all on a site, but I’d have had to roll the OAuth interaction myself.