Updating to latest code.
This commit is contained in:
Родитель
6e823bb45f
Коммит
8b1f8e341c
140
chromecast.html
140
chromecast.html
|
@ -4,111 +4,85 @@
|
||||||
<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>
|
<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
color: white;
|
color: yellow;
|
||||||
|
background-color: white;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="adapter.js"></script>
|
<script src="adapter.js?1"></script>
|
||||||
<script src="mozdemo.js?5"></script>
|
<script src="mozdemo.js?1"></script>
|
||||||
<link rel='stylesheet' href="demostyle.css"></link>
|
<link rel='stylesheet' href="demostyle.css?3"></link>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<span>hello</span>
|
<video id="video" autoplay="TRUE"></video><br/>
|
||||||
<span style="color:red">world 5</span>
|
|
||||||
<div id="header"><h2>TabCast: You are the sender</h2></div>
|
|
||||||
<div id="status"></div>
|
|
||||||
<div id="sender_inst">
|
|
||||||
<div>Open this link in another tab or browser</div>
|
|
||||||
<div> <a id="link">right click here</a></div>
|
|
||||||
<div>That other tab or browser will have text in a red box that you'll paste here:</div>
|
|
||||||
<textarea id="answer"></textarea>
|
|
||||||
<button onclick="answer_click()">submit answer</button>
|
|
||||||
</div>
|
|
||||||
<div style="display:none" id="receiver_inst">
|
|
||||||
<div>Copy this text and paste it into the input box of the sender tab</div>
|
|
||||||
<div style="border:thin red solid" id="answer_json"> </div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<div id="remote">
|
<div style="color:green; font-size: xx-small;" id="logwindow"></div>
|
||||||
<div id="remote-caption"><h2>Remote</h1></div>
|
|
||||||
<div>
|
|
||||||
<video style="border:thin blue solid" id="video" width="320" height="240" autoplay="TRUE"></video><br/>
|
|
||||||
</div><br/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style="color:green; font-size: xx-small;" id="logwindow"></div>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
//window.location.reload(true);
|
//window.location.reload(true);
|
||||||
var me = "castee";
|
var me = "castee";
|
||||||
var them = "caster";
|
var them = "caster";
|
||||||
var start = false;
|
var start = false;
|
||||||
document.getElementById("sender_inst").style.display = "none";
|
var extra = {};
|
||||||
document.getElementById("receiver_inst").style.display = "block";
|
if (true ) {
|
||||||
document.getElementById("header").firstChild.innerHTML = "TabCast: You are the reciever";
|
extra.video=true;
|
||||||
|
}
|
||||||
|
if (false ) {
|
||||||
|
extra.audio=true;
|
||||||
|
}
|
||||||
|
if (true ) {
|
||||||
|
extra.demo=true;
|
||||||
|
}
|
||||||
|
if (false ) {
|
||||||
|
extra.turn_only=true;
|
||||||
|
}
|
||||||
|
|
||||||
var extra = {};
|
var senderId = null;
|
||||||
if (true ) {
|
|
||||||
extra.video=true;
|
|
||||||
}
|
|
||||||
if (false ) {
|
|
||||||
extra.audio=true;
|
|
||||||
}
|
|
||||||
if (true ) {
|
|
||||||
extra.demo=true;
|
|
||||||
}
|
|
||||||
if (false ) {
|
|
||||||
extra.turn_only=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var senderId = null;
|
var divs = {
|
||||||
|
local_video : null,
|
||||||
|
remote_video : document.getElementById("video") ,
|
||||||
|
};
|
||||||
|
in_queue = [];
|
||||||
|
var client = new CallingClient({}, me, them, divs, start, extra);
|
||||||
|
|
||||||
var divs = {
|
window.onload = function() {
|
||||||
local_video : null,
|
try {
|
||||||
remote_video : document.getElementById("video") ,
|
cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);
|
||||||
};
|
|
||||||
in_queue = [];
|
|
||||||
var client = new CallingClient({}, me, them, divs, start, extra);
|
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
try {
|
|
||||||
cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);
|
|
||||||
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
|
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
|
||||||
|
|
||||||
window.castReceiverManager.onSenderConnected = function(event) {
|
window.castReceiverManager.onSenderConnected = function(event) {
|
||||||
ui_log("sender connected: " + JSON.stringify(event));
|
ui_log("sender connected: " + JSON.stringify(event));
|
||||||
|
|
||||||
}
|
}
|
||||||
window.castReceiverManager.onReady = function(event) {
|
window.castReceiverManager.onReady = function(event) {
|
||||||
ui_log("on ready");
|
ui_log("on ready");
|
||||||
try {
|
try {
|
||||||
console.log("### Cast Receiver Manager is READY: " + JSON.stringify(event));
|
console.log("### Cast Receiver Manager is READY: " + JSON.stringify(event));
|
||||||
ui_log("onReady: " + JSON.stringify(event));
|
ui_log("onReady: " + JSON.stringify(event));
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
ui_log(e);
|
ui_log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.messageBus = window.castReceiverManager.getCastMessageBus('urn:x-cast:org.mozilla.castin');
|
window.messageBus = window.castReceiverManager.getCastMessageBus('urn:x-cast:org.mozilla.mirror');
|
||||||
ui_log("bus: " + messageBus);
|
ui_log("bus: " + messageBus);
|
||||||
//window.messageBus.broadcast("broadcast");
|
//window.messageBus.broadcast("broadcast");
|
||||||
window.messageBus.onMessage = function(event) {
|
window.messageBus.onMessage = function(event) {
|
||||||
ui_log("onMessage called with: " + event.data);
|
ui_log("onMessage called with: " + event.data);
|
||||||
senderId = event.senderId;
|
senderId = event.senderId;
|
||||||
//window.messageBus.send(event.senderId, "msg");
|
//window.messageBus.send(event.senderId, "msg");
|
||||||
in_queue.push(event.data);
|
in_queue.push(event.data);
|
||||||
//ui_log("msg sent");
|
//ui_log("msg sent");
|
||||||
}
|
}
|
||||||
|
|
||||||
var appConfig = new cast.receiver.CastReceiverManager.Config();
|
var appConfig = new cast.receiver.CastReceiverManager.Config();
|
||||||
appConfig.statusText = "let's cast";
|
appConfig.statusText = "let's cast";
|
||||||
appConfig.maxInactvity = 6000;
|
appConfig.maxInactvity = 6000;
|
||||||
window.castReceiverManager.start(appConfig);
|
window.castReceiverManager.start(appConfig);
|
||||||
|
|
||||||
} catch(e) {ui_log(e);}
|
} catch(e) {ui_log(e);}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -31,3 +31,10 @@ html, body {
|
||||||
clear:both;
|
clear:both;
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#video {
|
||||||
|
width:100%;
|
||||||
|
height:100%;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
|
@ -21,11 +21,6 @@ var color_log = function(msg, color) {
|
||||||
var out_queue = []
|
var out_queue = []
|
||||||
var in_queue = null;
|
var in_queue = null;
|
||||||
|
|
||||||
function answer_click() {
|
|
||||||
var textarea = document.getElementById("answer");
|
|
||||||
in_queue = JSON.parse(textarea.value);
|
|
||||||
console.log("got " + in_queue.length + " messages");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче