Presentation API demo in Chrome / using Presentation API in a HTML5 game

677 views
Skip to first unread message

Andreas Røsdal

unread,
Jan 31, 2016, 7:22:33 AM1/31/16
to Chromium-discuss
Hello!

In Chrome 48 it was announced support for the presentation API. I would like to use the presentation API 
to add support to Freeciv-web for displaying the game on TV using the attached Chromecast, controlled by an Android phone.

When I tried the "Presentation API Demonstration", I have some questions:
I tried this demo using Chrome Dev on Android 6 to cast to a Chromecast (1st gen),
and when I click "Start" and select to connect to the Chromecast. The Chromecast then displays
a blank screen with a chromecast icon. 

I would like to display the game map Javascript webapp on the Chromecast/TV, and some controller Javascript webapp on the Android device.
The source code of the game can be found on Github:  https://github.com/freeciv/freeciv-web

-How can I modify this demo to display a new webpage url on the Chromecast/TV? Are there other code examples for displaying a separate webpage
on the Chromecast using the Presentation API?

- The demo doesn't work on Chrome on Windows. When will this support be implemented there? It would be easier for development.

Thanks in advance! 

Regards,
Andreas

Mounir Lamouri

unread,
Feb 1, 2016, 11:04:41 AM2/1/16
to Andreas Røsdal, Chromium-discuss, ava...@chromium.org, dut...@google.com
Hi Andreas,

I'm glad to hear that you want to get FreeCiv working with the
Presentation API. It sounds like a nice feature to be able to play using
the phone as a controller.

The Presentation API as it is implemented in Chrome Android doesn't
allow you to present an arbitrary page to the Chrome Cast device. You
can only talk to a Chrome Cast application. We are working on allowing
the client (ie. the phone) to send pixels to display but the rendering
will happen on the phone. This should be close enough to what you are
requesting.

However, I think you should be able to offer a great experience to the
players if you were to create a FreeCiv Chrome Cast application. This
application could display the page you want it to display and could talk
to Chrome Android via the Presentation API.

Cheers,
-- Mounir

On Sun, 31 Jan 2016, at 12:22, Andreas Røsdal wrote:
> Hello!
>
> In Chrome 48 it was announced
> <https://blog.chromium.org/2015/12/chrome-48-beta-present-to-cast-devices_91.html>
> support
> for the presentation API. I would like to use the presentation API
> to add support to Freeciv-web <https://play.freeciv.org/> for displaying
> the game on TV using the attached Chromecast, controlled by an Android
> phone.
>
> When I tried the "Presentation API Demonstration
> <https://storage.googleapis.com/presentation-api/index.html>", I have
> some
> questions:
> I tried this demo using Chrome Dev on Android 6 to cast to a Chromecast
> (1st gen),
> and when I click "Start" and select to connect to the Chromecast. The
> Chromecast then displays
> a blank screen with a chromecast icon.
>
> I would like to display the game map Javascript webapp on the
> Chromecast/TV, and some controller Javascript webapp on the Android
> device.
> The source code of the game can be found on Github:
> https://github.com/freeciv/freeciv-web
>
> -How can I modify this demo to display a new webpage url on the
> Chromecast/TV? Are there other code examples for displaying a separate
> webpage
> on the Chromecast using the Presentation API?
>
> - The demo doesn't work on Chrome on Windows. When will this support be
> implemented there? It would be easier for development.
>
> Thanks in advance!
>
> Regards,
> Andreas
>
> --
> --
> Chromium Discussion mailing list: chromium...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-discuss
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Chromium-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to chromium-discu...@chromium.org.

Anton Vayvod

unread,
Feb 1, 2016, 12:20:09 PM2/1/16
to Mounir Lamouri, Andreas Røsdal, Chromium-discuss, Sam Dutton
It launches the Default Media Receiver on the Cast device. There's no way to control it via Presentation API directly so it doesn't do much :)
 
>
> I would like to display the game map Javascript webapp on the
> Chromecast/TV, and some controller Javascript webapp on the Android
> device.
> The source code of the game can be found on Github:
> https://github.com/freeciv/freeciv-web
>
> -How can I modify this demo to display a new webpage url on the
> Chromecast/TV? Are there other code examples for displaying a separate
> webpage
> on the Chromecast using the Presentation API?


So far the Presentation API on Android can only be reasonably used via the Web Cast SDK. We're working on implementing and shipping a generic version of the API that would be used directly with Cast devices by rendering any URL on the phone and presenting the contents to the presentation screen this year but there's no concrete milestones yet.
 
>
> - The demo doesn't work on Chrome on Windows. When will this support be
> implemented there? It would be easier for development.

I believe you can try it out by going to chrome://flags and check the "Enable Media Router" flag. The desktop team doesn't want to roll it out for 100% of users yet to avoid breaking all the existing users of the Google Cast extension. If all goes well, it will ship in a release or two.
Reply all
Reply to author
Forward
0 new messages