65 lines
2.8 KiB
HTML
65 lines
2.8 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<title>Magnoliyan Video Chat</title>
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
|
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
|
||
|
|
<link rel="stylesheet" href="../../mgVideoChat/mgVideoChat-1.15.0.css">
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div class="container">
|
||
|
|
<h1>MgVChat <small>Private</small></h1>
|
||
|
|
<div class="alert alert-info" role="alert">
|
||
|
|
<p>Share this <code id="privateUrl"></code> private url to someone to join you here.</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div id="mgVideoChat"></div>
|
||
|
|
|
||
|
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||
|
|
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
|
||
|
|
<!-- Video Chat -->
|
||
|
|
<script src="../../mgVideoChat/mgVideoChat-1.15.0-min.js"></script>
|
||
|
|
<script src="../common/js/menu.js"></script>
|
||
|
|
<script>
|
||
|
|
//get query string param
|
||
|
|
function getParameterByName(name) {
|
||
|
|
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||
|
|
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||
|
|
results = regex.exec(location.search);
|
||
|
|
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||
|
|
}
|
||
|
|
//update query strung parameter
|
||
|
|
function updateQueryStringParameter(uri, key, value) {
|
||
|
|
var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i");
|
||
|
|
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
|
||
|
|
if (uri.match(re)) {
|
||
|
|
return uri.replace(re, '$1' + key + "=" + value + '$2');
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
return uri + separator + key + "=" + value;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//get random number
|
||
|
|
function getRandomInt (min, max) {
|
||
|
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||
|
|
}
|
||
|
|
|
||
|
|
$(document).ready(function(){
|
||
|
|
//read chat room
|
||
|
|
var room = getParameterByName('room');
|
||
|
|
//no private chat room?
|
||
|
|
if(!room){
|
||
|
|
//get one
|
||
|
|
room = getRandomInt(1000, 100000);
|
||
|
|
//redirect to chat room url
|
||
|
|
window.location.href = updateQueryStringParameter(window.location.href,'room',room);
|
||
|
|
}
|
||
|
|
$('#privateUrl').text(window.location.href);
|
||
|
|
//init video chat
|
||
|
|
$('#mgVideoChat').mgVideoChat({
|
||
|
|
wsURL: wsUrlDefault + '?room=' + room
|
||
|
|
});
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|