Advertisement
Guest User

do_external_connect.js

a guest
May 24th, 2017
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. /* global config, getRoomName, getConfigParamsFromUrl */
  2. /* global createConnectionExternally */
  3. /**
  4. * Implements extrnal connect using createConnectionExtenally function defined
  5. * in external_connect.js for Jitsi Meet. Parses the room name and token from
  6. * the url and executes createConnectionExtenally.
  7. *
  8. * NOTE: If you are using lib-jitsi-meet without Jitsi Meet you should use this
  9. * file as reference only because the implementation is Jitsi Meet specific.
  10. *
  11. * NOTE: For optimal results this file should be included right after
  12. * exrnal_connect.js.
  13. */
  14.  
  15. /**
  16. * Executes createConnectionExternally function.
  17. */
  18. (function () {
  19. var hashParams = getConfigParamsFromUrl("hash", true);
  20. var searchParams = getConfigParamsFromUrl("search", true);
  21.  
  22. //Url params have higher proirity than config params
  23. var url = config.externalConnectUrl;
  24. if(hashParams.hasOwnProperty('config.externalConnectUrl'))
  25. url = hashParams["config.externalConnectUrl"];
  26.  
  27. /**
  28. * Check if connect from connection.js was executed and executes the handler
  29. * that is going to finish the connect work.
  30. */
  31. function checkForConnectHandlerAndConnect() {
  32.  
  33. if(window.APP && window.APP.connect.status === "ready") {
  34. window.APP.connect.handler();
  35. }
  36. }
  37.  
  38. function error_callback(error){
  39. if(error) //error=undefined if external connect is disabled.
  40. console.warn(error);
  41. // Sets that global variable to be used later by connect method in
  42. // connection.js
  43. window.XMPPAttachInfo = {
  44. status: "error"
  45. };
  46. checkForConnectHandlerAndConnect();
  47. }
  48.  
  49. if (getRoomName()) {
  50. loginGofastConference(searchParams.token,searchParams.nid,searchParams.domain,searchParams.name);
  51. }
  52.  
  53. /*if(!url || !window.createConnectionExternally) {
  54. error_callback();
  55. return;
  56. }
  57. var room_name = getRoomName();
  58. if(!room_name) {
  59. error_callback();
  60. return;
  61. }
  62.  
  63. url += "?room=" + room_name;
  64.  
  65. var token = hashParams["config.token"] || config.token ||
  66. searchParams.jwt;
  67. if(token)
  68. url += "&token=" + token;
  69.  
  70. createConnectionExternally(url, function(connectionInfo) {
  71. // Sets that global variable to be used later by connect method in
  72. // connection.js
  73. window.XMPPAttachInfo = {
  74. status: "success",
  75. data: connectionInfo
  76. };
  77. checkForConnectHandlerAndConnect();
  78. }, error_callback);*/
  79. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement