I want to show a webpage using Chromecast. Currently the page is very simple (just "Hello World!"), but I am hoping to make it more complex and possibly interactive with a second screen. However, I have found that if I don't create a media manager (new cast.receiver.MediaManager(window.mediaElement)
) the session immediately expires on my sender (function sessionUpdateListener(false)
is called). The page is still displayed, but I can no longer interact with it, including stopping the app.
I'm wondering if this is by design, a bug, or am I doing something wrong?
Here is the code to my custom receiver...
<html>
<head>
<title>Hello World Chromecast App</title>
<style type="text/css">
*
{
color: white;
}
</style>
</head>
<body>
<div>Hello World!</div>
<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>
<script type="text/javascript">
window.onload = function () {
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
window.castReceiverManager.start();
}
</script>
</body>
</html>