I want to show a webpage using Chromecast. The page is currently very simple (just βHello World!β), But I hope to make it more complex and possibly interactive with a second screen. However, I found that if I do not create a media manager ( new cast.receiver.MediaManager(window.mediaElement)), the session immediately expires on my sender (called function sessionUpdateListener(false)). The page is still displayed, but I can no longer interact with it, including stopping the application.
I wonder if this is a design mistake, or am I doing something wrong?
Here is the code for my recipient ...
<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>
source
share