提交 04fe009a authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-9742: [mod_conference,mod_cv] Refactor canvas zoom code

上级 3dccd0a8
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
.nthChildTest > div:nth-child(odd) {
display: none;
}
.jsDataTable > thead > tr > th {
border-width:4px;
padding: 2px;
font-size:10pt;
text-align: left;
}
.jsDataTable > thead > tr > th.notSortable {
padding: 5px;
}
.jsDataTable > tbody > tr > td {
border-bottom: 1px solid #ccc;
padding: 2px;
vertical-align: middle;
height:25px;
font-size: 10px;
}
.jsDataTable {
font-family: verdana;
font-size:10pt;
}
.jsDataTable > tbody > tr:nth-child(odd),
.jsDataTable > tbody > tr.odd {
background-color: #ffffee;
}
.jsDataTable > tbody > tr:nth-child(even),
.jsDataTable > tbody > tr.even {
background-color: #ffffff;
}
.jsDataTable > thead th.sortAsc,
.jsDataTable > thead th.sortDesc {
color:ffffff;
background-color: #7777ff;
background-position: right center;
background-repeat: no-repeat;
}
.jsDataTable > thead th.sortAsc {
background-image: url(/images/table/asc.png);
}
.jsDataTable > thead th.sortDesc {
background-image: url(/images/table/desc.png);
}
.jsDataTable.clickable > tbody > tr,
.clickable > .jsDataTable > tbody > tr {
cursor: pointer;
}
.jsDataTable.clickable > tbody > tr.nonDataRow,
.clickable > .jsDataTable > tbody > tr.nonDataRow {
cursor: auto;
}
<include>
<extension name="h" continue="true">
<condition field="destination_number" expression="^h264_(.*)$" break="never">
<action application="set" data="absolute_codec_string=opus,pcmu,h264"/>
<action application="transfer" data="$1"/>
</condition>
</extension>
<extension name="v" continue="true">
<condition field="destination_number" expression="^vp8_(.*)$" break="never">
<action application="set" data="absolute_codec_string=opus,pcmu,vp8"/>
<action application="transfer" data="$1"/>
</condition>
</extension>
<extension name="h" continue="true">
<condition field="destination_number" expression="^hbr_(.*)$" break="never">
<action application="export" data="nolocal:absolute_codec_string=opus,pcmu,h264"/>
<action application="transfer" data="$1"/>
</condition>
</extension>
<extension name="v" continue="true">
<condition field="destination_number" expression="^vbr_(.*)$" break="never">
<action application="export" data="nolocal:absolute_codec_string=opus,pcmu,vp8"/>
<action application="transfer" data="$1"/>
</condition>
</extension>
<extension name="bug">
<condition field="destination_number" expression="^vbr_(.*)$">
<action application="set" data="absolute_codec_string=pcmu,vp8"/>
<action application="answer"/>
<action application="bridge" data="vlc//var/www/vid/$1" />
</condition>
</extension>
<extension name="bug">
<condition field="destination_number" expression="^vid_(.*)$">
<action application="answer"/>
<action application="play_video" data="/var/www/vid/$1" />
</condition>
</extension>
<extension name="bug">
<condition field="destination_number" expression="^decode$|^9952$">
<action application="answer"/>
<action application="set" data="hold_music=silence_stream://-1"/>
<action application="decode_video"/>
</condition>
</extension>
</include>
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Replace the clientid Here with your Client ID. -->
<meta name="google-signin-clientid" content="675954646436-qs593t199b1nt7gj0v6p4njau8724oss.apps.googleusercontent.com">
<meta name="google-signin-scope" content="https://www.googleapis.com/auth/plus.profile.emails.read"/>
<meta name="google-signin-requestvisibleactions" content="http://schema.org/AddAction" />
<meta name="google-signin-cookiepolicy" content="single_host_origin" />
<!------>
<link rel="stylesheet" href="css/jquery.mobile.min.css"/>
<link rel="stylesheet" type="text/css" href="css/jsontable.css" />
<link rel="shortcut icon" href="favicon.ico" />
<meta charset="utf-8" />
<title>FreeSWITCH Verto&trade; Video Transcoding Demo</title>
<style type="text/css">
.pageheader {
font-size: 22px;
font-weight: normal;
height: 27px;
}
.ctlbtn {
border: 2px;
border-style:outset;
color: #ffffff;
min-width: 125px;
background-color: #666666;
font-face: arial;
height:18px;
font-size:7pt;
}
.ctlbtn:hover {
color: #ffffae;
cursor: pointer;
}
.vidbtn {
font-face: arial;
font-size:7pt;
}
#chatwin
{
background-color: #eeeeee;
width: 500px;
height:150px;
overflow-y: scroll;
scrolling: auto;
text-align: left;
border-style:inset;
font-size: 10pt;
color: #3333ff;
resize:both;
}
.chatuid
{
font-size: 7pt;
font-weight: bold;
color: #ff3333;
}
.chatimg
{
max-width:100px;
}
.l1
{
border:1;
background-color:#fefefe;
height:1px;
opacity:0.4;
}
#chatmsg
{
width:400px;
max-height:40px;
}
div#preload { display: none; }
</style>
</head>
<body>
<div data-role="page" id="page-login" align="center">
<div data-role="header" class="page-header">
FreeSWITCH Verto&trade; Video Transcoding Demo
</div>
</div>
<div data-role="page" id="page-enum" align="center">
<div data-role="header" class="page-header">
FreeSWITCH Verto&trade; Looking For Devices
</div>
<div id="search" hidden="true">
<img src="images/search.gif"/>
</div>
</div>
<div data-role="page" id="page-bwtest" align="center">
<div data-role="header" class="page-header">
FreeSWITCH Verto&trade; Testing Network Connection
</div>
<h1>Testing Network Connection</h1>
<img src="images/speed.gif"/>
</div>
<div data-role="page" id="page-incall" align="center">
<div data-role="header" id="calltitle" class="pageheader">
Verto&trade; IN CALL
</div>
<div id="fs" xstyle="width:100%;height:100%">
<div id="rows" style="background-color:#f9f9f9">
<span id=usrinner style="margin:25px">
<span id=usrctl><b>User Controls</b></span>
<div id=usr2>
<div id="canvasButtons" hidden="true">
<button data-inline="true" id="hupbtn2">End Call</button>
<button data-inline="true" id="fullbtn2">Enter Full Screen</button>
</div>
<div id="mainButtons">
<button data-inline="true" id="hold">HOLD</button>
<button data-inline="true" id="hupbtn">End Call</button>
<button data-inline="true" id="mutebtn">Toggle Audio Mute</button>
<button data-inline="true" id="localmutebtn">Toggle Local Audio Mute</button>
<button data-inline="true" id="localvidmutebtn">Toggle Local Video Mute</button>
<!-- <button data-inline="true" class="startxferbtn">Transfer</button>-->
<span class="sharediv">
<button data-inline="true" id="sharebtn">Share</button>
<button data-inline="true" id="nosharebtn">End Share</button>
</span>
<span class="sharediv">
<button data-inline="true" id="smallerbtn">Smaller - </button>
<button data-inline="true" id="biggerbtn">Bigger +</button>
<button data-inline="true" id="fullbtn">Enter Full Screen</button>
<button data-inline="true" id="vmutebtn">Toggle Video Mute</button>
</span>
</div>
<br><br>
<div id="conf" xstyle="width:100%;height:100%">
<div style="color:black;font-family: verdana" align="center" id="conf_count"></div><br>
<table width="1400" cellspacing="0" cellpadding="0" border="0" align="center" id="conf_list" class="jsDataTable">
</table>
<div id="canvasui" style="width:700px;" hidden="true">
<br><br>
<table border=0 cellspacing=0 cellpadding=0>
<tr><td width=180><b>Additional Canvas</b>:</td><td><select style="width:200px;" id="canvasid"></select></td><td width=220 align=right><button id="canvasbut" style="width:200px;">Open Canvas</button></td></tr>
</table>
<br><br>
</div>
</div><!---conf-->
<div id="message" hidden="true">
<hr class="l1" width="500"/>
<div id="chatwin"></div>
<!-- <textarea readonly id="chatwin"></textarea>-->
<table><tr><td><textarea id="chatmsg"></textarea></td><td><button id="chatsend" style="width:100px;">Send</button></td></tr></table>
<hr class="l1" width="500"/><br>
</div>
<div id="hctop" hidden="true">
<br/><br/>
<div id="hcmessage"></div>
<br><br>
</div>
<div class="ui-field-contain" id="xferdiv">
<input data-mini="true" type="text" id="xferto"><br>
<button data-inline="true" id="cancelxferbtn">Cancel Transfer</button>
<button data-inline="true" class="startxferbtn">Complete Transfer</button>
</div>
<img src="img/verto_black_web.gif" width="300"><br><br>
<div id=keypad>
<button class="dtmf" data-inline="true">1</button>
<button class="dtmf" data-inline="true">2</button>
<button class="dtmf" data-inline="true">3</button>
<br>
<button class="dtmf" data-inline="true">4</button>
<button class="dtmf" data-inline="true">5</button>
<button class="dtmf" data-inline="true">6</button>
<br>
<button class="dtmf" data-inline="true">7</button>
<button class="dtmf" data-inline="true">8</button>
<button class="dtmf" data-inline="true">9</button>
<br>
<button class="dtmf" data-inline="true">*</button>
<button class="dtmf" data-inline="true">0</button>
<button class="dtmf" data-inline="true">#</button>
</div>
<br><br>
<div id="conf_mod" style="width:450px"></div>
<div style="color:blue" id="conf_display"></div>
</span>
</div>
</div><!-- fs -->
<style>
#webcam_overlay {
position:absolute;
width:100%;
height: 100%;
float:left;
z-index:10;
object-fit:inherit;
}
.webcam_layer {
position:absolute;
z-index:20;
}
.webcam_layer:hover {
//background-color:#dddddd;
//opacity: 0.5;
z-index: 21;
cursor:pointer;
}
.selection-box {
position:absolute;
object-fit:inherit;
opacity: 0.5;
border: 1px dotted #000;
z-index: 400;
}
</style>
<div id=webcam_overlay></div>
<video id="webcam" autoplay="autoplay" style="width:100%;height:100%;object-fit:inherit;z-index:0"></video>
<br><br>
<table><tr><td>
<div style="width:500px;max-height:300px;overflow-y:scroll;display:block;unicode-bidi:embed;font-family:tahoma;white-space:pre;size:14pt;text-align:left" id="rtt_in"></div>
</td></tr>
<tr><td>
<textarea style="width:500px;height:200px" id="rtt"></textarea>
</td></tr>
</table>
<!--<video id="local_webcam" autoplay="autoplay" style="width:100%;height:100%;object-fit:inherit;"></video>-->
</div><!-- rows -->
<br><br>
</div>
<div data-role="page" id="page-main" align="center">
<div data-role="header" class="pageheader">
FreeSWITCH Verto&trade; Video Transcoding Demo (<span id="bwinfo">*checking*</span>)
</div>
<br>
<center> <table width="1024" border="0">
<tr><td> <center><a target="_CC2104" href="https://www.cluecon.com"><img border="0" width="300" src="img/cc_banner.gif"></a></center></td>
<td><center> <img src="img/verto_black_web.gif" width="300"></center>
</td></tr>
</table></center><br><br>
<div id="offline">
<div id="errordisplay" style="font-weight:bold;font-size:18px;color:#ae0000"></div>
<div class="ui-field-contain">
<label for="name">Login</label>
<input type="text" size="20" id="login"/>
</div>
<div class="ui-field-contain">
<label for="name">Password</label>
<input type="password" size="20" id="passwd"/>
</div>
<!--
<div class="ui-field-contain">
<label for="name">CID Name</label>
<input type="text" size="30" class="name"/>
</div>
<div class="ui-field-contain">
<label for="name">CID Number</label>
<input type="text" size="20" class="cid"/>
</div>
-->
<div class="ui-field-contain">
<label for="name">Hostname</label>
<input type="text" size="20" id="hostName"/>
</div>
<div class="ui-field-contain">
<label for="name">Websocket URL</label>
<input type="text" size="20" id="wsURL"/>
</div>
<br><br>
<img src="img/verto_black_web.gif" width="300">
<br><br>
<button data-inline="true" id="loginbtn">Log In</button>
<script>
function playvid(file)
{
$("#ext").val("vid_" + file);
$("#callbtn").click();
}
function dial(ext)
{
$("#ext").val(ext);
$("#callbtn").click();
}
</script>
<br><br><br>
</div>
<div id="online" align="center" style="width:75%">
<div class="ui-field-contain">
<script>
function toggle_demo() {
if ($('#demos').is(':visible')) {
$('#demos').hide();
$('#showdemo').text("Show Demo Extensions");
} else {
$('#devices').hide();$('#showdevices').show();$('#demos').show();
$('#showdemo').text("Hide Demo Extensions");
}
}
function toggle_device() {
if ($('#devices').is(':visible')) {
$('#devices').hide();
$('#showdevices').text("View Device Settings");
} else {
$('#devices').show();$('#demos').hide();
$('#showdevices').text("Hide Device Settings");
}
}
</script>
<!--<button data-inline="true" id="showdemo" onclick="toggle_demo();">View Demo Extensions</button>-->
<button data-inline="true" id="showdevices" onclick="toggle_device();">View Device Settings</button>
<button data-inline="true"id="speedbtn">Check Speed</button>
<button data-inline="true"id="logoutbtn">Log Out</button>
<div id="devices" style="border-style:outset;border-width:2px">
<div id="camdiv">
<legend><b>Camera</b>:</legend><select data-theme="a" data-overlay-theme="a" data-native-menu="false" id="usecamera"></select>
<br>
<legend><b>Share Device</b>:</legend><select data-theme="a" data-overlay-theme="a" data-native-menu="false" id="useshare"></select>
<br><br></div>
<legend><b>Microphone</b>:</legend><select data-theme="a" data-overlay-theme="a" data-native-menu="false" id="usemic"></select>
<br>
<legend><b>Speaker</b>:</legend><select data-theme="a" data-overlay-theme="a" data-native-menu="false" id="usespeak"></select>
<Br clear="all"><Br>
<div style="xvisibility:hidden">
<label><input id="use_vid" type="checkbox" value="foo" > Use Video</label>
<label><input id="use_stereo" type="checkbox" value="foo" > Stereo Audio</label>
<label><input id="use_stun" type="checkbox" value="foo" > Use STUN</label>
<!-- <label><input id="local_video" type="checkbox" value="foo" > Local Video</label>-->
</div>
<Br clear="all">
<br><br>
<div >
<fieldset data-role="controlgroup" data-type="horizontal">
<legend><b>Video Quality</b>:</legend>
<input type="radio" name="vqual" id="vqual_qqvga" value="qqvga">
<label for="vqual_qqvga">QQVGA 160x120</label>
<input type="radio" name="vqual" id="vqual_qvga" value="qvga">
<label for="vqual_qvga">QVGA 320x240</label>
<input type="radio" name="vqual" id="vqual_vga" value="vga">
<label for="vqual_vga">VGA 640x480</label>
<input type="radio" name="vqual" id="vqual_qvga_wide" value="qvga_wide">
<label for="vqual_qvga_wide">QVGA WIDE 320x180</label>
<input type="radio" name="vqual" id="vqual_vga_wide" value="vga_wide">
<label for="vqual_vga_wide">VGA WIDE 640x360</label>
<input type="radio" name="vqual" id="vqual_hd" value="hd">
<label for="vqual_hd">HD 1280x720</label>
<input type="radio" name="vqual" id="vqual_hhd" value="hhd">
<label for="vqual_hhd">HHD 1920x1080</label>
</fieldset>
</div><br clear="all"><br>
<div >
<fieldset data-role="controlgroup" data-type="horizontal">
<legend><b>Max Outgoing Bandwidth</b>:</legend>
<input type="radio" name="outgoingBandwidth" id="outgoingBandwidth_250kb" value="250">
<label for="outgoingBandwidth_250kb">250kb</label>
<input type="radio" name="outgoingBandwidth" id="outgoingBandwidth_500kb" value="500">
<label for="outgoingBandwidth_500kb">500kb</label>
<input type="radio" name="outgoingBandwidth" id="outgoingBandwidth_1024kb" value="1024">
<label for="outgoingBandwidth_1024kb">1mb</label>
<input type="radio" name="outgoingBandwidth" id="outgoingBandwidth_1536kb" value="1536">
<label for="outgoingBandwidth_1536kb">1.5mb</label>
<input type="radio" name="outgoingBandwidth" id="outgoingBandwidth_2048kb" value="2048">
<label for="outgoingBandwidth_2048kb">2mb</label>
<input type="radio" name="outgoingBandwidth" id="outgoingBandwidth_5120kb" value="5120">
<label for="outgoingBandwidth_5120kb">5mb</label>
<input type="radio" name="outgoingBandwidth" id="outgoingBandwidth_0kb" value="0">
<label for="outgoingBandwidth_0kb">No Limit</label>
<input type="radio" name="outgoingBandwidth" id="outgoingBandwidth_default" value="default">
<label for="outgoingBandwidth_default">Server Default</label>
</fieldset>
</div><br clear="all"><br>
<div >
<fieldset data-role="controlgroup" data-type="horizontal">
<legend><b>Max Incoming Bandwidth</b>:</legend>
<input type="radio" name="incomingBandwidth" id="incomingBandwidth_250kb" value="250">
<label for="incomingBandwidth_250kb">250kb</label>
<input type="radio" name="incomingBandwidth" id="incomingBandwidth_500kb" value="500">
<label for="incomingBandwidth_500kb">500kb</label>
<input type="radio" name="incomingBandwidth" id="incomingBandwidth_1024kb" value="1024">
<label for="incomingBandwidth_1024kb">1mb</label>
<input type="radio" name="incomingBandwidth" id="incomingBandwidth_1536kb" value="1536">
<label for="incomingBandwidth_1536kb">1.5mb</label>
<input type="radio" name="incomingBandwidth" id="incomingBandwidth_2048kb" value="2048">
<label for="incomingBandwidth_2048kb">2mb</label>
<input type="radio" name="incomingBandwidth" id="incomingBandwidth_5120kb" value="5120">
<label for="incomingBandwidth_5120kb">5mb</label>
<input type="radio" name="incomingBandwidth" id="incomingBandwidth_0kb" value="0">
<label for="incomingBandwidth_0kb">No Limit</label>
<input type="radio" name="incomingBandwidth" id="incomingBandwidth_default" value="default">
<label for="incomingBandwidth_default">Server Default</label>
</fieldset>
</div><br clear="all"><br>
<label><input id="use_dedenc" type="checkbox" value="foo" > Use Dedicated Remote Encoder</label>
<label><input id="mirror_input" type="checkbox" value="foo" >Scale Remote Video To Match Camera</label>
<br><br>
<center><button data-inline="true" id="refreshbtn">Refresh Device List</button>
<button data-inline="true" id="hidedevices" onclick="toggle_device()">Save Device Settings</button>
</center>
<Br clear="all"><br>
</div>
<br><br>
<div id="demos" style="border-style:outset">
<h2>Video Streaming (USE STEREO HEADPHONES IF POSSIBLE)</h2>
<div style="border-style:inset;border-width:1px;background-color:#eeeeee">
<button class="vidbtn" data-inline="true" onclick="playvid('vuc.mp4')">FreeSWITCH Team on VUC (Summer 2014)</button>
<button class="vidbtn" data-inline="true" onclick="playvid('briancc.mp4')">Brian West ClueCon Spot (Summer 2010)</button>
<button class="vidbtn" data-inline="true" onclick="playvid('bin1.mp4')">Binaural Audio Demo</button>
<button class="vidbtn" data-inline="true" onclick="playvid('binrafting.mp4')">Binaural River Rafting</button>
<button class="vidbtn" data-inline="true" onclick="playvid('splash.mp4')">Binaural Splash Mountian</button>
<br>
<button class="vidbtn" data-inline="true" onclick="playvid('3d_demo.mp4')">Binaural Spatial Demo</button>
<button class="vidbtn" data-inline="true" onclick="playvid('gravity.mp4')">Gravity Movie Trailer(2k)</button>
<button class="vidbtn" data-inline="true" onclick="playvid('awesome1.mp4')">Everything is Awesome</button>
<button class="vidbtn" data-inline="true" onclick="playvid('awesome2.mp4')">Everything is Awesome 2</button>
<button class="vidbtn" data-inline="true" onclick="playvid('sirius.mp4')">Sirius Live</button>
<br>
<button class="vidbtn" data-inline="true" onclick="playvid('swimp.mp4')">Imperial March Live</button>
<button class="vidbtn" data-inline="true" onclick="playvid('imphd.mp4')">Imperial March on Floppy Drives</button>
<button class="vidbtn" data-inline="true" onclick="playvid('notime.mp4')">Ain't Nobody Got Time</button>
<button class="vidbtn" data-inline="true" onclick="playvid('hdtest.mp4')">Video HD Demo</button>
</div>
<br>
<h2>Codec Test and Conference</h2>
<div style="border-style:inset;border-width:1px;background-color:#eeeeee">
<button class="vidbtn" data-inline="true" onclick="dial('decode')">Video from your Webcam decoded then re-encoded w/ MOH</button>
<button class="vidbtn" data-inline="true" onclick="dial('3500')">Video Transcoded Conference</button>
</div>
</div>
<br><br><br><hr><br>
<div class="ui-field-contain" style="text-align:right;">
<label for="name">Name</label>
<input type="text" size="30" id="cidname"/>
</div>
<div class="ui-field-contain" style="text-align:right;">
<label for="name">CID Number</label>
<input type="text" size="20" id="cid"/>
</div>
<div class="ui-field-contain" style="text-align:right;">
<label for="name">Email</label>
<input type="text" size="20" id="email"/>
</div>
<div class="ui-field-contain" style="text-align:right;">
<label for="name">Avatar</label>
<input type="text" size="20" id="avatar" />
</div>
<div class="ui-field-contain" style="text-align:right;">
<label for="name">Extension</label>
<input type="text" id="ext""/>
</div>
<img width="200" id="avatar_img"/><br>
<!--Comment out to "EOC" comment to disable Googleb Login -->
<button data-inline="true" id="signinButton">Import Google Credentials</button>
<!--<button data-inline="true" id="signoutButton">Sign out with Google</button>-->
<button data-inline="true" id="callbtn">Call Extension</button>
<br>
<hr>
<br><br>
<div style="color:blue" id="main_info">&nbsp;</div><br><br>
</div>
<br>
<br>
<!--
<b>TEXT</b><br>To: <input type="text" size="20" id="textto"/> MSG: <input type="text" size="40" id="textmsg"/>
<button id="vtxtbtn">Send</button>
-->
</div>
<table id="directory" width=500 style="font-size:11pt;font-face:arial">
<tr><td align=center colspan=2><b>FreeSWITCH VERTO&trade; WebRTC Demo Directory<Br><br></td></tr>
<tr><td width=100><b>Dial</b></td><td><b>Desc</b></td></tr>
<tr><td align=left colspan=2><hr></td></tr>
<tr><td>3d1</td><td> 3D sound demo #1</td></tr>
<tr><td>3d2</td><td> 3D sound demo #2</td></tr>
<tr><td>stereo1</td><td> Stereo sound demo #1</td></tr>
<tr><td>stereo2</td><td> Stereo sound demo #2</td></tr>
<tr><td>stereo3</td><td> Stereo sound demo #3</td></tr>
<tr><td>3500</td><td>Local 48k Stereo Conference</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>cluecon</td><td> ClueCon Hotline</td></tr>
<tr><td>&lt;number&gt;</td><td>Call a US/Canda Number</td></tr>
<tr><td>vuc</td><td>VoIP Users Conference</td></tr>
<tr><td>888</td><td>FreeSWITCH Community Conference</td></tr>
<tr><td>3300</td><td>Local 48k Conference</td></tr>
<tr><td>5000</td><td>Try the Demo IVR</td></tr>
<tr><td>9664</td><td>Listen to Hold Music</td></tr>
<tr><td>9386</td><td>Funny Prompts</td></tr>
<tr><td>9198</td><td>Tetris (tone generator)</td></tr>
<tr><td colspan=2><Br>
<center>
<br><br><br>
</td></tr>
</td></tr>
</table>
</div><!-- /page -->
<div data-role="page" id="dialog-logout" data-close-btn="none">
<div data-role="header">
<h2>Logged Out</h2>
</div>
<div data-role="content">
<p>You have been logged out or disconnected from the server.</p>
<button onclick="$('#dialog-logout').dialog('close')">OK</button>
</div>
</div>
<div data-role="page" id="dialog-login-error" data-close-btn="none">
<div data-role="header">
<h2>Login Error</h2>
</div>
<div data-role="content">
<p>Error logging in</p>
<button onclick="$('#dialog-login-error').dialog('close')">OK</button>
</div>
</div>
<div data-role="page" id="dialog-hold" data-close-btn="none">
<div data-role="header">
<h2>Call On hold</h2>
</div>
<div data-role="content">
<p>The call is on hold</p>
<button onclick="$('#dialog-hold').dialog('close');cur_call.toggleHold();">Resume Call</button>
</div>
</div>
<div data-role="page" id="dialog-incoming-call" data-close-btn="none">
<div data-role="header">
<h2>Incoming Call</h2>
</div>
<div data-role="content">
<div id="dialog-incoming-call-txt"><p>Incoming Call</p></div>
<button id="ansbtn">Answer</button>
<div id="vansdiv"><button id="vansbtn">Answer Video</button></div>
<button id="declinebtn">Decline</button>
</div>
</div>
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile.min.js"></script>
<script type="text/javascript" src="js/jquery.json-2.4.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/verto-min.js"></script>
<script type="text/javascript" src="js/getScreenId.js"></script>
<script type="text/javascript" src="js/md5.min.js"></script>
<script type="text/javascript" src="js/jquery.hipchat.js"></script>
<script type="text/javascript" src="verto.js"></script>
<script src="https://apis.google.com/js/client:platform.js?onload=render" async defer></script>
<div id="preload" hidden=true>
<img src="images/search.gif"/>
</div>
</body>
</html>
// Last time updated at Sep 07, 2014, 08:32:23
// Latest file can be found here: https://cdn.webrtc-experiment.com/getScreenId.js
// Muaz Khan - www.MuazKhan.com
// MIT License - www.WebRTC-Experiment.com/licence
// Documentation - https://github.com/muaz-khan/WebRTC-Experiment/tree/master/getScreenId.js
// ______________
// getScreenId.js
/*
getScreenId(function (error, sourceId, screen_constraints) {
// error == null || 'permission-denied' || 'not-installed' || 'installed-disabled' || 'not-chrome'
// sourceId == null || 'string' || 'firefox'
if(sourceId == 'firefox') {
navigator.mozGetUserMedia(screen_constraints, onSuccess, onFailure);
}
else navigator.webkitGetUserMedia(screen_constraints, onSuccess, onFailure);
});
*/
(function() {
window.getScreenId = function(callback) {
// for Firefox:
// sourceId == 'firefox'
// screen_constraints = {...}
if (!!navigator.mozGetUserMedia) {
callback(null, 'firefox', {
video: {
mozMediaSource: 'window',
mediaSource: 'window'
}
});
return;
}
postMessage();
window.addEventListener('message', onIFrameCallback);
function onIFrameCallback(event) {
if (!event.data) return;
if (event.data.chromeMediaSourceId) {
if (event.data.chromeMediaSourceId === 'PermissionDeniedError') {
callback('permission-denied');
} else callback(null, event.data.chromeMediaSourceId, getScreenConstraints(null, event.data.chromeMediaSourceId));
}
if (event.data.chromeExtensionStatus) {
callback(event.data.chromeExtensionStatus, null, getScreenConstraints(event.data.chromeExtensionStatus));
}
// this event listener is no more needed
window.removeEventListener('message', onIFrameCallback);
}
};
function getScreenConstraints(error, sourceId) {
var screen_constraints = {
audio: false,
video: {
mandatory: {
chromeMediaSource: error ? 'screen' : 'desktop',
maxWidth: window.screen.width > 1920 ? window.screen.width : 1920,
maxHeight: window.screen.height > 1080 ? window.screen.height : 1080
},
optional: []
}
};
if (sourceId) {
screen_constraints.video.mandatory.chromeMediaSourceId = sourceId;
}
return screen_constraints;
}
function postMessage() {
if (!iframe.isLoaded) {
setTimeout(postMessage, 100);
return;
}
iframe.contentWindow.postMessage({
captureSourceId: true
}, '*');
}
var iframe = document.createElement('iframe');
iframe.onload = function() {
iframe.isLoaded = true;
};
iframe.src = 'https://www.webrtc-experiment.com/getSourceId/';
iframe.style.display = 'none';
(document.body || document.documentElement).appendChild(iframe);
})();
This diff was suppressed by a .gitattributes entry.
/*!
* jQuery Cookie Plugin v1.3.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function ($, document, undefined) {
var pluses = /\+/g;
function raw(s) {
return s;
}
function decoded(s) {
return unRfc2068(decodeURIComponent(s.replace(pluses, ' ')));
}
function unRfc2068(value) {
if (value.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape
value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
return value;
}
function fromJSON(value) {
return config.json ? JSON.parse(value) : value;
}
var config = $.cookie = function (key, value, options) {
// write
if (value !== undefined) {
options = $.extend({}, config.defaults, options);
if (value === null) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = config.json ? JSON.stringify(value) : String(value);
return (document.cookie = [
encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// read
var decode = config.raw ? raw : decoded;
var cookies = document.cookie.split('; ');
var result = key ? null : {};
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = decode(parts.join('='));
if (key && key === name) {
result = fromJSON(cookie);
break;
}
if (!key) {
result[name] = fromJSON(cookie);
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) !== null) {
$.cookie(key, null, options);
return true;
}
return false;
};
})(jQuery, document);
This diff was suppressed by a .gitattributes entry.
(function ($) {
// Creates an iframe with an embedded HipChat conversation window.
//
// Options:
// url - The url to the room to embed; required
// container - The container in which to insert the HipChat panel; required
// timezone - The timezone to use in the embedded room; required
// welcome - A welcome message to display when the room is joined; optional
// noframes - Content to include when iframes are disabled in the browser; optional
// width - The width of the iframe; defaults to 100%
// height - The height of the iframe; defaults to 400px
$.createHipChat = function (options) {
if (options && options.url && options.container && options.timezone) {
var $container = $(options.container);
if ($container.length === 0) return;
var params = {
anonymous: 0,
timezone: options.timezone,
minimal: 0
};
if (options.welcome) {
params.welcome_msg = options.welcome;
}
var url = options.url + (options.url.indexOf('?') > 0 ? '&' : '?') + $.param(params);
if (url.indexOf('https://') !== 0) {
url = 'https://' + url;
}
var w = options.width || '100%';
var h = options.height || 400;
var nf = (options.noframes || '');
return {
show: function () {
$container.html('<iframe src="' + url + '" frameborder="' + 0 + '" width="' + w + '" height="' + h + '">' + nf + '</iframe>');
}
};
}
};
$.fn.hipChatPanel = function (options) {
options.container = this[0];
var panel = $.createHipChat(options);
this.html('<button class="show-hipchat ' + options.buttonClasses + '">' + (options.buttonTitle || 'Chat') + '</button>')
.find('.show-hipchat').click(function (e) { panel.show(); });
};
}(jQuery));
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
'use strict';
var cur_call = null;
var share_call = null;
var myConfMan = null;
var vertoHandle;
var ringing = false;
var autocall = false;
var chatting_with = false;
var vid_width = 320;
var vid_height = 180;
var local_vid_width = 320;
var local_vid_height = 180;
var is_full_screen = false;
var outgoingBandwidth;
var incomingBandwidth;
var vqual;
var sessid = null;
var master = null;
var canvas_id = null;
var second_screen = null;
var save_settings = true;
var vertoHandle = null;
var video_screen = "webcam"
var is_moderator = false;
var myCanvasID = 0;
var canvasData = [];
$( ".selector" ).pagecontainer({ "theme": "a" });
function display(msg) {
$("#calltitle").html(msg);
}
function clearConfMan() {
if (myConfMan) {
myConfMan.destroy();
myConfMan = null;
}
$("#conf").hide();
$("#canvasui").hide();
$("#message").hide();
chatting_with = null;
}
function goto_dialog(where) {
$( ":mobile-pagecontainer" ).pagecontainer( "change", "#dialog-" + where, { role: "dialog" } );
}
function goto_page(where, force) {
$( ":mobile-pagecontainer" ).pagecontainer( "change", "#page-" + where);
}
var first_login = false;
var online_visible = false;
function online(on) {
if (on) {
$("#online").show();
$("#offline").hide();
first_login = true;
} else {
$("#online").hide();
$("#offline").show();
}
online_visible = on;
}
function setupChat() {
$("#chatwin").html("");
$("#chatsend").click(function() {
if (!cur_call || !chatting_with || !myConfMan) {
return;
}
myConfMan.sendChat($("#chatmsg").val(), "message");
$("#chatmsg").val("");
});
$("#chatmsg").keyup(function (event) {
if (event.keyCode == 13 && !event.shiftKey) {
$( "#chatsend" ).trigger( "click" );
}
});
}
function full_screen(name) {
var elem = document.getElementById(name);
if (!elem) return;
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
}
}
$("#" + video_screen).resize(function(e) {
//console.log("video size changed to " + $("#" + video_screen).width() + "x" + $("#" + video_screen).height());
//if ($("#" + video_screen).width() > $(window).width()) {
//resize(false);
//$("#" + video_screen).width("100%");
//$("#" + video_screen).height("100%");
//}
real_size();
});
function resize(up) {
var width = $("#" + video_screen).width();
var height = $("#" + video_screen).height();
if (up) {
$("#" + video_screen).width(width * 1.20);
$("#" + video_screen).height(height * 1.20);
} else {
$("#" + video_screen).width(width * .80);
$("#" + video_screen).height(height * .80);
}
console.log("video size changed to " + $("#" + video_screen).width() + "x" + $("#" + video_screen).height());
}
$( window ).resize(function() {
real_size();
});
function clickify($container, idx) {
var offset = $container.offset();
function send(what, e) {
myConfMan.verto.rpcClient.call("verto.broadcast", {
"eventChannel": myConfMan.params.laData.modChannel,
"data": {
"command": what,
"layerID": idx,
"canvasID": myCanvasID,
"dimensions": {
"canvasX": e.pageX,
"canvasY": e.pageY,
"layerX": ~~(e.pageX - offset.left),
"layerY": ~~(e.pageY - offset.top)
}
}
});
}
$container.on('click', function(e) {
if (e.shiftKey) {
send("shift-click-layer", e);
} else {
send("click-layer", e);
}
});
}
function boxify($container, params, idx) {
var $selection = $('<div>').addClass('selection-box');
var offset = $container.offset();
var aspect = params.height / params.width;
var box_width = 0, box_height = 0, box_top = 0, box_left = 0;
var set = false;
$container.empty();
$container.on('mousedown', function(e) {
var click_y = e.pageY - offset.top, click_x = e.pageX - offset.left;
var restart = false;
function punt() {
$selection.empty();
$selection.remove();
set = false;
box_width = 0;
box_height = 0;
box_top = 0;
box_left = 0;
}
if (set) {
console.error("click", box_width, box_height, box_top, box_left, click_x, click_y);
if (click_x > box_left && click_x < box_left + box_width && click_y > box_top && click_y < box_top + box_height) {
console.error("inside");
} else {
console.error("outside");
restart = true;
}
} else {
restart = true;
}
if (restart) {
punt();
$selection.css({
'top': click_y,
'left': click_x,
'width': 0,
'height': 0,
'background-color': "red"
});
$selection.appendTo($container);
}
function send_cmd(what, metric, idx, canvas_id) {
myConfMan.verto.rpcClient.call("verto.broadcast", {
"eventChannel": myConfMan.params.laData.modChannel,
"data": {
"command": what,
"layerID": idx,
"canvasID": canvas_id,
"metric": metric
}
});
}
function done(e) {
$container.off('mousemove');
$container.off('mouseleave');
box_width = parseInt($selection.css("width"), 10);
box_height = parseInt($selection.css("height"), 10);
box_top = parseInt($selection.css("top"), 10);
box_left = parseInt($selection.css("left"), 10);
if (box_width < 10 || box_height < 10 || box_top < 10 || box_left < 10) {
punt();
} else if (box_width) {
set = true;
$selection.css({'background-color': "green"});
$selection.html("<div style='background-color:white;opacity:100;z-index:10000'>&nbsp; <a id=\"_agree\">Apply</a> <a id=\"_disagree\">Cancel</a> &nbsp;</div>");
$("#_agree").on('mousedown', function(e) {
e.stopPropagation();
myConfMan.verto.rpcClient.call("verto.broadcast", {
"eventChannel": myConfMan.params.laData.modChannel,
"data": {
"command": "zoom-layer",
"layerID": idx,
"canvasID": myCanvasID,
"dimensions": {
"w": box_width,
"h": box_height,
"x": box_left,
"y": box_top
}
}
});
punt();
$container.off('mousemove');
$container.off('mouseleave');
$container.off('mousedown');
$container.html(
"<button id='up'>Up</button> <br>" +
"<button id='left'>Left</button> " +
"<button id='right'>Right</button> <br>" +
"<button id='down'>Down</button><br><br>" +
"<button id='reset'>Reset</button>"
);
$("#reset").click(function() {
send_cmd("reset-layer", 1, idx, myCanvasID);
boxify($container, params, idx);
});
$("#left").click(function() {
send_cmd("layer-pan-x", -50, idx, myCanvasID);
});
$("#right").click(function() {
send_cmd("layer-pan-x", 50, idx, myCanvasID);
});
$("#up").click(function() {
send_cmd("layer-pan-y", -50, idx, myCanvasID);
});
$("#down").click(function() {
send_cmd("layer-pan-y", 50, idx, myCanvasID);
});
/*
$container.click(function() {
$container.off('click');
myConfMan.verto.rpcClient.call("verto.broadcast", {
"eventChannel": myConfMan.params.laData.modChannel,
"data": {
"command": "reset-layer",
"layerID": idx,
"canvasID": myCanvasID,
}
});
boxify($container, params, idx);
});
*/
});
$("#_disagree").on('mousedown', function(e) {
e.stopPropagation();
punt();
});
}
}
$container.on('mousemove', function(e) {
var move_x = e.pageX - offset.left,
move_y = e.pageY - offset.top,
width = Math.abs(move_x - click_x),
real_height = Math.abs(move_y - click_y),
//height = real_height,
height = width * aspect,
new_x, new_y;
new_x = (move_x < click_x) ? (click_x - width) : click_x;
new_y = (move_y < click_y) ? (click_y - real_height) : click_y;
width = ~~width;
height = ~~height;
new_x = ~~new_x;
new_y = ~~new_y;
if (set) {
$selection.css({
'top': move_y - (box_height / 2),
'left': move_x - ( box_width / 2)
});
} else {
$selection.css({
'width': width,
'height': height,
'top': move_y - height,
'left': new_x
});
}
}).on('mouseup', done).on('mouseleave', done);
});
}
function add_layer(base_element, dimensions, screen_width, screen_height, layout_scale, idx) {
console.error(dimensions);
var w = ~~(screen_width * dimensions.scale / layout_scale);
var h = ~~(screen_height * dimensions.hscale / layout_scale);
var left = ~~(screen_width * dimensions.x / layout_scale);
var top = ~~(screen_height * dimensions.y / layout_scale);
var zidx = dimensions.overlaps ? 9000 : 8000;
var style_str = "width:" + w + "px;height:" + h + "px;left:" + left + "px;top:" + top + "px;z-index:" + zidx;
console.error("dimensions", style_str);
var $layer = $("<div/>", {id: base_element + "_layer_" + idx, class: base_element + "_layer", style: style_str});
$layer.appendTo("#" + base_element + "_overlay");
boxify($layer, {"width": w, "height": h, "left": left, "top": top}, idx);
//clickify($layer, idx);
}
function update_overlay()
{
if (!is_moderator) {
console.log("no perms for overlay");
return;
}
console.error(canvasData[myCanvasID]);
if (!canvasData[myCanvasID]) return;
$("#" + video_screen + "_overlay").height($("#" + video_screen).height());
$("#" + video_screen + "_overlay").width($("#" + video_screen).width());
$("#" + video_screen + "_overlay").empty();
for(var idx in canvasData[myCanvasID].canvasLayouts) {
add_layer(video_screen, canvasData[myCanvasID].canvasLayouts[idx], $("#" + video_screen).width(), $("#" + video_screen).height(), canvasData[myCanvasID].scale, parseInt(idx, 10));
}
//$("<div/>", {class: video_screen + "_layer", style: "width:33%;height:10%;left:0px;top:0px"}).appendTo("#" + video_screen + "_overlay");
//$("<div/>", {class: video_screen + "_layer", style: "width:33%;left:33%;top:0px"}).appendTo("#" + video_screen + "_overlay");
// $("#" + video_screen + "_overlay").append( "<div class='webcam_layer' ></div>" );
// $("#" + video_screen + "_overlay").append( "<div class='webcam_layer' ></div>" );
// $("#" + video_screen + "_overlay").append( "<div class='webcam_layer' ></div>" );
// /TESTING
}
function real_size() {
/* temasys hack */
setTimeout(function() {
$("#" + video_screen).width("");
$("#" + video_screen).height("");
var w = $("#" + video_screen).width();
var h = $("#" + video_screen).height();
var new_w;
var new_h;
var aspect = 1920 / 1080; /*temasys doesn't provide video width hack aspect to wide screen*/
if (w > h) {
new_w = window.innerWidth;
new_h = Math.round(window.innerWidth / aspect);
} else {
new_h = window.innerHeight;
new_w = Math.round(window.innerHeight / aspect);
}
$("#" + video_screen).width(new_w);
$("#" + video_screen).height(new_h);
update_overlay();
}, 500);
console.log("video size changed to fit screen");
}
function check_vid_res()
{
if ($("#vqual_qqvga").is(':checked')) {
vid_width = 160;
vid_height = 120;
local_vid_width = 80;
local_vid_height = 60;
} else if ($("#vqual_qvga").is(':checked')) {
vid_width = 320;
vid_height = 240;
local_vid_width = 160;
local_vid_height = 120;
} else if ($("#vqual_vga").is(':checked')) {
vid_width = 640;
vid_height = 480;
local_vid_width = 160;
local_vid_height = 120;
} else if ($("#vqual_qvga_wide").is(':checked')) {
vid_width = 320;
vid_height = 180;
local_vid_width = 160;
local_vid_height = 90;
} else if ($("#vqual_vga_wide").is(':checked')) {
vid_width = 640;
vid_height = 360;
local_vid_width = 160;
local_vid_height = 90;
} else if ($("#vqual_hd").is(':checked')) {
vid_width = 1280;
vid_height = 720;
local_vid_width = 320;
local_vid_height = 180;
} else if ($("#vqual_hhd").is(':checked')) {
vid_width = 1920;
vid_height = 1080;
local_vid_width = 320;
local_vid_height = 180;
}
//$("#local_webcam").width(local_vid_width);
//$("#local_webcam").height(local_vid_height);
real_size();
if (vertoHandle) {
vertoHandle.videoParams({
"minWidth": vid_width,
"minHeight": vid_height,
"maxWidth": vid_width,
"maxHeight": vid_height,
"minFrameRate": 15,
"vertoBestFrameRate": 30,
//chromeMediaSource: 'screen',
//mediaSource: 'screen'
});
}
}
function check_vid() {
var use_vid = $("#use_vid").is(':checked');
return use_vid;
}
var DISABLE_SPEED_TEST = true;
function do_speed_test(fn)
{
if (DISABLE_SPEED_TEST) {
if (fn) {
fn();
}
return;
}
goto_page("bwtest");
vertoHandle.rpcClient.speedTest(1024 * 256, function(e, obj) {
//console.error("Up: " + obj.upKPS, "Down: ", obj.downKPS);
var vid = "default";
//if (outgoingBandwidth === "default") {
outgoingBandwidth = Math.ceil(obj.upKPS * .75).toString();
$("#vqual_hd").prop("checked", true);
vid = "1280x720";
if (outgoingBandwidth < 1024) {
$("#vqual_vga").prop("checked", true);
vid = "640x480";
}
if (outgoingBandwidth < 512) {
$("#vqual_qvga").prop("checked", true);
vid = "320x240";
}
if (outgoingBandwidth < 256) {
$("#vqual_qqvga").prop("checked", true);
vid = "160x120";
}
//}
if (incomingBandwidth === "default") {
incomingBandwidth = Math.ceil(obj.downKPS * .75).toString();
}
console.info(outgoingBandwidth, incomingBandwidth);
$("#bwinfo").html("<b>Bandwidth: " + "Up: " + obj.upKPS + " Down: " + obj.downKPS + " Vid: " + vid + "</b>");
if (fn) {
fn();
}
});
}
function messageTextToJQ(body) {
// Builds a jQuery collection from body text, linkifies http/https links, imageifies http/https links to images, and doesn't allow script injection
var match, $link, img_url, $body_parts = $(), rx = /(https?:\/\/[^ \n\r]+|\n\r|\n|\r)/;
while ((match = rx.exec(body)) !== null) {
if (match.index !== 0) {
$body_parts = $body_parts.add(document.createTextNode(body.substr(0, match.index)));
}
if (match[0].match(/^(\n|\r|\n\r)$/)) {
// Make a BR from a newline
$body_parts = $body_parts.add($('<br />'));
body = body.substr(match.index + match[0].length);
} else {
// Make a link (or image)
$link = $('<a target="_blank" />').attr('href', match[0]);
if (match[0].search(/\.(gif|jpe?g|png)/) > -1) {
// Make an image
img_url = match[0];
// Handle dropbox links
if (img_url.indexOf('dropbox.com') !== -1) {
if (img_url.indexOf('?dl=1') === -1 && img_url.indexOf('?dl=0') === -1) {
img_url += '?dl=1';
} else if (img_url.indexOf('?dl=0') !== -1) {
img_url = img_url.replace(/dl=0$/, 'dl=1');
}
}
$link.append($('<img border="0" class="chatimg" />').attr('src', img_url));
} else {
// Make a link
$link.text(match[0]);
}
body = body.substr(match.index + match[0].length);
$body_parts = $body_parts.add($link);
}
}
if (body) {
$body_parts = $body_parts.add(document.createTextNode(body));
}
return $body_parts;
} // END function messageTextToJQ
var callbacks = {
onMessage: function(verto, dialog, msg, data) {
switch (msg) {
case $.verto.enum.message.pvtEvent:
// console.error("pvtEvent", data.pvtData);
if (data.pvtData) {
switch (data.pvtData.action) {
case "conference-liveArray-part":
clearConfMan();
if (data.pvtData.secondScreen) {
$("#mainButtons").show();
$("#canvasButtons").hide();
$("#keypad").show();
}
break;
case "conference-liveArray-join":
clearConfMan();
if (data.pvtData.secondScreen) {
$("#mainButtons").hide();
$("#canvasButtons").show();
$("#keypad").hide();
} else {
is_moderator = data.pvtData.role === "moderator";
myConfMan = new $.verto.confMan(verto, {
tableID: "#conf_list",
statusID: "#conf_count",
mainModID: "#conf_mod",
displayID: "#conf_display",
dialog: dialog,
hasVid: check_vid(),
laData: data.pvtData,
infoCallback: function(v, e) {
if (e.eventData.contentType === "layout-info") {
canvasData[e.eventData.canvasInfo.canvasID] = e.eventData.canvasInfo;
update_overlay();
}
},
chatCallback: function(v, e) {
console.log(e);
var from = e.data.fromDisplay || e.data.from || "Unknown";
var message = e.data.message || "";
$('#chatwin')
.append($('<span class="chatuid" />').text(from + ':'))
.append($('<br />'))
.append(messageTextToJQ(message))
.append($('<br />'));
$('#chatwin').animate({"scrollTop": $('#chatwin')[0].scrollHeight}, "fast");
}
});
if (!data.pvtData.canvasCount) {
data.pvtData.canvasCount = 1;
}
var canvasCount = data.pvtData.canvasCount + 0;
if (canvasCount <= 1) {
$("#canvasui").hide();
} if (canvasCount > 1) {
$("#canvasui").show();
$("#canvasid").selectmenu({});
$("#canvasid").selectmenu("enable");
$("#canvasid").empty();
var x;
for (x = 1; x < canvasCount; x++) {
$("#canvasid").append(new Option("Canvas " + (x + 1), (x + 1)));
}
$("#canvasid").append(new Option("Super Canvas", x + 1));
$("#canvasid").selectmenu('refresh', true);
$("#canvasbut").click(function() {
var canvas_id = $("#canvasid").find(":selected").val();
var s = window.location.href;
s = s.replace(/\#.*/,'');
s += "#sessid=random&master=" + cur_call.callID +
"&secondScreen=true&canvas_id=" + canvas_id + "&autocall=" + $("#ext").val() + "-canvas-" + canvas_id;
console.log("opening new window to " + s);
window.open(s, "canvas_window_" + canvas_id, "toolbar=0,location=0,menubar=0,directories=0,width=" + ($("#" + video_screen).width() + 50) + ",height=" + ($("#" + video_screen).height() + 400));
});
}
$("#conf").show();
$("#chatwin").html("");
if (data.pvtData.hipchatURL) {
var namex = $("#cidname").val();
if (!namex.indexOf(" ") > 0) {
namex += " " + $("#cid").val();
}
var name = namex.replace(/ /i, '%20');
$('#hcmessage').hipChatPanel({
url: data.pvtData.hipchatURL + "?name=" + name,
timezone: "CST"
});
$("#hctop").show().find('.show-hipchat').click();
} else {
$("#message").show();
}
chatting_with = data.pvtData.chatChannel;
}
break;
}
}
break;
case $.verto.enum.message.info:
if (data.msg) {
data = data.msg;
var body = data.body;
/*
// This section has been replaced with messageTextToJQ function
if (body.match(/\.gif|\.jpg|\.jpeg|\.png/)) {
var mod = "";
if (body.match(/dropbox.com/)) {
mod = "?dl=1";
}
body = body.replace(/(http[s]{0,1}:\/\/\S+)/g, "<a target='_blank' href='$1'>$1<br><img border='0' class='chatimg' src='$1'" + mod + "><\/a>");
} else {
body = body.replace(/(http[s]{0,1}:\/\/\S+)/g, "<a target='_blank' href='$1'>$1<\/a>");
}
if (body.slice(-1) !== "\n") {
body += "\n";
}
body = body.replace(/(?:\r\n|\r|\n)/g, '<br />');
var from = data.from_msg_name || data.from;
$("#chatwin").append("<span class=chatuid>" + from + ":</span><br>" + body);
$('#chatwin').animate({"scrollTop": $('#chatwin')[0].scrollHeight}, "fast");
*/
var from = data.from_msg_name || data.from;
$('#chatwin')
.append($('<span class="chatuid" />').text(from + ':'))
.append($('<br />'))
.append(messageTextToJQ(body))
.append($('<br />'));
$('#chatwin').animate({"scrollTop": $('#chatwin')[0].scrollHeight}, "fast");
}
if (data.txt) {
console.log(data.txt);
if (data.txt.chars) {
var a = [...data.txt.chars];
//console.log(a);
for (var x in a) {
if(a[x] == "\r") {
$("#rtt_in").append("\n");
continue;
} else if (a[x] == "\b") {
$("#rtt_in").text($("#rtt_in").text().slice(0, -1));
continue;
}
console.log("[" + a[x] + "]");
$("#rtt_in").append(a[x]);
}
var psconsole = $('#rtt_in');
if(psconsole.length)
psconsole.scrollTop(psconsole[0].scrollHeight - psconsole.height());
}
}
break;
case $.verto.enum.message.display:
var party = dialog.params.remote_caller_id_name + "<" + dialog.params.remote_caller_id_number + ">";
display("Talking to: " + dialog.cidString());
break;
default:
break;
}
},
onDialogState: function(d) {
//console.error(d, share_call, d == share_call, d.state);
if (d == share_call) {
switch (d.state) {
case $.verto.enum.state.early:
case $.verto.enum.state.active:
$("#nosharebtn").show();
$("#sharebtn").hide();
break;
case $.verto.enum.state.destroy:
$("#nosharebtn").hide();
$("#sharebtn").show();
share_call = null;
break;
}
return;
}
if (!cur_call) {
cur_call = d;
}
if (d.state == $.verto.enum.state.ringing) {
ringing = true;
} else {
ringing = false;
}
switch (d.state) {
case $.verto.enum.state.ringing:
display("Call From: " + d.cidString());
check_vid_res();
$("#ansbtn").click(function() {
console.error("WTF", cur_call, d);
cur_call.answer({
useStereo: $("#use_stereo").is(':checked'),
callee_id_name: $("#cidname").val(),
callee_id_number: $("#cid").val(),
useCamera: $("#usecamera").find(":selected").val(),
useMic: $("#usemic").find(":selected").val(),
useSpeak: $("#usespeak").find(":selected").val()
});
$('#dialog-incoming-call').dialog('close');
});
$("#declinebtn").click(function() {
cur_call.hangup();
$('#dialog-incoming-call').dialog('close');
});
goto_dialog("incoming-call");
$("#dialog-incoming-call-txt").text("Incoming call from: " + d.cidString());
if (d.params.wantVideo) {
$("#vansbtn").click(function() {
$("#use_vid").prop("checked", true);
cur_call.answer({
useVideo: true,
useStereo: $("#use_stereo").is(':checked'),
useCamera: $("#usecamera").find(":selected").val(),
useMic: $("#usemic").find(":selected").val(),
useSpeak: $("#usespeak").find(":selected").val()
});
});
// the buttons in this jquery mobile wont hide .. gotta wrap them in a div as a workaround
$("#vansdiv").show();
} else {
$("#vansdiv").hide();
}
break;
case $.verto.enum.state.trying:
display("Calling: " + d.cidString());
goto_page("incall");
break;
case $.verto.enum.state.early:
case $.verto.enum.state.active:
if (sessid) {
cur_call.setMute("on");
display("Viewing Canvas: " + canvas_id);
vertoHandle.subscribe("presence", {
handler: function(v, e) {
if (e.data.channelUUID === master && e.data.channelCallState === "HANGUP") {
cur_call.hangup();
}
}
});
} else {
display("Talking to: " + d.cidString());
}
goto_page("incall");
real_size();
break;
case $.verto.enum.state.hangup:
$("#main_info").html("Call ended with cause: " + d.cause);
goto_page("main");
exit_full_screen();
case $.verto.enum.state.destroy:
$("#hangup_cause").html("");
clearConfMan();
real_size();
cur_call = null;
if (sessid) {
setTimeout(function() {
delete $.verto.warnOnUnload;
window.close();
}, 500);
}
break;
case $.verto.enum.state.held:
break;
default:
display("");
break;
}
},
onWSLogin: function(v, success) {
display("");
cur_call = null;
ringing = false;
if (success) {
do_speed_test(function() {
online(true);
goto_page("main");
$("input[type='radio']").checkboxradio("refresh");
$("input[type='checkbox']").checkboxradio("refresh");
/*
verto.subscribe("presence", {
handler: function(v, e) {
console.error("PRESENCE:", e);
}
});
*/
if (!window.location.hash) {
goto_page("main");
}
if (autocall) {
autocall = false;
docall();
}
});
} else {
goto_page("main");
goto_dialog("login-error");
}
},
onWSClose: function(v, success) {
display("");
online(false);
var today = new Date();
$("#errordisplay").html("Connection Error.<br>Last Attempt: " + today);
goto_page("main");
if (sessid) {
window.close();
}
},
onEvent: function(v, e) {
console.debug("GOT EVENT", e);
},
};
$("#hold").click(function(e) {
cur_call.toggleHold();
goto_dialog("hold");
});
$("#cancelxferbtn").click(function(e) {
$("#xferto").val("");
$("#xferdiv").hide();
});
$(".startxferbtn").click(function(e) {
if ($('#xferdiv').is(':visible')) {
var xfer = $("#xferto").val();
if (xfer) {
cur_call.transfer(xfer);
}
$("#xferto").val("");
$("#xferdiv").hide();
} else {
$("#xferdiv").show();
}
});
$("#clearbtn").click(function(e) {
$("#ext").val("");
});
$(".dialbtn").click(function(e) {
$("#ext").val($("#ext").val() + e.currentTarget.textContent);
});
$(".dtmf").click(function(e) {
if ($('#xferdiv').is(':visible')) {
$("#xferto").val($("#xferto").val() + e.currentTarget.textContent);
} else {
cur_call.dtmf(e.currentTarget.textContent);
}
});
$("#hupbtn").click(function() {
exit_full_screen();
vertoHandle.hangup();
cur_call = null;
});
$("#hupbtn2").click(function() {
delete $.verto.warnOnUnload;
vertoHandle.hangup();
cur_call = null;
});
$("#mutebtn").click(function() {
cur_call.dtmf("0");
});
$("#localmutebtn").click(function() {
var muted = cur_call.setMute("toggle");
if (muted) {
display("Talking to: " + cur_call.cidString() + " [LOCALLY MUTED]");
} else {
display("Talking to: " + cur_call.cidString());
}
});
$("#localvidmutebtn").click(function() {
var muted = cur_call.setVideoMute("toggle");
if (muted) {
display("Talking to: " + cur_call.cidString() + " [VIDEO LOCALLY MUTED]");
} else {
display("Talking to: " + cur_call.cidString());
}
});
$("#vmutebtn").click(function() {
cur_call.dtmf("*0");
});
var is_full = false;
var usrto;
var rs;
function noop() { return; }
function on_full(which)
{
is_full = which;
if (is_full) {
clearTimeout(rs);
$("#usr2").hide();
rs = setTimeout(function() {
$("#" + video_screen).width($(window).width());
$("#" + video_screen).height($(window).height());
}, 1500);
$("#rows").css("position", "absolute").css("z-index", "2");
$("#fullbtn").text("Exit Full Screen");
$("#fullbtn2").text("Exit Full Screen");
$("#usrctl").show();
} else {
$("#usrctl").hide();
$("#rows").css("position", "static").css("z-index", "2");
$("#fullbtn").text("Enter Full Screen");
$("#fullbtn2").text("Enter Full Screen");
clearTimeout(usrto);
clearTimeout(rs);
rs = setTimeout(function() {
$("#" + video_screen).width("100%");
$("#" + video_screen).height("100%");
}, 1500);
}
}
$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange',
function(e) {
if (!is_full) {
on_full(true);
} else {
on_full(false);
}
});
function exit_full_screen()
{
if (document.webkitFullscreenEnabled) {
document.webkitExitFullscreen();
} else if (document.mozFullScreenEnabled) {
document.mozCancelFullScreen();
}
}
$("#fullbtn").click(function() {
if (!is_full) {
full_screen("fs");
} else {
exit_full_screen();
}
});
$("#fullbtn2").click(function() {
if (!is_full) {
full_screen("fs");
} else {
exit_full_screen();
}
});
$("#biggerbtn").click(function() {
resize(true);
});
$("#smallerbtn").click(function() {
resize(false);
});
$("#" + video_screen).click(function() {
check_vid();
});
function docall() {
$('#ext').trigger('change');
if (cur_call) {
return;
}
$("#main_info").html("Trying");
check_vid_res();
console.error(outgoingBandwidth, incomingBandwidth);
cur_call = vertoHandle.newCall({
destination_number: $("#ext").val(),
caller_id_name: $("#cidname").val(),
caller_id_number: $("#cid").val(),
outgoingBandwidth: outgoingBandwidth,
incomingBandwidth: incomingBandwidth,
useVideo: check_vid(),
useStereo: $("#use_stereo").is(':checked'),
useCamera: (sessid || canvas_id) ? "none" : $("#usecamera").find(":selected").val(),
useMic: (sessid || canvas_id) ? "none" : $("#usemic").find(":selected").val(),
useSpeak: (sessid || canvas_id) ? "none" : $("#usespeak").find(":selected").val(),
dedEnc: $("#use_dedenc").is(':checked'),
mirrorInput: $("#mirror_input").is(':checked'),
userVariables: {
avatar: $("#avatar").val(),
email: $("#email").val(),
},
});
}
function doshare(on) {
//$('#ext').trigger('change');
if (!on) {
if (share_call) {
share_call.hangup();
}
return;
}
if (share_call) {
return;
}
var sharedev = $("#useshare").find(":selected").val();
if (sharedev !== "screen") {
share_call = vertoHandle.newCall({
destination_number: $("#ext").val() + "-screen",
caller_id_name: $("#cidname").val() + " (Screen)",
caller_id_number: $("#cid").val() + " (screen)",
outgoingBandwidth: outgoingBandwidth,
incomingBandwidth: incomingBandwidth,
useCamera: sharedev,
useVideo: true,
screenShare: true,
dedEnc: $("#use_dedenc").is(':checked'),
mirrorInput: $("#mirror_input").is(':checked')
});
return;
}
console.log("Attempting Screen Capture....");
getScreenId(function (error, sourceId, screen_constraints) {
share_call = vertoHandle.newCall({
destination_number: $("#ext").val() + "-screen",
caller_id_name: $("#cidname").val() + " (Screen)",
caller_id_number: $("#cid").val() + " (screen)",
outgoingBandwidth: outgoingBandwidth,
incomingBandwidth: incomingBandwidth,
videoParams: screen_constraints.video.mandatory,
useVideo: true,
screenShare: true,
dedEnc: $("#use_dedenc").is(':checked'),
mirrorInput: $("#mirror_input").is(':checked')
});
});
//$("#main_info").html("Trying");
//check_vid_res();
//cur_share = vertoHandle.newCall({
// destination_number: $("#ext").val(),
// caller_id_name: $("#cidname").val(),
// caller_id_number: $("#cid").val(),
// useVideo: check_vid(),
// useStereo: $("#use_stereo").is(':checked')
//});
}
$("#callbtn").click(function() {
docall();
});
$("#refreshbtn").click(function() {
refresh_devices();
});
$("#sharebtn").click(function() {
doshare(true);
});
$("#nosharebtn").click(function() {
doshare(false);
});
$("#nosharebtn").hide();
function pop(id, cname, dft, onchange) {
var tmp = $.cookie(cname) || dft;
$.cookie(cname, tmp, {
expires: 365
});
$(id).val(tmp).change(function() {
if (!save_settings) return;
$.cookie(cname, $(id).val(), {
expires: 365
});
if (onchange) {
onchange($(id));
}
});
}
function pop_select(id, cname, dft, onchange) {
var tmp = $.cookie(cname) || dft;
$.cookie(cname, tmp, {
expires: 365
});
// $("#usecamera").find(":selected").val()
$(id).change(function() {
if (!save_settings) return;
tmp = $(id).find(":selected").val();
$.cookie(cname, tmp, {
expires: 365
});
if (onchange) {
onchange($(id));
}
});
}
function refresh_devices()
{
$("#useshare").selectmenu({});
$("#useshare").selectmenu({});
$("#usemic").selectmenu({});
$("#usespeak").selectmenu({});
$("#useshare").selectmenu("enable");
$("#useshare").selectmenu("enable");
$("#usemic").selectmenu("enable");
$("#usespeak").selectmenu("enable");
$("#useshare").empty();
$("#usecamera").empty();
$("#usemic").empty();
$("#usespeak").empty();
var x = 0;
$("#usecamera").append(new Option("No Camera", "none"));
$("#usemic").append(new Option("Do Not Specify", "any"));
$("#usespeak").append(new Option("Do Not Specify", "any"));
for (var i in $.verto.videoDevices) {
var source = $.verto.videoDevices[i];
var o = new Option(source.label, source.id);
if (!x) {
o.selected = true;
}
$("#usecamera").append(o);
var oo = new Option(source.label, source.id);
if (!x++) {
o.selected = true;
}
$("#useshare").append(oo);
}
x = 1;
for (var i in $.verto.audioInDevices) {
var source = $.verto.audioInDevices[i];
var o = new Option(source.label, source.id);
if (!x++) {
o.selected = true;
}
$("#usemic").append(o);
}
for (var i in $.verto.audioOutDevices) {
var source = $.verto.audioOutDevices[i];
var o = new Option(source.label, source.id);
if (!x++) {
o.selected = true;
}
$("#usespeak").append(o);
}
var o = new Option("Screen", "screen");
o.selected = true;
$("#useshare").append(o);
$("#usemic").append(new Option("No Microphone", "none"));
$("#usecamera").selectmenu('refresh', true);
$("#usemic").selectmenu('refresh', true);
$("#usespeak").selectmenu('refresh', true);
$("#useshare").selectmenu('refresh', true);
//$("input[type='radio']).checkboxradio({});
//$("input[type='radio']").checkboxradio("refresh");
//$("input[type='checkbox']").checkboxradio("refresh");
//console.error($("#usecamera").find(":selected").val());
//$.FSRTC.getValidRes($("#usecamera").find(":selected").val(), undefined);
var tmp;
tmp = $.cookie("verto_demo_camera_selected") || "false";
if (tmp) {
$('#usecamera option[value=' + tmp + ']').prop('selected', 'selected').change();
pop_select("#usecamera","verto_demo_camera_selected", tmp);
}
var tmp;
tmp = $.cookie("verto_demo_share_selected") || "false";
if (tmp) {
$('#useshare option[value=' + tmp + ']').prop('selected', 'selected').change();
pop_select("#useshare","verto_demo_share_selected", tmp);
}
tmp = $.cookie("verto_demo_mic_selected") || "false";
if (tmp) {
$('#usemic option[value=' + tmp + ']').prop('selected', 'selected').change();
pop_select("#usemic","verto_demo_mic_selected", tmp);
}
tmp = $.cookie("verto_demo_speak_selected") || "false";
if (tmp) {
$('#usespeak option[value=' + tmp + ']').prop('selected', 'selected').change();
pop_select("#usespeak","verto_demo_speak_selected", tmp);
}
}
function init() {
cur_call = null;
goto_page("bwtest");
$("#usecamera").selectmenu({});
$("#usemic").selectmenu({});
$("#usespeak").selectmenu({});
$("#useshare").selectmenu({});
if (!autocall) {
pop("#ext", "verto_demo_ext", "3500");
}
pop("#avatar", "verto_demo_avatar", "", function(jq) {
$("#avatar_img").attr("src", jq.val());
});
pop("#cidname", "verto_demo_name", "FreeSWITCH User");
pop("#cid", "verto_demo_cid", "1008");
pop("#email", "verto_demo_emailaddr", "", function(jq) {
$("#avatar").val("http://gravatar.com/avatar/" + md5($("#email").val()) + ".png?s=600");
$("#avatar_img").attr("src", $("#avatar").val());
$("#avatar").change();
});
pop("#textto", "verto_demo_textto", "1000");
pop("#login", "verto_demo_login", "1008");
pop("#passwd", "verto_demo_passwd", "1234");
pop("#hostName", "verto_demo_hostname", window.location.hostname);
pop("#wsURL", "verto_demo_wsurl", "wss://" + window.location.hostname + ":8082");
$("#avatar_img").attr("src", $("#avatar").val());
var tmp = $.cookie("verto_demo_vid_checked") || "true";
$.cookie("verto_demo_vid_checked", tmp, {
expires: 365
});
if (tmp !== "true") {
$("#camdiv").hide();
$(".sharediv").hide();
} else {
$(".sharediv").show();
$("#camdiv").show();
}
$("#use_vid").prop("checked", tmp === "true").change(function(e) {
tmp = $("#use_vid").is(':checked');
if (!tmp) {
$("#camdiv").hide();
$(".sharediv").hide();
} else {
$("#camdiv").show();
$(".sharediv").show();
}
$.cookie("verto_demo_vid_checked", tmp ? "true" : "false", {
expires: 365
});
});
tmp = $.cookie("verto_demo_dedenc_checked") || "false";
$.cookie("verto_demo_dedenc_checked", tmp, {
expires: 365
});
$("#use_dedenc").prop("checked", tmp === "true").change(function(e) {
tmp = $("#use_dedenc").is(':checked');
if (!tmp && $("#mirror_input").is(':checked')) {
$("#mirror_input").click();
}
$.cookie("verto_demo_dedenc_checked", tmp ? "true" : "false", {
expires: 365
});
});
tmp = $.cookie("verto_demo_mirror_input_checked") || "false";
$.cookie("verto_demo_mirror_input_checked", tmp, {
expires: 365
});
$("#mirror_input").prop("checked", tmp === "true").change(function(e) {
tmp = $("#mirror_input").is(':checked');
if (tmp && !$("#use_dedenc").is(':checked')) {
$("#use_dedenc").click();
}
$.cookie("verto_demo_mirror_input_checked", tmp ? "true" : "false", {
expires: 365
});
});
//
outgoingBandwidth = $.cookie("verto_demo_outgoingBandwidth") || "default";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
$("#outgoingBandwidth_250kb").prop("checked", outgoingBandwidth === "250").change(function(e) {
if ($("#outgoingBandwidth_250kb").is(':checked')) {
outgoingBandwidth = "250";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
}
});
$("#outgoingBandwidth_500kb").prop("checked", outgoingBandwidth === "500").change(function(e) {
if ($("#outgoingBandwidth_500kb").is(':checked')) {
outgoingBandwidth = "500";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
}
});
$("#outgoingBandwidth_1024kb").prop("checked", outgoingBandwidth === "1024").change(function(e) {
if ($("#outgoingBandwidth_1024kb").is(':checked')) {
outgoingBandwidth = "1024";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
}
});
$("#outgoingBandwidth_1536kb").prop("checked", outgoingBandwidth === "1536").change(function(e) {
if ($("#outgoingBandwidth_1536kb").is(':checked')) {
outgoingBandwidth = "1536";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
}
});
$("#outgoingBandwidth_2048kb").prop("checked", outgoingBandwidth === "2048").change(function(e) {
if ($("#outgoingBandwidth_2048kb").is(':checked')) {
outgoingBandwidth = "2048";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
}
});
$("#outgoingBandwidth_5120kb").prop("checked", outgoingBandwidth === "5120").change(function(e) {
if ($("#outgoingBandwidth_5120kb").is(':checked')) {
outgoingBandwidth = "5120";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
}
});
$("#outgoingBandwidth_0kb").prop("checked", outgoingBandwidth === "0").change(function(e) {
if ($("#outgoingBandwidth_0kb").is(':checked')) {
outgoingBandwidth = "0";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
}
});
$("#outgoingBandwidth_default").prop("checked", outgoingBandwidth === "default").change(function(e) {
if ($("#outgoingBandwidth_default").is(':checked')) {
outgoingBandwidth = "default";
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
expires: 365
});
}
});
//
incomingBandwidth = $.cookie("verto_demo_incomingBandwidth") || "default";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
$("#incomingBandwidth_250kb").prop("checked", incomingBandwidth === "250").change(function(e) {
if ($("#incomingBandwidth_250kb").is(':checked')) {
incomingBandwidth = "250";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
}
});
$("#incomingBandwidth_500kb").prop("checked", incomingBandwidth === "500").change(function(e) {
if ($("#incomingBandwidth_500kb").is(':checked')) {
incomingBandwidth = "500";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
}
});
$("#incomingBandwidth_1024kb").prop("checked", incomingBandwidth === "1024").change(function(e) {
if ($("#incomingBandwidth_1024kb").is(':checked')) {
incomingBandwidth = "1024";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
}
});
$("#incomingBandwidth_1536kb").prop("checked", incomingBandwidth === "1536").change(function(e) {
if ($("#incomingBandwidth_1536kb").is(':checked')) {
incomingBandwidth = "1536";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
}
});
$("#incomingBandwidth_2048kb").prop("checked", incomingBandwidth === "2048").change(function(e) {
if ($("#incomingBandwidth_2048kb").is(':checked')) {
incomingBandwidth = "2048";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
}
});
$("#incomingBandwidth_5120kb").prop("checked", incomingBandwidth === "5120").change(function(e) {
if ($("#incomingBandwidth_5120kb").is(':checked')) {
incomingBandwidth = "5120";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
}
});
$("#incomingBandwidth_0kb").prop("checked", incomingBandwidth === "0").change(function(e) {
if ($("#incomingBandwidth_0kb").is(':checked')) {
incomingBandwidth = "0";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
}
});
$("#incomingBandwidth_default").prop("checked", incomingBandwidth === "default").change(function(e) {
if ($("#incomingBandwidth_default").is(':checked')) {
incomingBandwidth = "default";
$.cookie("verto_demo_incomingBandwidth", incomingBandwidth, {
expires: 365
});
}
});
//
vqual = $.cookie("verto_demo_vqual") || "hd";
$.cookie("verto_demo_vqual", vqual, {
expires: 365
});
$("#vqual_qqvga").prop("checked", vqual === "qqvga").change(function(e) {
if ($("#vqual_qqvga").is(':checked')) {
vqual = "qqvga";
$.cookie("verto_demo_vqual", vqual, {
expires: 365
});
}
});
$("#vqual_qvga").prop("checked", vqual === "qvga").change(function(e) {
if ($("#vqual_qvga").is(':checked')) {
vqual = "qvga";
$.cookie("verto_demo_vqual", vqual, {
expires: 365
});
}
});
$("#vqual_vga").prop("checked", vqual === "vga").change(function(e) {
if ($("#vqual_vga").is(':checked')) {
vqual = "vga";
$.cookie("verto_demo_vqual", vqual, {
expires: 365
});
}
});
$("#vqual_qvga_wide").prop("checked", vqual === "qvga_wide").change(function(e) {
if ($("#vqual_qvga_wide").is(':checked')) {
vqual = "qvga_wide";
$.cookie("verto_demo_vqual", vqual, {
expires: 365
});
}
});
$("#vqual_vga_wide").prop("checked", vqual === "vga_wide").change(function(e) {
if ($("#vqual_vga_wide").is(':checked')) {
vqual = "vga_wide";
$.cookie("verto_demo_vqual", vqual, {
expires: 365
});
}
});
$("#vqual_hd").prop("checked", vqual === "hd").change(function(e) {
if ($("#vqual_hd").is(':checked')) {
vqual = "hd";
$.cookie("verto_demo_vqual", vqual, {
expires: 365
});
}
});
$("#vqual_hhd").prop("checked", vqual === "hhd").change(function(e) {
if ($("#vqual_hhd").is(':checked')) {
vqual = "hhd";
$.cookie("verto_demo_vqual", vqual, {
expires: 365
});
}
});
tmp = $.cookie("verto_demo_stereo_checked") || "true";
$.cookie("verto_demo_stereo_checked", tmp, {
expires: 365
});
$("#use_stereo").prop("checked", tmp === "true").change(function(e) {
tmp = $("#use_stereo").is(':checked');
$.cookie("verto_demo_stereo_checked", tmp ? "true" : "false", {
expires: 365
});
});
tmp = $.cookie("verto_demo_stun_checked") || "true";
$.cookie("verto_demo_stun_checked", tmp, {
expires: 365
});
$("#use_stun").prop("checked", tmp === "true").change(function(e) {
tmp = $("#use_stun").is(':checked');
$.cookie("verto_demo_stun_checked", tmp ? "true" : "false", {
expires: 365
});
if (vertoHandle) {
vertoHandle.iceServers(tmp);
}
});
tmp = $.cookie("verto_demo_local_video_checked") || "false";
$.cookie("verto_demo_local_video_checked", tmp, {
expires: 365
});
$("#local_video").prop("checked", tmp === "true").change(function(e) {
tmp = $("#local_video").is(':checked');
$.cookie("verto_demo_local_video_checked", tmp ? "true" : "false", {
expires: 365
});
});
check_vid_res();
refresh_devices();
//console.error($("#usecamera").find(":selected"));
vertoHandle = new $.verto({
login: $("#login").val() + "@" + $("#hostName").val(),
passwd: $("#passwd").val(),
socketUrl: $("#wsURL").val(),
tag: video_screen,
//localTag: $("#local_video").is(':checked') ? "local_webcam" : null,
ringFile: "sounds/bell_ring2.wav",
sessid: sessid,
videoParams: {
"minWidth": vid_width,
"minHeight": vid_height,
"maxWidth": vid_width,
"maxHeight": vid_height,
"minFrameRate": 15,
"vertoBestFrameRate": 30
},
deviceParams: {
useCamera: $("#usecamera").find(":selected").val(), useMic: $("#usemic").find(":selected").val(),
useSpeak: $("#usespeak").find(":selected").val()
},
audioParams: {
googAutoGainControl: false,
googNoiseSuppression: false,
googHighpassFilter: false
},
iceServers: $("#use_stun").is(':checked')
},callbacks);
function handleEmailResponse(resp) {
for (var i=0; i < resp.emails.length; i++) {
if (resp.emails[i].type === 'account' && resp.emails[i].value) {
$("#email").val(resp.emails[i].value);
$("#email").change();
$("#cid").val(resp.emails[i].value);
$("#cid").change();
}
}
if (resp.displayName) {
$("#cidname").val(resp.displayName);
$("#cidname").trigger("change");
}
$("#avatar").val(resp.image.url + "0");
$("#avatar").trigger("change");
gapi.auth.signOut();
}
$("#signinButton").click(function() {
gapi.auth.signIn({callback: function(authResult) {
console.log('Sign-in state: ' + authResult['error']);
if (authResult['status']['signed_in']) {
// Update the app to reflect a signed in user
// Hide the sign-in button now that the user is authorized, for example:
//document.getElementById('signinButton').setAttribute('style', 'display: none');
gapi.client.load('plus','v1', function(){
var request = gapi.client.plus.people.get({userId: 'me'}).execute(handleEmailResponse);
});
} else {
// Update the app to reflect a signed out user
// Possible error values:
// "user_signed_out" - User is signed-out
// "access_denied" - User denied access to your app
// "immediate_failed" - Could not automatically log in the user
console.log('Sign-in state: ' + authResult['error']);
}
}});
});
$("#login").change(function(e) {
$("#cid").val(e.currentTarget.value);
$.cookie("verto_demo_cid", e.currentTarget.value, {
expires: 365
});
});
$("#vtxtbtn").click(function() {
vertoHandle.message({
to: $("#textto").val(),
body: $("#textmsg").val()
});
$("#textmsg").val("");
});
$("#logoutbtn").click(function() {
vertoHandle.logout();
online(false);
$("#errordisplay").html("");
});
$("#speedbtn").click(function() {
do_speed_test(function() {
goto_page("main");
});
$("#errordisplay").html("");
});
$("#loginbtn").click(function() {
online(false);
vertoHandle.loginData({
login: $("#login").val() + "@" + $("#hostName").val(),
passwd: $("#passwd").val()
});
vertoHandle.login();
goto_page("main");
});
$("#xferdiv").hide();
// $("#" + video_screen).hide();
online(false);
setupChat();
$("#rtt").val("");
$("#rtt_in").text("");
$("#rtt").keyup(function (event) {
console.error(event);
console.log("KEY (" + event.which + ")\n");
if (event.which == 8) {
cur_call.rtt({code: event.which});
}
if (event.which == 13) {
$("#rtt").val("");
}
});
$("#rtt").keypress(function (event) {
console.error(event);
console.log("TEXT (" + event.which + ")\n");
cur_call.rtt({code: event.which});
});
$("#ext").keyup(function (event) {
if (event.keyCode == 13) {
$( "#callbtn" ).trigger( "click" );
}
});
$(document).keypress(function(event) {
if (!(cur_call && event.target.id == "page-incall")) return;
var key = String.fromCharCode(event.keyCode);
var i = parseInt(key);
if (key === "#" || key === "*" || key === "0" || (i > 0 && i <= 9)) {
cur_call.dtmf(key);
}
});
if (window.location.hostname !== "webrtc.freeswitch.org") {
$("#directory").hide();
}
}
$(window).load(function() {
var hash = window.location.hash.substring(1);
var a = [];
var vars = [];
if (hash && hash.indexOf("page-") == -1) {
window.location.hash = "";
if (vars = hash.split("&")) {
for (var i in vars) {
var v = vars[i];
if (a = v.split("=")) {
var v_name = a[0];
var v_val = a[1];
if (v_name === "sessid") {
sessid = v_val;
if (sessid === "random") {
sessid = $.verto.genUUID();
}
save_settings = false;
$.verto.warnOnUnload = "WARNING: DO NOT RELOAD THIS PAGE! Please Close it Instead\n";
$.verto.unloadJobs.push(function() {
exit_full_screen();
vertoHandle.hangup();
cur_call = null;
});
} else if (v_name === "master") {
master = v_val;
} else if (v_name === "canvas_id") {
canvas_id = v_val;
myCanvasID = parseInt(canvas_id, 10);
} else if (v_name === "autocall") {
$("#ext").val(v_val);
autocall = true;
}
}
}
}
}
//if (hash && (a = hash.split("&"))) {
// window.location.hash = a[0];
// }
$("#" + video_screen).hide();
$("#camdiv").hide();
$('#demos').hide();
$('#devices').hide();
$('#showdemo').show();
// $("#rows").css("position", "absolute").css("z-index", "2");
//$("#usrctl").show();
//$("#usr2").hide();
$("#usrctl").hide();
$("#rows").mouseover(function() {
$("#usr2").show();
});
$("#usr2").mouseover(function() {
clearTimeout(usrto);
});
$("#usr2").mouseleave(function() {
if (is_full) {
usrto = setTimeout(function() { $("#usr2").hide(); }, 2000);
}
});
$("#search").show();
goto_page("enum");
setTimeout(function() {
$.verto.init({skipPermCheck: false}, init);
}, 1000);
});
var lastTo = 0;
$(document).bind("pagecontainerchange", function(e, data) {
if (lastTo) {
clearTimeout(lastTo);
}
switch (window.location.hash) {
case "#page-incall":
lastTo = setTimeout(function() {
if (!cur_call) {
goto_page("main");
}
}, 1000);
break;
case "#page-main":
if (cur_call) {
goto_page("incall");
}
break;
case "#page-login":
lastTo = setTimeout(function() {
if (online_visible) {
goto_page("main");
}
},
1000);
break;
}
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论