Advertisement
Guest User

Untitled

a guest
Sep 15th, 2016
526
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- hide script from old browsers
  2.  
  3. var timer;  
  4. var pluginVersion = "1.3.7.0003";
  5.  
  6. //in-call variables to manage display modes, etc
  7. var fullScreenShare = false;
  8. var isSharing = false;
  9. var sharesInCall = 0;
  10. var currentShareId = -1;
  11. var participantsInCall = 0;
  12. var newShareURI;
  13. var appWindowId = [];
  14. var sysDesktopId = [];
  15. var callState = "Idle";
  16. // configuration of behavior for this code
  17. var useConsoleForLogging = true;
  18. var useAlertsForLogging = false;
  19. var useCallbackForOutEvents = true;     // if false, use a JavaScript event instead of callback
  20. var willStartOnLoad = true;         // if true, will invoke start() on plug-in object from bodyLoaded()
  21. var useLoginEvent = true;
  22.  
  23. var soapProxy = "https://vidyoweb.apps.vidyo.com/sp/soap_proxy.php";
  24. var url_portalAddress;
  25. var url_user;
  26. var url_pass;
  27. var url_portalUri;
  28. var url_guestName;
  29. var url_roomPin;
  30. var url_encoded;
  31. var joinType = "guest";
  32.  
  33. // Toggle Icon code
  34. var img_camera_array= new Array('./images/camera_privacy.png','./images/camera.png');
  35. var img_mic_array= new Array('./images/mic_mute.png','./images/mic.png');
  36. var img_speaker_array= new Array('./images/speaker_mute.png','./images/speaker.png');
  37. var count_camera=-1;
  38. var count_mic=-1;
  39. var count_speaker=-1;
  40. var layoutState = 1;
  41.  
  42. var pluginAddedToDom = false;
  43.  
  44.  
  45. /*************************
  46.  * Plugin Deetection *
  47.  *************************/
  48.  
  49. var startPluginDetection = function() {
  50.     document.getElementById("PluginDetection").style.display = 'block';
  51.     pluginCheck();
  52. };
  53.  
  54. var pluginCheck = function () {
  55.     var pluginPresent = false;
  56.     var isChrome = proxyWrapper.isChrome;
  57.  
  58.     if (!isChrome) {
  59.         pluginPresent = detectPlugin();
  60.     }
  61.  
  62.     if (isChrome || pluginPresent){
  63.         document.getElementById("VidyoSplash").className = 'videoWrapperFull';
  64.         document.getElementById("VidyoSplash").style.display = 'block';
  65.         document.getElementById("VidyoInstall").className = 'videoWrapperNone';
  66.         document.getElementById("VidyoInstall").style.display = 'none';
  67.         if (isChrome){
  68.             log("Chrome detected! Loading nonNPAPI Extension and Plugin");
  69.             startChromeDetection();
  70.         }else{
  71.             log("non-Chrome detected! Loading NPAPI Plugin");
  72.             startPlugin();
  73.         }
  74.     } else { // not Chrome and NPAPI plugin not installed
  75.         log("NPAPI Plugin Not Installed!");
  76.         document.getElementById("VidyoSplash").className = 'videoWrapperNone';
  77.         document.getElementById("VidyoSplash").style.display = 'none';
  78.         document.getElementById("VidyoInstall").className = 'videoWrapperFull';
  79.         document.getElementById("VidyoInstall").style.display = 'block';
  80.         timer = setTimeout(function(){pluginCheck()}, 3000);
  81.     }
  82. };
  83.  
  84. //CHROME EXTENSION + non-NPAPI plugin
  85.  
  86. var startChromeDetection = function() {
  87.     if (!proxyWrapper.started) {
  88.         detectExtensionAndContinue();
  89.     }else{
  90.         startChromeVideo();
  91.     }
  92.     return true;
  93. };
  94.  
  95. var didCheckExtension = false;
  96. var detectExtensionAndContinue = function() {
  97.     document.getElementById("detectChrome").style.display = 'block';
  98.     document.getElementById("extensionDetectionState").style.display = 'block';
  99.     proxyWrapper.detectExtension('mmedphfiemffkinodeemalghecnicmnh', function (result) {
  100.         log("proxyWrapper.detectExtension result:" + result);
  101.         extensionInstalled = result;
  102.         if (extensionInstalled && !didCheckExtension) {
  103.             document.getElementById("PluginDetection").className = 'videoWrapperFull';
  104.             document.getElementById("PluginDetection").style.display = 'block';
  105.             document.getElementById("extensionDetectionState").innerHTML = 'Extension detected';
  106.             proxyWrapper.connect();
  107.             proxyWrapper.setOutEventDispatchMethod(onOutEvent);
  108.             detectVidyoClientForWebAndContinue();
  109.         } else if (extensionInstalled && didCheckExtension) {
  110.             log('Page should reload in order to utilize the extension');
  111.             document.getElementById("VidyoSplash").className = 'videoWrapperFull';
  112.             document.getElementById("VidyoSplash").style.display = 'block';
  113.             document.getElementById("ExtensionInstall").className = 'videoWrapperNone';
  114.             document.getElementById("ExtensionInstall").style.display = 'none';
  115.             location.reload();
  116.         } else {
  117.             log("No Extension detected, need to install Extension");
  118.             //prompt user to install Extension
  119.             document.getElementById("VidyoSplash").className = 'videoWrapperNone';
  120.             document.getElementById("VidyoSplash").style.display = 'none';
  121.             document.getElementById("PluginDetection").className = 'videoWrapperNone';
  122.             document.getElementById("PluginDetection").style.display = 'none';
  123.             document.getElementById("ExtensionInstall").className = 'videoWrapperFull';
  124.             document.getElementById("ExtensionInstall").style.display = 'block';
  125.             log("Will check extension again after short delay");
  126.             setTimeout(detectExtensionAndContinue, 2000);
  127.         }
  128.         didCheckExtension = true;
  129.     });
  130. }
  131.  
  132. var chromePluginInstallPrompted = false;
  133. var tries = 0;
  134. var detectVidyoClientForWebAndContinue = function() {
  135.     document.getElementById("VCFWDetectionState").style.display = 'block';
  136.     var checkVersion = proxyWrapper.supportedVersions[0];
  137.     proxyWrapper.sendEvent({
  138.         type: 'RequestConnectVersion',
  139.         version: checkVersion
  140.     }, function (connectRes) {
  141.         log("proxyWrapper.sendEvent(RequestConnectVersion): " +  connectRes);
  142.         if (connectRes.result) {
  143.             proxyWrapper.isSupportedVersion(function (supported, version) {
  144.                 log("proxyWrapper.isSupportedVersion: supported:" + supported + ", version:" + version);
  145.                 if (supported) {
  146.                     document.getElementById("VCFWDetectionState").innerHTML = 'VidyoClientForWeb detected';
  147.                     if (chromePluginInstallPrompted){
  148.                         location.reload();
  149.                     }
  150.                     document.getElementById("startVidyoClient").style.display = 'block';
  151.  
  152.                 } else {
  153.                     chromePluginInstallPrompted = true;
  154.                     log('version not supported, need to install VidyoClientforWeb');
  155.                     document.getElementById("PluginDetection").className = 'videoWrapperNone';
  156.                     document.getElementById("PluginDetection").style.display = 'none';
  157.                     document.getElementById("VidyoSplash").className = 'videoWrapperNone';
  158.                     document.getElementById("VidyoSplash").style.display = 'none';
  159.                     document.getElementById("VidyoChromeInstall").className = 'videoWrapperFull';
  160.                     document.getElementById("VidyoChromeInstall").style.display = 'block';
  161.                     log("Will check version again after short delay");
  162.                     setTimeout(detectVidyoClientForWebAndContinue, 4000);
  163.                 }
  164.             });
  165.         } else {
  166.             log('no version sent');
  167.             setTimeout(detectVidyoClientForWebAndContinue, 2000)
  168.             tries++;
  169.             if (tries > 2) {
  170.                 document.getElementById("extensionDetectionState").innerHTML = 'Extension detected but seems to be disabled. Enable it to continue with the process';
  171.                 document.getElementById("VCFWDetectionState").innerHTML = '';
  172.             }
  173.         }
  174.     });
  175. }
  176.  
  177. //NPAPI PLUGIN
  178.  
  179. var detectPlugin = function() {
  180.     document.getElementById("PluginDetection").className = 'videoWrapperFull';
  181.     document.getElementById("PluginDetection").style.display = 'block';
  182.     document.getElementById("detectNPAPI").style.display = 'block';
  183.     var isFound = false;
  184.     navigator.plugins.refresh(false);
  185.     var pluginMimeType = "application/x-vidyoweb-";
  186.     pluginMimeType+= pluginVersion;
  187.     var pluginActiveXType = "VidyoInc.VidyoWeb_";
  188.     pluginActiveXType+= pluginVersion;
  189.    
  190.     /* Try NPAPI approach */
  191.     /*jslint unparam: true*/
  192.     $.each(navigator.mimeTypes, function (i, val) {
  193.         if (val.type === pluginMimeType) {
  194.             /* Reload page when plugin is detected */
  195.             document.getElementById("PluginDetection").className = 'videoWrapperNone';
  196.             document.getElementById("PluginDetection").style.display = 'none';
  197.             document.getElementById("detectNPAPI").innerHTML = 'VidyoWeb plugin detected';
  198.             document.getElementById("startVidyoClient").style.display = 'block';
  199.             log('detectPlugin() -- NPAPI plugin found');
  200.             isFound = true;
  201.             return true;
  202.         }
  203.     });
  204.     /*jslint unparam: false*/
  205.  
  206.     /* Try IE approach (add object to DOM)*/
  207.     pluginAddedToDom = addPluginToDom();
  208.     if (pluginAddedToDom) {
  209.         log('detectPlugin() -- Plugin added to DOM');
  210.         document.getElementById("PluginDetection").className = 'videoWrapperNone';
  211.         document.getElementById("PluginDetection").style.display = 'none';
  212.         document.getElementById("detectNPAPI").innerHTML = 'VidyoWeb plugin detected';
  213.         document.getElementById("startVidyoClient").style.display = 'block';
  214.            
  215.         isFound = true;
  216.     }
  217.  
  218.     return isFound;
  219. };
  220.  
  221. var addPluginToDom = function() {
  222.  
  223.     //don't add if already added
  224.     var pluginHTML = document.getElementById('plugin');
  225.     if (!pluginHTML) {
  226.         log("Attempting to add plugin to the DOM...");
  227.  
  228.         var pluginMimeType = "application/x-vidyoweb-";
  229.         pluginMimeType+= pluginVersion;
  230.  
  231.         pluginHTML = document.createElement('object');
  232.         pluginHTML.className = 'plugin';
  233.         pluginHTML.id = 'plugin';
  234.         pluginHTML.width = "100%";
  235.         pluginHTML.height = "100%";
  236.  
  237.         var ie_version = whichIE();
  238.         var holder = document.getElementById('pluginHolder');
  239.         if (ie_version && ie_version < 11){
  240.             holder.appendChild(pluginHTML);
  241.         }
  242.        
  243.         try {
  244.             pluginHTML.type = pluginMimeType;
  245.         } catch (e) {
  246.             var mesg = "Unable to Instantiate VidyoWeb: " + pluginMimeType + "; Error:" + e;
  247.             log(mesg);
  248.             if (ie_version && ie_version < 11){
  249.                 holder.removeChild(pluginHTML);
  250.             }
  251.             return false;
  252.         }
  253.  
  254.         if (!pluginHTML.parentNode) {
  255.             holder.appendChild(pluginHTML);
  256.         }
  257.  
  258.         if (!pluginHTML.start) {
  259.             holder.removeChild(pluginHTML);
  260.             return false;
  261.         }
  262.     }
  263.     return true;
  264. };
  265.  
  266. var whichIE = function() {
  267.     var undef,
  268.     rv = -1,
  269.                     // Return value assumes failure.
  270.     ua = window.navigator.userAgent,
  271.     msie = ua.indexOf('MSIE '),
  272.     trident = ua.indexOf('Trident/'),
  273.     rvNum;
  274.     log("userAgent: " + ua);
  275.  
  276.     if (msie > 0) {
  277.                     // IE 10 or older => return version number
  278.         rv = parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)),
  279.                       10);
  280.     } else if (trident > 0) {
  281.                     // IE 11 (or newer) => return version number
  282.         rvNum = ua.indexOf('rv:');
  283.         rv = parseInt(ua.substring(rvNum + 3, ua.indexOf('.', rvNum)),
  284.                       10);
  285.     }
  286.  
  287.     return ((rv > -1) ? rv : undef);
  288. };
  289.  
  290.  
  291.  
  292. /*********************
  293.  * Start VidyoClient *
  294.  *********************/
  295.  
  296. var startVidyoClient = function() {
  297.     document.getElementById("startVidyoClient").style.display = 'block';
  298.     if (proxyWrapper.isChrome) {
  299.         vidyoClient.setProxy(proxyWrapper);
  300.         startVidyoClientForWeb();
  301.     } else {
  302.         startPlugin();
  303.     }
  304. }
  305.  
  306. var startVidyoClientForWeb = function() {
  307.     document.getElementById("startVidyoClient").style.display = 'block';
  308.     proxyWrapper.start(function (startRes) {
  309.         if(!startRes.error) {
  310.             log('VidyoClient started')
  311.         }
  312.     });
  313. }
  314.  
  315. var startPlugin = function ()   {
  316.     if(pluginAddedToDom){
  317.         var pluginHTML = document.getElementById('plugin');
  318.         var config = {
  319.             plugin: pluginHTML,
  320.             outEventCallbackObject: this,
  321.             defaultOutEventCallbackMethod: "onOutEvent",
  322.             useCallbackWithPlugin: useCallbackForOutEvents
  323.         };
  324.  
  325.         if (vidyoClient.start(config)) {
  326.             log("VidyoWeb started successfully");
  327.         } else {
  328.             log("VidyoWeb did not start successfully!");
  329.         }
  330.     }else{
  331.         log("VidyoWeb did not start successfully!");
  332.     }
  333. };
  334.  
  335. /*******************
  336.  * Join Conference *
  337.  *******************/
  338.  
  339. var joinConference = function() {
  340.     if (proxyWrapper.isChrome) {
  341.         detectCameraStatusAndContinue();
  342.     } else {
  343.         sendJoinEvent();
  344.     }
  345. }
  346.  
  347. //CHROME EXTENSION + non-NPAPI plugin
  348.  
  349. var detectCameraStatusAndContinue = function() {
  350.     proxyWrapper.sendRequest({type: 'RequestGetCameraStatus'}, function(cameraReady) {
  351.         if (cameraReady.status) {
  352.             startChromeVideo();
  353.         } else {
  354.             //loop until camera detected
  355.             setTimeout(detectCameraStatusAndContinue, 2000);
  356.         }
  357.     }        
  358.     );
  359. }
  360.  
  361. var startChromeVideo = function() {
  362.     var retval = false;
  363.     var holder = document.getElementById('pluginHolder');
  364.     holder.innerHTML = '<video autoplay style="width:100%; height: 100%; background: black;" ondblclick="onDoubleClickChrome()"></video>' + '<label id="lbl_usermedia" style="position: relative; color: #ddd; top: -50%; margin-left: 20px; font-size: 20px; font-family: arial;" >' + 'Make sure to allow the browser to use your camera.</label>';
  365.  
  366.     var usermediaMessage = document.getElementById('lbl_usermedia');
  367.     var video = holder.childNodes[0];
  368.     proxyWrapper.useVideoElem(video, function(message, permissionDeniedError) {
  369.         usermediaMessage.innerHTML = message;
  370.         if (!permissionDeniedError && !message) {
  371.             sendJoinEvent();
  372.             document.getElementById("VidyoSplash").className = 'videoWrapperNone';
  373.             document.getElementById("VidyoSplash").style.display = 'none';
  374.         } else if (permissionDeniedError) {
  375.             styledAlert('VidyoWeb needs access to your camera in order to join a conference.' + 'If you change your mind, click the camera icon in your url bar and allow the browser to use your devices');
  376.         } else {
  377.             styledAlert('VidyoWeb could not start your camera. Please reload the page and try again.');
  378.         }
  379.     });
  380. }
  381.  
  382. //NPAPI plugin
  383.  
  384.  
  385. var sendJoinEvent = function () {
  386.     if (url_useSignIn){
  387.        useLoginEvent = false;
  388.     }
  389.     if (url_portalUri){
  390.         sendGuestLogin();
  391.         joinType = "guest";
  392.         beginProgressBar();
  393.     } else if (url_portalAddress){
  394.         sendUserLogin();
  395.         joinType = "user";
  396.         beginProgressBar();
  397.     }else{
  398.         document.getElementById("VidyoSplash").style.display = 'none';
  399.         document.getElementById("usage").className = 'videoWrapperFull';
  400.         document.getElementById("usage").style.display = 'block';
  401.     }
  402.  
  403. }
  404.  
  405. var sendUserLogin = function () {
  406.      if (!url_portalAddress || !url_user || !url_pass){
  407.          return 0;
  408.      }
  409.      if (useLoginEvent){
  410.        var inEvent = {
  411.             'type': "InEventLogin",
  412.             'portalUri': url_portalAddress,
  413.             'userName': url_user,
  414.             'userPass': url_pass
  415.         };
  416.         vidyoClient.sendEvent(inEvent);
  417.     } else {
  418.         sendSoapUserLogin()
  419.             .done(function (response) {
  420.                 if (response) {
  421.                     var mesg = "Login Response: " + response;
  422.                     log(mesg);
  423.                     vidyoClient.sendRequest({type: 'RequestGetEID'}, function(response) {
  424.                         if (response.EID) {
  425.                             sendSoapUserLinkEndpoint(response.EID);
  426.                         }
  427.                     });
  428.                     //"BGHT4Z2VTJUJ7HTRCNHQS4YSQXZZZBSFZR2J5HPHYE97400VM0001@sandboxga.vidyo.com:17992;transport=TCP"
  429.                     var vmsplit = response.vmaddress.split("@");
  430.                     var vmIdentity = vmsplit[0];
  431.                     var serverplit = vmsplit[1].split(":");
  432.                     var serverAddress = serverplit[0];
  433.                     var secured = response.vmaddress.indexOf("TLS");
  434.                     var proxyAddress = "";
  435.                     if (response.proxyaddress)
  436.                         proxyAddress = response.proxyaddress.substring(0,response.proxyaddress.length-4);
  437.                     if (secured > 0)
  438.                         secured = true;
  439.                     else
  440.                         secured = false;
  441.                    
  442.                     var SignInEvent = {
  443.                         'type': "InEventSignIn",
  444.                         'serverAddress': serverAddress,
  445.                         'serverPort': "17992",
  446.                         'userName': url_user,
  447.                         'portalAccessKey': response.pak,
  448.                         'portalAddress': url_portalAddress + "/services/",
  449.                         'portalVersion': "",
  450.                         'vmIdentity': vmIdentity,
  451.                         'locationTag': response.loctag,
  452.                         'vidyoProxyAddress': [proxyAddress],
  453.                         'vidyoProxyPort': ["443"],
  454.                         'emcpSecured': secured,
  455.                         'guestLogin': false,
  456.                         'showDialpad': true,
  457.                         'showStartmeeting': true
  458.                     };
  459.                     vidyoClient.sendEvent(SignInEvent);
  460.                 }
  461.             })
  462.             .fail(function () {
  463.                 log("Failed");
  464.             });
  465.     }        
  466. };
  467.  
  468. var sendGuestLogin = function () {
  469.     if (!url_portalUri){
  470.         return 0;
  471.     }
  472.    
  473.     var encoded;
  474.     if (!url_encoded || (parseInt(url_encoded,10)==0)){
  475.         encoded = 0;
  476.     }else{
  477.         encoded = 1;
  478.     }
  479.  
  480.     var portalAddress;
  481.     var portalRes;
  482.     var roomKey;
  483.     if (encoded){
  484.         var temp = decodeURIComponent(url_portalUri);
  485.         portalRes = temp.split("\/flex.html\?roomdirect.html&key=");
  486.         portalAddress = portalRes[0];
  487.         roomKey = portalRes[1];
  488.     }else{
  489.         portalRes = url_portalUri.split("\/flex.html\?roomdirect.html");
  490.         portalAddress = portalRes[0];
  491.         var roomKey = getUrlVars()["key"];
  492.     }
  493.  
  494.     if (!url_guestName){
  495.          document.getElementById("VidyoSplash").style.display = 'none';
  496.          document.getElementById("guest").className = 'videoWrapperFull';
  497.          document.getElementById("guest").style.display = 'block';
  498.     }
  499.     //replace ALL occurrences of "+" in Guest name (in case of multiple spaces
  500.     url_guestName = url_guestName.replace(/\+/g," ");
  501.  
  502.     var inEvent = {
  503.         'type': "PrivateInEventVcsoapGuestLink",
  504.         'typeRequest': "GuestLink",
  505.         'requestId': 1234,
  506.         'portalUri': portalAddress,
  507.         'roomKey'  : roomKey,
  508.         'guestName': url_guestName,
  509.         'loginType': "guest"
  510.     };
  511.  
  512.     if (url_roomPin){
  513.         inEvent.pin = roomPin;
  514.     }
  515.     vidyoClient.sendEvent(inEvent);
  516. };
  517.  
  518. /*************************
  519.  * In Conference Actions *
  520.  *************************/
  521.  
  522.  
  523. /*************
  524.  * Callbacks *
  525.  *************/
  526.  
  527. //this is a callback from sending the request in updateShareList that will be used to update the share list dropdown
  528. function updateShareDropDown(response){
  529.     log("updateShareDropDown(): " + response);
  530.  
  531.     var transformedData = {
  532.         windows: [],
  533.         desktops: [],
  534.         sharing: (currentShareId === -1) ? false : true
  535.     };
  536.     var i,
  537.     name,
  538.     mywindow,
  539.     desktop;
  540.     //windows and desktops are separated in the response
  541.     //you may choose not to expose all windows and/or desktops based on the use case. The filtering would happen here.
  542.     for (i = 0; i < response.numApplicationWindows; i++) {
  543.         name = (response.appWindowAppName[i] && response.appWindowAppName[i].length) ? response.appWindowAppName[i] : response.appWindowName[i];
  544.         mywindow = {
  545.             id: response.appWindowId[i],
  546.                 name: name,
  547.                 highlight: (currentShareId === response.appWindowId[i]) ? true : false
  548.         };
  549.         transformedData.windows.push(mywindow);
  550.     }
  551.     sysDesktopId.length = 0;
  552.     for (i = 0; i < response.numSystemDesktops; i++) {
  553.         //Custom text for sharing full displays
  554.         var desktopName = "Desktop ";
  555.         desktopName = desktopName + (i+1).toString();
  556.         desktop = {
  557.             id: response.sysDesktopId[i],
  558.             name: desktopName,
  559.             highlight: (currentShareId === response.sysDesktopId[i]) ? true : false
  560.         };
  561.         transformedData.desktops.push(desktop);
  562.         sysDesktopId.push(response.sysDesktopId[i]);
  563.     }
  564.  
  565.  
  566.     var options = $("#img_share_b");
  567.     options.html('');
  568.  
  569.     //note that using an HTML dropdown list allows the dropdown to appear over the video window.
  570.     //Javascript and other more complex UI may not always overlay plugin/video divs in some browsers.
  571.     if (isSharing) {
  572.         options.append($("<option/>").val(-1).text("Stop Sharing"));
  573.     }
  574.  
  575.     $.each(transformedData.windows, function() {
  576.         if (this.highlight){
  577.            options.append($("<option selected/>").val(this.id).text(this.name));
  578.         }else{
  579.            options.append($("<option/>").val(this.id).text(this.name));
  580.         }
  581.     });
  582.     $.each(transformedData.desktops, function() {
  583.         if (this.highlight){
  584.            options.append($("<option selected/>").val(this.id).text(this.name));
  585.         }else{
  586.            options.append($("<option/>").val(this.id).text(this.name));
  587.         }
  588.     });
  589.  
  590. }
  591.  
  592. function updateShareList() {
  593.     log('updateShareList()');
  594.     var request = {
  595.             'type': "RequestGetWindowsAndDesktops"
  596.     };
  597.     vidyoClient.sendRequest(request, updateShareDropDown);
  598. }
  599.  
  600. function shareChanged(shareId) {    
  601.     //keep track of what's newly shared to updated highlighting on share dropdown
  602.     currentShareId = shareId;    
  603.     //shareId = -1 means stop sharing
  604.     if (shareId == -1) {
  605.         isSharing = false;
  606.         log("sending unshare event");
  607.         sendUnshareEvent();
  608.     } else {
  609.         isSharing = true;
  610.         log("sending share event with id " + shareId);
  611.         sendShareEvent(shareId);
  612.     }
  613. }
  614.  
  615. //This function toggles from display:block to display:none - DO NOT USE on Vidyo elements.  
  616. function toggleDisplay(div_id) {
  617.     var el = document.getElementById(div_id);
  618.     if ( el.style.display == 'none' ) { el.style.display = 'block';}
  619.     else {el.style.display = 'none';}
  620. }
  621.  
  622.  
  623. function getUrlVars() {
  624.     var vars = {};
  625.     var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
  626.         vars[key] = value;
  627.     });
  628.     return vars;
  629. }
  630.  
  631. function toggleCameraIcon()
  632. {
  633.     count_camera++;
  634.     document.getElementById("img_camera").src=img_camera_array[count_camera];
  635.     if(count_camera==0)
  636.         sendMuteCameraEvent(true);
  637.     else
  638.         sendMuteCameraEvent(false);
  639.     if(count_camera==img_camera_array.length-1) {
  640.         count_camera=-1;
  641.     }
  642. }
  643.  
  644. function toggleMicIcon()
  645. {
  646.     count_mic++;
  647.     document.getElementById("img_mic").src=img_mic_array[count_mic];
  648.     if(count_mic==0)
  649.         sendMuteMicEvent(true);
  650.     else
  651.         sendMuteMicEvent(false);
  652.     if(count_mic==img_mic_array.length-1) {
  653.         count_mic=-1;
  654.     }
  655. }
  656.  
  657. function toggleSpeakerIcon()
  658. {
  659.     count_speaker++;
  660.     document.getElementById("img_speaker").src=img_speaker_array[count_speaker];
  661.     if(count_speaker==0)
  662.         sendMuteSpeakerEvent(true);
  663.     else
  664.         sendMuteSpeakerEvent(false);
  665.     if(count_speaker==img_speaker_array.length-1) {
  666.     count_speaker=-1;
  667.     }
  668. }
  669.  
  670. function timeStamp() {
  671.   var now = new Date();
  672.   var date = [ now.getMonth() + 1, now.getDate(), now.getFullYear() ];
  673.   var time = [ now.getHours(), now.getMinutes(), now.getSeconds() ];
  674.   var suffix = ( time[0] < 12 ) ? "AM" : "PM";
  675.   time[0] = ( time[0] < 12 ) ? time[0] : time[0] - 12;
  676.   time[0] = time[0] || 12;
  677.  
  678.   for ( var i = 1; i < 3; i++ ) {
  679.     if ( time[i] < 10 ) {
  680.       time[i] = "0" + time[i];
  681.     }
  682.   }
  683.  
  684.   // Return the formatted string
  685.   return date.join("/") + " " + time.join(":") + " " + suffix;
  686. }
  687.  
  688. var log = function (msg) {
  689.     if (useConsoleForLogging) {
  690.         console.log(timeStamp() + "  " + msg);
  691.     }
  692.     if (useAlertsForLogging) {
  693.         alert(msg);
  694.     }
  695. };
  696.  
  697.  
  698. //Our logic is to always adjust self-view depending on participants in call and if there is a share in the conference
  699. //We have found this logic to provide optimal viewing.
  700. var setPreviewModeonStatusChange = function(){
  701.     if (fullScreenShare){
  702.     setPreviewMode("None");
  703.     }else{
  704.        if (participantsInCall == 2){
  705.           if (sharesInCall>0){
  706.               setPreviewMode("Dock");
  707.           }else{
  708.               setPreviewMode("PIP");
  709.           }
  710.       }else if (participantsInCall == 1){
  711.           setPreviewMode("None");
  712.       }else{
  713.           setPreviewMode("Dock");
  714.       }
  715.    }
  716. };
  717.    
  718. /**
  719.  * Get Number of Participants
  720.  */
  721. clientGetNumParticipants = function (callback) {
  722.     var request = {
  723.         'type': "RequestGetNumParticipants",
  724.         'numParticipants':0
  725.     };
  726.  
  727.  
  728.     vidyoClient.sendRequest(request, function(response){
  729.         log("clientGetNumParticipants(): " + response);
  730.         callback(response.numParticipants);
  731.     });
  732. };
  733.  
  734.  
  735. var sendShareEvent = function(shareId) {
  736.     var shareType;
  737.     var window = shareId;
  738.    
  739.     if (sysDesktopId.indexOf(shareId)!==-1){
  740.         shareType = 'DesktopWindow';
  741.         if (proxyWrapper.isChrome){
  742.             window = sysDesktopId.indexOf(shareId);
  743.         }
  744.     }else{
  745.         shareType = 'ApplicationWindow';
  746.     }
  747.     var inEvent = {
  748.              'type': 'InEventShare',
  749.              'window': window,
  750.              'shareType': shareType
  751.     };
  752.  
  753.     vidyoClient.sendEvent(inEvent);
  754. }
  755.  
  756. var sendUnshareEvent = function() {
  757.     var inEvent = {
  758.         'type': 'InEventUnshare'
  759.     };
  760.  
  761.     vidyoClient.sendEvent(inEvent);
  762. }
  763.  
  764.  
  765. /**
  766.  * Get shares in Conference
  767.  * @param  {callback} currApp ID of share to see
  768.  * @return {Object} Currently available shares
  769.  */
  770. var clientSharesGet = function (callback) {
  771.     var request = {};
  772.     request.type = "RequestGetWindowShares";
  773.  
  774.     // public properties for created object,
  775.     // initial values of which are potentially passed
  776.     // into this factory function
  777.     request.requestType ="";// params && params.requestType || "";
  778.     request.remoteAppUri = [""];//params && params.remoteAppUri || [""];
  779.     request.remoteAppName = [""];// params && params.remoteAppName || [""];
  780.     request.numApp = 0;// params && params.numApp || 0;
  781.     request.currApp = 0;// params && params.currApp || 0;
  782.     request.eventUri = "";// params && params.eventUri || "";
  783.     request.newApp =  0;//params && params.newApp || 0;
  784.  
  785.     vidyoClient.sendRequest(request, callback);
  786. };
  787.  
  788. //using non-inline callback for setting a new remote share to display
  789. displayNewShare = function(request) {
  790.     var shares = request.numApp;
  791.     //if there's a new share, display it
  792.     if (newShareURI){
  793.         for (i = 0; i < request.numApp; i++){
  794.             if (request.remoteAppUri[i]==newShareURI){
  795.                 request.newApp = i+1;
  796.                 break;
  797.             }
  798.         }
  799.     //otherwise (when shares are removed), display the last share added
  800.     }else{
  801.         request.newApp = request.numApp;
  802.     }
  803.     request.type = "RequestSetWindowShares";
  804.     request.requestType = "ChangeSharingWindow";
  805.  
  806.     //FIX: add response callback to check for success
  807.     vidyoClient.sendRequest(request);
  808. }
  809.  
  810. /**
  811.  * Select remote share to see
  812.  * @param  none; always picks the newest share added or last share in the list
  813.  * @return {Object} number of current shares
  814.  */
  815. clientSharesSetCurrent = function () {
  816.     clientSharesGet(displayNewShare);
  817. };
  818.  
  819.  
  820.  
  821.  
  822. // declarations for functions, wired to plugin events
  823. var onOutEvent = function (event) {
  824.     var log_mesg;
  825.     event = event || {};
  826.     var msg = "Received out event with type of " + event.type;
  827.  
  828.     log(msg);
  829.     switch (event.type) {
  830.         case 'OutEventPluginConnectionSuccess':
  831.             waitingForConnection = false;
  832.             //callback(true);
  833.             break;
  834.         case 'OutEventPluginConnectionFailure':
  835.             //alert('received OutEventPluginConnectionFailure, aborting');
  836.             waitingForConnection = false;
  837.             if (!proxyWrapper.isChrome) {
  838.                 vidyoClient.stop();
  839.             }
  840.             //callback(false, 'Multiple VidyoWeb browser tabs are not supported. ' + 'Please close this tab and use your original VidyoWeb instance.');
  841.             break;
  842.         case 'OutEventPluginError':
  843.             //alert('received OutEventPluginError, aborting');
  844.             waitingForConnection = false;
  845.             if (!proxyWrapper.isChrome) {
  846.                 vidyoClient.stop();
  847.             }
  848.             //callback(false, 'Error received trying to start VidyoClient ' + event.error);
  849.             break;
  850.         case 'OutEventReloaded':
  851.             //alert('received OutEventReloaded, aborting');
  852.             waitingForConnection = false;
  853.             if (!proxyWrapper.isChrome) {
  854.                 vidyoClient.stop();
  855.             }
  856.             //callback(false, 'VidyoWeb is still logging out. please wait a few seconds before trying to join a conference.');
  857.             break;
  858.         case 'extensionMsgClientClosed':
  859.             if (event.message === 'Native host has exited.') {
  860.                 log('VidyoClientForWeb stopped for some reason');
  861.             }else if (event.message === 'Specified native messaging host not found.'){
  862.                 log('VidyoClientForWeb not Found or not installed');
  863.             }
  864.             break;
  865.         case 'extensionMsgClientStarting':
  866. //            document.getElementById("VidyoChromeInstall").className = 'videoWrapperNone';
  867. //            document.getElementById("VidyoChromeInstall").style.display = 'none';
  868. //            document.getElementById("VidyoSplash").className = 'videoWrapperFull';
  869. //            document.getElementById("VidyoSplash").style.display = 'block';
  870.             break;
  871. //---------typical OUT EVENTS-------------            
  872.     case 'OutEventCallState':
  873.         log_mesg = "********* Call State Changed to: " + event.callState + "**********";
  874.             log(log_mesg);
  875.         callState = event.callState;
  876.         break;
  877.         case 'OutEventSignedIn':
  878.             //this is used if you intend to log in with credentials and join your own room ONLY.
  879.             if (joinType == "user"){
  880.                 log("Joining Own Room...");
  881.                 sendStartMyMeetingEvent();
  882.             }else{
  883.                 //add Soap logic for joining as guest
  884.             }
  885.             break;
  886.         case 'OutEventSignIn':
  887.             if (parseInt(event.activeEid, 10) === 0){
  888.                 var licenseEvent = {
  889.                     'type': "InEventLicense"
  890.                 };  
  891.                 vidyoClient.sendEvent(licenseEvent);
  892.             }
  893.             break;
  894.         case 'OutEventLogicStarted':          
  895.             console.log('VidyoClient started correctly')
  896.             document.getElementById("VidyoSplash").className = 'videoWrapperNone';
  897.             document.getElementById("VidyoSplash").style.display = 'none';
  898.             document.getElementById("JoinCallButton").style.display = 'block';
  899.             break;
  900.         case 'OutEventConferenceActive':
  901.             document.getElementById("VidyoSplash").className = 'videoWrapperSmall';
  902.             toggleDisplay('VidyoSplash');
  903.             toggleDisplay('Buttons');
  904.             document.getElementById("VidyoArea").className = 'videoFull';
  905.             document.getElementById("pluginHolder").className = 'videoFull';
  906.             if (proxyWrapper.isChrome){
  907.                 document.getElementsByTagName("video")[0].style.width="100%";
  908.                 document.getElementsByTagName("video")[0].style.height="100%";
  909.             }
  910.             setPreferredMode(1);
  911.            setParticipantLimit(16);
  912.             break;
  913.         case 'OutEventConferenceEnded':
  914.         setParticipantLimit(16);
  915.             //Assume want to stop the plugin after conference is over. Change logic for registered user use
  916.             if (joinType == "user"){
  917.                 if (!useLoginEvent)
  918.                     sendSoapUserLogOut();
  919.             }
  920.             vidyoClient.stop();
  921.             break;
  922.         case 'OutEventJoinProgress':
  923.             //this logic is used to advance the progress bar in the UI. Other out events
  924.             //will indicate how many joinprogress steps there are, but here we assume 6 steps
  925.             //(100/6 ~=16.6)
  926.             var progressSoFar = $( "#progressbar" ).progressbar( "value" );
  927.             progressSoFar+= 16.6;
  928.             $( "#progressbar" ).progressbar({
  929.                 value: progressSoFar
  930.             });
  931.  
  932.             log_mesg = "Join Progress " + progressSoFar;
  933.             log(log_mesg);
  934.             break;
  935.         case 'OutEventAddShare':
  936.             sharesInCall++;
  937.             log_mesg = "Share added from URI: " + event.URI;
  938.             log(log_mesg);
  939.             newShareURI = event.URI;
  940.             clientSharesSetCurrent();
  941.             setPreviewModeonStatusChange();
  942.             break;
  943.         case 'OutEventRemoveShare':
  944.             sharesInCall--;
  945.         if (sharesInCall==0){
  946.         fullScreenShare = false;
  947.         setParticipantLimit(16);
  948.         }
  949.         setPreviewModeonStatusChange();
  950.             break;
  951.         case 'OutEventParticipantsChanged':
  952.             participantsInCall = event.participantCount;
  953.             setPreviewModeonStatusChange();
  954.             break;
  955.         case 'PrivateOutEventGetJoinApproval':
  956.             if (!event.joinStatus) {
  957.                 location.reload();
  958.             }
  959.         break;
  960.     case 'PrivateOutEventVcsoapGuestLink':
  961.         log("****** GuestID = " + event.guestID + "********");
  962.             break;
  963.         //please add additional OutEvents as needed
  964.         default:
  965.             break;
  966.     }
  967. };
  968.  
  969.  
  970. var setParticipantLimit = function(count){
  971.       if (count>8 || count<0)
  972.     count = 16;
  973.       var inEvent = {
  974.           'type': "InEventParticipantsLimit",
  975.       'maxNumParticipants': count
  976.       };
  977.       vidyoClient.sendEvent(inEvent);
  978.  
  979. }
  980.  
  981. var onDoubleClickChrome = function(){
  982.     if (sharesInCall>0){
  983.        if (fullScreenShare){
  984.           setParticipantLimit(16);
  985.           fullScreenShare=false;
  986.        }else{
  987.       setParticipantLimit(0);
  988.       fullScreenShare=true;
  989.        }
  990.        setPreviewModeonStatusChange();
  991.  
  992.     }
  993. }
  994.  
  995. var openChromeWebStore = function() {
  996.     window.open('https://chrome.google.com/webstore/detail/mmedphfiemffkinodeemalghecnicmnh', '', 'width=1000, height=300');
  997. };
  998.  
  999. var successFunction = function() {  
  1000. //    $scope.isOnExtensionDownloadPage = true;
  1001. //    showInstallStep('install_extension_inline');
  1002. };
  1003.  
  1004. //oops, could not directly install, just pop-up the extension webstore
  1005. var errorFunction = function(e) {
  1006.     openChromeWebStore();
  1007. };
  1008. //Install directly. Will only work on Google verified sites connected to the VidyoWeb extension.
  1009. var installExtension = function() {
  1010.     chrome.webstore.install('https://chrome.google.com/webstore/detail/mmedphfiemffkinodeemalghecnicmnh', successFunction, errorFunction);
  1011. };
  1012.  
  1013. var sendSoapUserLinkEndpoint = function(endpointID){
  1014.     var body = {
  1015.         EID: endpointID
  1016.     };
  1017.  
  1018.     return sendSoapUserRequest("linkEndpoint",body, url_portalAddress, url_user, url_pass);
  1019. }
  1020.                                
  1021. var sendSoapUserLogin = function () {
  1022.     return sendSoapUserRequest("logIn","", url_portalAddress, url_user, url_pass);
  1023. }
  1024.  
  1025. var sendSoapUserLogOut = function () {
  1026.     return sendSoapUserRequest("logOut","", url_portalAddress, url_user, url_pass);
  1027. }
  1028.  
  1029. var getPortalVersion = function () {
  1030.     return sendSoapUserRequest("getPortalVersion","", url_portalAddress, url_user, url_pass);
  1031. }
  1032.  
  1033. /**
  1034.  * Sends a Web Service User API request to the portal using SOAP proxy.
  1035.  * Can replace SOAP interface here.
  1036.  * @param  {String} action SOAP action
  1037.  * @param  {Object} body   Body of the SOAP request
  1038.  * @return {Object}        Promise to resolve the request and Object.request will have jQuery Ajax request that can be canceled
  1039.  */
  1040. var sendSoapUserRequest = function (action, body, portalAddr, username, password) {
  1041.     //logger.log('info', 'soap', 'sendSoapUserRequest(', (action || ""), (body || ""), ')');
  1042.     if (!url_portalAddress){
  1043.         return;
  1044.     }
  1045.    
  1046.     try {
  1047.         return soapClient.request({
  1048.             ajaxDataType: 'jsonp',
  1049.             proxyUrl: soapProxy,
  1050.             soapAction: action,
  1051.             soapServerUrl: portalAddr,
  1052.             soapServiceUsername: username,
  1053.             soapServicePassword: password,
  1054.             soapServicePath: "/services/v1_1/VidyoPortalUserService?wsdl",
  1055.             soapBody: (body || "")
  1056.         });
  1057.  
  1058.     } catch (e) {
  1059.         var mesg = "Failed to send Soap request(" + action + "): " + e;
  1060.         log(mesg);
  1061.         return "";
  1062.     }
  1063. };
  1064. <<<<<<< 7fd0fbd1f9083934a64b310f65918167ad4e5619
  1065. =======
  1066.  
  1067.  
  1068. var beforeUnload = function () {
  1069.     setParticipantLimit(16);
  1070.     if (callState != "InConference"){
  1071.       var inEvent = {
  1072.           'type': "InEventCancel"
  1073.       };
  1074.       vidyoClient.sendEvent(inEvent);
  1075.     }
  1076.     //return 'Please press the Logout button to logout.';
  1077. }
  1078.  
  1079. var isSecure = function()
  1080. {
  1081.     return window.location.protocol == 'https:';
  1082. }
  1083.  
  1084. var isState = function()
  1085. {
  1086.     return layoutState;
  1087. }
  1088.  
  1089. var bodyLoaded = function () {
  1090.  
  1091.     var str = document.location.href;
  1092.     var res = str.split("?");
  1093.    
  1094.     //prevent right-clicking on video div containing Vidyo on Chrome
  1095.     document.oncontextmenu = function() { return false; };
  1096.     parseUrlArgs();
  1097.     if (!isSecure()){
  1098.         var mainURL = res[0].substring(7);
  1099.         document.getElementById("VidyoSplash").style.display = 'none';
  1100.         document.getElementById("usage").className = 'videoWrapperFull';
  1101.         document.getElementById("usage").style.display = 'block';
  1102.     }else{
  1103.         var mainURL = res[0].substring(8);
  1104.  
  1105.         //load scripts first
  1106.         //vidyo.client2.js is the non-requirejs version of vidyo.client.js.
  1107.         //Feel free to use angular, requirejs, etc as desired for ease of loading or to fit the current architecture
  1108.         var scripts = ['./lib/vidyo.client/proxywrapper.js', './lib/vidyo.client/vidyo.client2.js', './js/utils/soap-proxy.js'];
  1109.         $.getScript(scripts[0], function() {
  1110.             $.getScript(scripts[1], function() {
  1111.                 $.getScript(scripts[2], function() {
  1112.                     pluginCheck();
  1113.                 });
  1114.             });
  1115.         });
  1116.     }
  1117. };
  1118.  
  1119. var whichIE = function() {
  1120.     var undef,
  1121.     rv = -1,
  1122.                     // Return value assumes failure.
  1123.     ua = window.navigator.userAgent,
  1124.     msie = ua.indexOf('MSIE '),
  1125.     trident = ua.indexOf('Trident/'),
  1126.     rvNum;
  1127.     log("userAgent: " + ua);
  1128.  
  1129.     if (msie > 0) {
  1130.                     // IE 10 or older => return version number
  1131.         rv = parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)),
  1132.                       10);
  1133.     } else if (trident > 0) {
  1134.                     // IE 11 (or newer) => return version number
  1135.         rvNum = ua.indexOf('rv:');
  1136.         rv = parseInt(ua.substring(rvNum + 3, ua.indexOf('.', rvNum)),
  1137.                       10);
  1138.     }
  1139.  
  1140.     return ((rv > -1) ? rv : undef);
  1141. };
  1142.  
  1143. var addPluginToDom = function() {
  1144.  
  1145.     //don't add if already added
  1146.     var pluginHTML = document.getElementById('plugin');
  1147.     if (!pluginHTML) {
  1148.         log("Attempting to add plugin to the DOM...");
  1149.  
  1150.         var pluginMimeType = "application/x-vidyoweb-";
  1151.         pluginMimeType+= pluginVersion;
  1152.  
  1153.         pluginHTML = document.createElement('object');
  1154.         pluginHTML.className = 'plugin';
  1155.         pluginHTML.id = 'plugin';
  1156.         pluginHTML.width = "100%";
  1157.         pluginHTML.height = "100%";
  1158.  
  1159.         var ie_version = whichIE();
  1160.         var holder = document.getElementById('pluginHolder');
  1161.         if (ie_version && ie_version < 11){
  1162.             holder.appendChild(pluginHTML);
  1163.         }
  1164.        
  1165.         try {
  1166.             pluginHTML.type = pluginMimeType;
  1167.         } catch (e) {
  1168.             var mesg = "Unable to Instantiate VidyoWeb: " + pluginMimeType + "; Error:" + e;
  1169.             log(mesg);
  1170.             if (ie_version && ie_version < 11){
  1171.                 holder.removeChild(pluginHTML);
  1172.             }
  1173.             return false;
  1174.         }
  1175. >>>>>>> worked on logic of state
  1176.  
  1177.  
  1178. var beforeUnload = function () {
  1179.     setParticipantLimit(16);
  1180.     if (callState != "InConference"){
  1181.       var inEvent = {
  1182.           'type': "InEventCancel"
  1183.       };
  1184.       vidyoClient.sendEvent(inEvent);
  1185.     }
  1186.     //return 'Please press the Logout button to logout.';
  1187. }
  1188.  
  1189. var isSecure = function()
  1190. {
  1191.     return window.location.protocol == 'https:';
  1192. }
  1193.  
  1194. var bodyLoaded = function () {
  1195.  
  1196.     var str = document.location.href;
  1197.     var res = str.split("?");
  1198.    
  1199.     //prevent right-clicking on video div containing Vidyo on Chrome
  1200.     document.oncontextmenu = function() { return false; };
  1201.     parseUrlArgs();
  1202.     if (!isSecure()){
  1203.         var mainURL = res[0].substring(7);
  1204.         document.getElementById("VidyoSplash").style.display = 'none';
  1205.         document.getElementById("usage").className = 'videoWrapperFull';
  1206.         document.getElementById("usage").style.display = 'block';
  1207.     }else{
  1208.         var mainURL = res[0].substring(8);
  1209.  
  1210.         //load scripts first
  1211.         //vidyo.client2.js is the non-requirejs version of vidyo.client.js.
  1212.         //Feel free to use angular, requirejs, etc as desired for ease of loading or to fit the current architecture
  1213.         var scripts = ['./lib/vidyo.client/proxywrapper.js', './lib/vidyo.client/vidyo.client2.js', './js/utils/soap-proxy.js'];
  1214.         $.getScript(scripts[0], function() {
  1215.             $.getScript(scripts[1], function() {
  1216.                 $.getScript(scripts[2], function() {
  1217.                     console.log ('All sccripts loaded correctly');
  1218.                     document.getElementById("VidyoSplash").className = 'videoWrapperNone';
  1219.                     document.getElementById("VidyoSplash").style.display = 'none';
  1220.                     setTimeout(function(){
  1221.                         document.getElementById("PluginDetection").style.display = 'block';
  1222.                     }, 500);
  1223.                 });
  1224.             });
  1225.         });
  1226.     }
  1227. };
  1228.  
  1229. var setPreferredMode = function(preferred){
  1230.     var inEvent = {
  1231.         'type': "InEventLayout"
  1232.     };
  1233.     inEvent.numPreferred = preferred;
  1234.     vidyoClient.sendEvent(inEvent);
  1235. };
  1236.  
  1237. var setPreviewMode = function(previewMode){
  1238.     var inEvent = {
  1239.         'type': "EventPreview"
  1240.     };
  1241.     inEvent.previewMode = previewMode;
  1242.     vidyoClient.sendEvent(inEvent);
  1243. };
  1244.  
  1245. var parseUrlArgs = function () {
  1246.     url_portalAddress = getUrlVars()["portalAddress"];
  1247.     url_user          = getUrlVars()["username"];
  1248.     url_pass          = getUrlVars()["password"];
  1249.     url_portalUri     = getUrlVars()["portalUri"];
  1250.     url_guestName     = getUrlVars()["guestName"];
  1251.     url_roomPin       = getUrlVars()["roomPin"];
  1252.     url_encoded       = getUrlVars()["encoded"];
  1253.     url_useSignIn     = getUrlVars()["useSignIn"];
  1254. }
  1255.  
  1256.  
  1257. var beginProgressBar = function() {
  1258.     $( "#progressbar" ).progressbar({
  1259.         value: 16.6
  1260.     });
  1261. }
  1262.  
  1263. var sendStartMyMeetingEvent = function () {
  1264.     var inEvent = {
  1265.         'type': "PrivateInEventStartMyMeeting"
  1266.     };
  1267.     vidyoClient.sendEvent(inEvent);
  1268. };
  1269.  
  1270. var unloadVidyo = function() {
  1271.  
  1272.     var obj = document.getElementById("pluginHolder");
  1273.     obj.removeChild(obj.childNodes[0]);
  1274.     delete obj;
  1275. }
  1276.  
  1277. var sendLeaveEvent = function () {
  1278.     var inEvent = {
  1279.         'type': "InEventLeave"
  1280.     };
  1281.     // Make sure you reduce the size of the VidyoWeb Plugin renderer now,
  1282.     // otherwise you will see video artifacts
  1283.     document.getElementById("pluginHolder").className = 'videoMin';
  1284.     //document.getElementById("pluginHolder").style.display = 'none';
  1285.     document.getElementById("VidyoSplash").className = 'videoWrapperFull';
  1286.     toggleDisplay('VidyoSplash');
  1287.     toggleDisplay('js-progressbar-container');
  1288.     toggleDisplay('Buttons');
  1289.     document.getElementById("VidyoArea").className = 'videoWrapperSmall';
  1290.     document.getElementById("pluginHolder").className = 'videoWrapperSmall';
  1291.     vidyoClient.sendEvent(inEvent);
  1292.  
  1293.     //unloadVidyo();
  1294. };
  1295.  
  1296. var sendMuteCameraEvent = function (bMute) {
  1297.     var inEvent = {
  1298.         'type': "InEventMuteVideo",
  1299.         'willMute': true
  1300.     };
  1301.     inEvent.willMute = bMute;
  1302.  
  1303.     vidyoClient.sendEvent(inEvent);
  1304. };
  1305.  
  1306.  
  1307. var sendMuteMicEvent = function (bMute) {
  1308.     var inEvent = {
  1309.         'type': "InEventMuteAudioIn",
  1310.         'willMute': true
  1311.     };
  1312.     inEvent.willMute = bMute;
  1313.  
  1314.     vidyoClient.sendEvent(inEvent);
  1315. };
  1316.  
  1317.  
  1318. var sendMuteSpeakerEvent = function (bMute) {
  1319.     var inEvent = {
  1320.         'type': "InEventMuteAudioOut",
  1321.         'willMute': true
  1322.     };
  1323.     inEvent.willMute = bMute;
  1324.  
  1325.     vidyoClient.sendEvent(inEvent);
  1326. };
  1327.  
  1328. var createFromForm = function () {
  1329.     console.log("ENTERED HERE");
  1330.     url_portalAddress = document.getElementById('portal').value;
  1331.     if(!url_portalAddress.includes("https://") && !url_portalAddress.includes("http://"))
  1332.         url_portalAddress = "https://" + url_portalAddress;
  1333.     url_user = document.getElementById('user').value;
  1334.     url_pass = document.getElementById('password').value;
  1335.     sendUserLogin();
  1336.     document.getElementById("VidyoSplash").style.display = 'block';
  1337.     document.getElementById("usage").style.display = 'none';
  1338.     joinType = "user";
  1339.     beginProgressBar();
  1340. }
  1341.  
  1342. var createGuestName = function () {
  1343.     console.log("ENTERED HERE GUEST NAME");
  1344.     url_guestName = document.getElementById('name').value;
  1345.     document.getElementById("VidyoSplash").style.display = 'block';
  1346.     document.getElementById("guest").style.display = 'none';
  1347.     sendGuestLogin();
  1348.     joinType = "guest";
  1349.     beginProgressBar();
  1350. }
  1351.  
  1352. // end hiding script from old browsers -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement