chromecast-server/chromecast.html

61 строка
1.6 KiB
HTML

<html>
<head>
<title>Mozilla Tab Mirror</title>
<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>
<style>
body {
color: white;
background-color: black;
}
html, body {
margin:0;
padding:0;
}
#video {
width:100%;
height:100%;
margin-left: auto;
margin-right: auto;
}
</style>
<script src="player.js"></script>
</head>
<body>
<video id="video" autoplay="true"></video><br/>
<script>
var divs = {
remote_video : document.getElementById("video") ,
};
var client = new CallingClient(divs);
window.onload = function() {
try {
// Uncomment to set logger level to DEBUG
//cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
window.castReceiverManager.onSenderConnected = function(event) {
log("sender connected: " + JSON.stringify(event));
}
window.castReceiverManager.onReady = function(event) {
log("onReady: " + JSON.stringify(event));
}
window.messageBus = window.castReceiverManager.getCastMessageBus('urn:x-cast:org.mozilla.mirror');
window.messageBus.onMessage = function(event) {
log("onMessage called with: " + event.data);
client.processEvent(event.senderId, event.data);
}
var appConfig = new cast.receiver.CastReceiverManager.Config();
appConfig.statusText = "let's cast";
appConfig.maxInactvity = 6000;
window.castReceiverManager.start(appConfig);
} catch(e) {
log(e);
}
}
</script>
</body>
</html>