pixel-react 1.15.29 → 1.15.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +75 -75
  2. package/lib/ThirdPartyPackages/JanusGateway.js +2 -5
  3. package/lib/ThirdPartyPackages/JanusGateway.js.map +1 -1
  4. package/lib/_virtual/index10.js +2 -2
  5. package/lib/_virtual/index11.js +2 -2
  6. package/lib/_virtual/index12.js +2 -2
  7. package/lib/_virtual/index9.js +2 -2
  8. package/lib/assets/icons/fail_result_icon.svg.js +6 -0
  9. package/lib/assets/icons/fail_result_icon.svg.js.map +1 -0
  10. package/lib/assets/icons/pass_result_icon.svg.js +6 -0
  11. package/lib/assets/icons/pass_result_icon.svg.js.map +1 -0
  12. package/lib/assets/icons/separator_icon.svg.js +6 -0
  13. package/lib/assets/icons/separator_icon.svg.js.map +1 -0
  14. package/lib/assets/icons/skipped_result_icon.svg.js +6 -0
  15. package/lib/assets/icons/skipped_result_icon.svg.js.map +1 -0
  16. package/lib/assets/icons/spinner.svg.js +1 -1
  17. package/lib/assets/icons/spinner.svg.js.map +1 -1
  18. package/lib/assets/icons/warning_result_icon.svg.js +6 -0
  19. package/lib/assets/icons/warning_result_icon.svg.js.map +1 -0
  20. package/lib/components/CreateVariable/CreateVariableSlider.js +1 -1
  21. package/lib/components/CreateVariable/CreateVariableSlider.js.map +1 -1
  22. package/lib/components/Icon/iconList.js +10 -0
  23. package/lib/components/Icon/iconList.js.map +1 -1
  24. package/lib/components/NLPInput/NlpInput.d.ts +1 -1
  25. package/lib/components/NLPInput/NlpInput.js +4 -2
  26. package/lib/components/NLPInput/NlpInput.js.map +1 -1
  27. package/lib/components/NLPInput/components/NlpDropDown/NlpDropDownType.d.ts +1 -0
  28. package/lib/components/NLPInput/components/NlpDropDown/NlpDropDownType.js.map +1 -1
  29. package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.d.ts +1 -1
  30. package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.js +3 -2
  31. package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.js.map +1 -1
  32. package/lib/components/NLPInput/types.d.ts +1 -0
  33. package/lib/index.cjs +32 -3221
  34. package/lib/index.cjs.map +1 -1
  35. package/lib/index.d.ts +2 -1
  36. package/lib/index.js +1 -1
  37. package/lib/node_modules/js-beautify/js/src/css/index.js +1 -1
  38. package/lib/node_modules/js-beautify/js/src/html/beautifier.js +1 -1
  39. package/lib/node_modules/js-beautify/js/src/html/index.js +1 -1
  40. package/lib/node_modules/js-beautify/js/src/html/options.js +1 -1
  41. package/lib/node_modules/js-beautify/js/src/html/tokenizer.js +1 -1
  42. package/lib/node_modules/js-beautify/js/src/javascript/beautifier.js +1 -1
  43. package/lib/node_modules/js-beautify/js/src/javascript/index.js +1 -1
  44. package/lib/node_modules/js-beautify/js/src/javascript/options.js +1 -1
  45. package/lib/node_modules/js-beautify/js/src/javascript/tokenizer.js +1 -1
  46. package/lib/node_modules/libphonenumber-js/metadata.min.json.js +4 -4
  47. package/lib/node_modules/libphonenumber-js/metadata.min.json.js.map +1 -1
  48. package/lib/node_modules/prop-types/index.js +1 -1
  49. package/lib/styles.css +1 -1
  50. package/lib/styles.css.map +1 -1
  51. package/package.json +109 -109
  52. package/lib/node_modules/janus-gateway/npm/dist/janus.es.js +0 -3210
  53. package/lib/node_modules/janus-gateway/npm/dist/janus.es.js.map +0 -1
package/lib/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
5
  var ReactDOM = require('react-dom');
6
+ var Janus = require('janus-gateway');
6
7
 
7
8
  function _interopNamespaceDefault(e) {
8
9
  var n = Object.create(null);
@@ -347,6 +348,8 @@ const SvgHideIcon = (props) => /* @__PURE__ */ React__namespace.createElement("s
347
348
 
348
349
  const SvgVerticalSeparator = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 2 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("rect", { x: 0.5, width: 1, height: 16, rx: 0.5, fill: "currentColor" }));
349
350
 
351
+ const SvgSeparatorIcon = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 1 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("line", { x1: 0.5, y1: 0.5, x2: 0.5, y2: 15.5, stroke: "#71347b", strokeLinecap: "round" }));
352
+
350
353
  const SvgCollapseIcon$1 = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.4095 5.32067C8.41256 5.33569 8.41816 5.34969 8.42248 5.3642C8.42758 5.38151 8.43165 5.39882 8.43852 5.41562C8.44565 5.43267 8.45532 5.4482 8.46423 5.46449C8.47136 5.47722 8.47696 5.49071 8.48536 5.50318C8.52252 5.55893 8.57037 5.60703 8.62637 5.6442C8.6391 5.65285 8.6531 5.65871 8.66634 5.66609C8.68212 5.67474 8.69714 5.68416 8.71394 5.69103C8.73099 5.69816 8.74856 5.70223 8.76612 5.70733C8.78037 5.7114 8.79412 5.717 8.80888 5.72005C8.84172 5.72642 8.87532 5.72998 8.90867 5.72998L11.9632 5.72998C12.2442 5.72998 12.4723 5.50191 12.4723 5.22089C12.4723 4.93987 12.2442 4.7118 11.9632 4.7118L10.1376 4.7118L13.8504 0.998999C14.0492 0.800199 14.0492 0.477945 13.8504 0.279145C13.7511 0.179618 13.6208 0.129981 13.4905 0.129981C13.3602 0.129981 13.2298 0.179618 13.1306 0.279145L9.41776 3.99194L9.41776 2.16634C9.41776 1.88533 9.18968 1.65725 8.90867 1.65725C8.62739 1.65725 8.39958 1.88533 8.39958 2.16634L8.39957 5.22089C8.39957 5.25423 8.40314 5.28758 8.4095 5.32067Z", fill: "currentColor" }), /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.869116 13.9808L4.58192 10.268L4.58192 12.0936C4.58192 12.3746 4.80973 12.6027 5.09101 12.6027C5.37228 12.6027 5.6001 12.3746 5.6001 12.0936L5.6001 9.03904C5.6001 9.00569 5.59653 8.97235 5.58992 8.93925C5.58712 8.92424 5.58152 8.91024 5.57719 8.89573C5.5721 8.87842 5.56803 8.86111 5.56115 8.84431C5.55403 8.82725 5.54435 8.81173 5.53544 8.79569C5.52832 8.78271 5.52272 8.76922 5.51432 8.75674C5.47715 8.701 5.4293 8.65289 5.3733 8.61573C5.36083 8.60733 5.34708 8.60147 5.33384 8.59434C5.31806 8.58569 5.30253 8.57602 5.28573 8.56889C5.26893 8.56202 5.25137 8.55794 5.23406 8.55285C5.21955 8.54853 5.20581 8.54293 5.19079 8.54013C5.1577 8.53351 5.12435 8.52994 5.09101 8.52994L2.03646 8.52994C1.75544 8.52994 1.52737 8.75802 1.52737 9.03904C1.52737 9.32005 1.75544 9.54813 2.03646 9.54813L3.86206 9.54813L0.149262 13.2609C-0.0495386 13.4597 -0.0495386 13.782 0.149261 13.9808C0.347807 14.1796 0.67057 14.1796 0.869116 13.9808Z", fill: "currentColor" }), /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.09052 1.65676C4.80925 1.65676 4.58143 1.88484 4.58143 2.16586L4.58143 3.99146L0.868883 0.27891C0.76961 0.179637 0.639283 0.130001 0.508955 0.130001C0.378882 0.130001 0.248555 0.179637 0.149028 0.27891C-0.0497718 0.47771 -0.0497718 0.800219 0.149028 0.999019L3.86157 4.71131L2.03597 4.71131C1.75495 4.71131 1.52688 4.93938 1.52688 5.2204C1.52688 5.50142 1.75495 5.72949 2.03597 5.72949L5.09052 5.72949C5.12386 5.72949 5.15721 5.72593 5.1903 5.71956C5.20506 5.71651 5.21881 5.71091 5.23306 5.70684C5.25063 5.70175 5.26819 5.69767 5.28525 5.69055C5.30205 5.68367 5.31706 5.674 5.33285 5.6656C5.34634 5.65822 5.36008 5.65236 5.37281 5.64371C5.42881 5.60655 5.47666 5.55844 5.51383 5.50269C5.52223 5.49022 5.52783 5.47673 5.53495 5.464C5.54386 5.44771 5.55354 5.43218 5.56066 5.41513C5.56754 5.39833 5.57161 5.38102 5.5767 5.36371C5.58103 5.3492 5.58663 5.3352 5.58943 5.32018C5.59605 5.28709 5.59961 5.25375 5.59961 5.2204L5.59961 2.16586C5.59961 1.88484 5.37179 1.65676 5.09052 1.65676Z", fill: "currentColor" }), /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.9089 12.6024C9.18992 12.6024 9.41799 12.3743 9.41799 12.0933L9.41799 10.2677L13.1308 13.9808C13.3296 14.1796 13.6521 14.1796 13.8509 13.9808C14.0497 13.782 14.0497 13.4595 13.8509 13.2607L10.1378 9.54787L11.9634 9.54787C12.2445 9.54787 12.4725 9.3198 12.4725 9.03878C12.4725 8.75776 12.2445 8.52969 11.9634 8.52969L8.9089 8.52969C8.87555 8.52969 8.84221 8.53325 8.80912 8.53987C8.7941 8.54267 8.78035 8.54827 8.76585 8.5526C8.74854 8.55769 8.73097 8.56176 8.71417 8.56864C8.69737 8.57576 8.68185 8.58544 8.66606 8.59409C8.65283 8.60122 8.63908 8.60707 8.62661 8.61547C8.57061 8.65264 8.52276 8.70074 8.48559 8.75649C8.47719 8.76896 8.47159 8.78245 8.46446 8.79544C8.45555 8.81147 8.44588 8.827 8.43875 8.84405C8.43188 8.86085 8.42781 8.87816 8.42272 8.89547C8.41839 8.90998 8.41279 8.92398 8.40974 8.939C8.40337 8.97209 8.39981 9.00544 8.39981 9.03878L8.39981 12.0933C8.39981 12.3743 8.62763 12.6024 8.9089 12.6024Z", fill: "currentColor" }));
351
354
 
352
355
  const SvgExpandIcon$1 = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M13.9894 0.409309C13.9864 0.394291 13.9808 0.380291 13.9764 0.365782C13.9714 0.348473 13.9673 0.331164 13.9604 0.314364C13.9533 0.297309 13.9436 0.281782 13.9347 0.265491C13.9276 0.252764 13.922 0.239273 13.9136 0.2268C13.8764 0.171055 13.8286 0.122945 13.7726 0.0857818C13.7598 0.0771273 13.7458 0.0712727 13.7326 0.0638909C13.7168 0.0552364 13.7018 0.0458182 13.685 0.0389454C13.6679 0.0318182 13.6504 0.0277455 13.6328 0.0226545C13.6186 0.0185818 13.6048 0.0129818 13.59 0.00992727C13.5572 0.00356364 13.5236 0 13.4903 0H10.4357C10.1547 0 9.92662 0.228073 9.92662 0.509091C9.92662 0.790109 10.1547 1.01818 10.4357 1.01818H12.2613L8.54851 4.73098C8.34971 4.92978 8.34971 5.25204 8.54851 5.45084C8.64779 5.55036 8.77811 5.6 8.90844 5.6C9.03877 5.6 9.1691 5.55036 9.26837 5.45084L12.9812 1.73804V3.56364C12.9812 3.84465 13.2092 4.07273 13.4903 4.07273C13.7715 4.07273 13.9994 3.84465 13.9994 3.56364V0.509091C13.9994 0.475745 13.9958 0.4424 13.9894 0.409309Z", fill: "currentColor" }), /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.73098 8.549L1.01818 12.2618V10.4362C1.01818 10.1552 0.790364 9.92711 0.509091 9.92711C0.227818 9.92711 0 10.1552 0 10.4362V13.4907C0 13.5241 0.00356364 13.5574 0.0101818 13.5905C0.0129818 13.6055 0.0185818 13.6195 0.0229091 13.6341C0.028 13.6514 0.0320727 13.6687 0.0389455 13.6855C0.0460727 13.7025 0.0557455 13.7181 0.0646545 13.7341C0.0717818 13.7471 0.0773818 13.7606 0.0857818 13.773C0.122945 13.8288 0.1708 13.8769 0.2268 13.9141C0.239273 13.9225 0.253018 13.9283 0.266255 13.9354C0.282036 13.9441 0.297564 13.9538 0.314364 13.9609C0.331164 13.9678 0.348727 13.9718 0.366036 13.9769C0.380545 13.9813 0.394291 13.9869 0.409309 13.9897C0.4424 13.9963 0.475745 13.9998 0.509091 13.9998H3.56364C3.84465 13.9998 4.07273 13.7718 4.07273 13.4907C4.07273 13.2097 3.84465 12.9817 3.56364 12.9817H1.73804L5.45084 9.26886C5.64964 9.07006 5.64964 8.7478 5.45084 8.549C5.25229 8.3502 4.92953 8.3502 4.73098 8.549Z", fill: "currentColor" }), /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.509091 4.07273C0.790364 4.07273 1.01818 3.84465 1.01818 3.56364V1.73804L4.73073 5.45058C4.83 5.54985 4.96033 5.59949 5.09065 5.59949C5.22073 5.59949 5.35105 5.54985 5.45058 5.45058C5.64938 5.25178 5.64938 4.92927 5.45058 4.73047L1.73804 1.01818H3.56364C3.84465 1.01818 4.07273 0.790109 4.07273 0.509091C4.07273 0.228073 3.84465 0 3.56364 0H0.509091C0.475745 0 0.4424 0.00356364 0.409309 0.00992727C0.394545 0.0129818 0.3808 0.0185818 0.366545 0.0226545C0.348982 0.0277455 0.331418 0.0318182 0.314364 0.0389455C0.297564 0.0458182 0.282545 0.0554909 0.266764 0.0638909C0.253273 0.0712727 0.239527 0.0771273 0.2268 0.0857818C0.1708 0.122945 0.122945 0.171055 0.0857818 0.2268C0.0773818 0.239273 0.0717818 0.252764 0.0646545 0.265491C0.0557455 0.281782 0.0460727 0.297309 0.0389455 0.314364C0.0320727 0.331164 0.028 0.348473 0.0229091 0.365782C0.0185818 0.380291 0.0129818 0.394291 0.0101818 0.409309C0.00356364 0.4424 0 0.475745 0 0.509091V3.56364C0 3.84465 0.227818 4.07273 0.509091 4.07273Z", fill: "currentColor" }), /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M13.4905 9.92737C13.2095 9.92737 12.9814 10.1554 12.9814 10.4365V12.2621L9.26862 8.549C9.06982 8.3502 8.74731 8.3502 8.54851 8.549C8.34971 8.7478 8.34971 9.07031 8.54851 9.26911L12.2616 12.9819H10.436C10.155 12.9819 9.92688 13.21 9.92688 13.491C9.92688 13.772 10.155 14.0001 10.436 14.0001H13.4905C13.5239 14.0001 13.5572 13.9965 13.5903 13.9899C13.6053 13.9871 13.6191 13.9815 13.6336 13.9772C13.6509 13.9721 13.6684 13.968 13.6852 13.9611C13.702 13.954 13.7176 13.9443 13.7334 13.9357C13.7466 13.9286 13.7603 13.9227 13.7728 13.9143C13.8288 13.8771 13.8767 13.829 13.9138 13.7733C13.9222 13.7608 13.9278 13.7473 13.935 13.7343C13.9439 13.7183 13.9535 13.7028 13.9607 13.6857C13.9675 13.6689 13.9716 13.6516 13.9767 13.6343C13.981 13.6198 13.9866 13.6058 13.9897 13.5908C13.996 13.5577 13.9996 13.5243 13.9996 13.491V10.4365C13.9996 10.1554 13.7718 9.92737 13.4905 9.92737Z", fill: "currentColor" }));
@@ -2041,6 +2044,14 @@ const SvgTestifyLogoName = (props) => /* @__PURE__ */ React__namespace.createEle
2041
2044
 
2042
2045
  const SvgFireflinkDeviceFarm = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 109 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "M8.30815 2.44586C8.00129 2.63411 7.75562 2.75272 7.509 2.87602C6.58748 3.36737 5.7272 3.79754 4.80568 4.28795C4.74167 4.32431 4.68966 4.37863 4.6562 4.44421C4.62274 4.5098 4.60923 4.58376 4.61736 4.65693V23.2755C4.61736 23.5212 4.55624 23.7057 4.31057 23.7669C3.85464 23.9552 3.36009 24.0312 2.86866 23.9884C2.37722 23.9457 1.90328 23.7854 1.48672 23.5212C1.18046 23.3059 0.919692 23.0323 0.7194 22.716C0.519108 22.3997 0.383245 22.047 0.319539 21.6782C0.16509 20.682 0.102006 19.6737 0.131213 18.666C0.0700298 13.7497 0.00884184 8.77315 0.00884184 3.85683C-0.0391441 3.07511 0.108741 2.29379 0.439038 1.58366C0.717224 0.990161 1.19816 0.515478 1.79523 0.245067C2.39231 -0.0253429 3.06627 -0.0737303 3.69584 0.108649C4.56928 0.371444 5.39798 0.764987 6.15361 1.27586C6.82945 1.64484 7.50528 2.01287 8.11994 2.38186C8.18583 2.32255 8.24697 2.38373 8.30815 2.44586Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M8.42587 21.3723V16.0258C8.42442 15.9536 8.44083 15.8821 8.47367 15.8177C8.50651 15.7533 8.55473 15.6981 8.61408 15.6569C10.7037 14.4887 12.7934 13.3215 14.8209 12.1543C15.3734 11.8465 15.9269 11.5397 16.5406 11.1707C16.1854 10.9425 15.8159 10.7372 15.4346 10.556C14.5131 10.0026 13.5917 9.51123 12.6701 8.95587C12.6247 8.92503 12.5711 8.90853 12.5162 8.90853C12.4613 8.90853 12.4077 8.92503 12.3623 8.95587C11.1951 9.6929 10.0891 10.3678 8.92098 11.1067C8.8598 11.1067 8.85982 11.1679 8.79769 11.1679V7.2352C8.79594 7.15413 8.81183 7.07365 8.84434 6.99937C8.87686 6.92508 8.92516 6.85876 8.9859 6.80504C10.0307 6.06801 11.0746 5.39311 12.0583 4.6542C12.1149 4.62396 12.1781 4.60815 12.2422 4.60815C12.3064 4.60815 12.3697 4.62396 12.4263 4.6542C13.8382 5.45335 15.3141 6.31368 16.7279 7.11188C17.7106 7.66442 18.6943 8.21788 19.7401 8.77042C20.488 9.15981 21.1072 9.75743 21.5228 10.4911C21.7846 10.9685 21.8898 11.5161 21.8236 12.0566C21.7574 12.5971 21.5232 13.1031 21.1539 13.5032C20.6682 14.0556 20.0849 14.5138 19.4332 14.8549C18.0213 15.654 16.6677 16.5144 15.2549 17.3126C13.473 18.3574 11.7524 19.3401 9.97051 20.3849C9.4095 20.7577 8.91722 21.0607 8.42587 21.3723Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M27.8853 2.53444V4.07054H31.0473V5.60498H27.8853V8H25.8428V1H31.4695V2.53444H27.8853Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M32.3828 1.02002H34.4253V7.98019H32.3828V1.02002Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M38.5014 6.1465H37.3819V7.98053H35.3394V1.01953H38.6151C40.5807 1.01953 41.8139 1.99215 41.8139 3.60127C41.8341 4.0614 41.713 4.51698 41.466 4.91016C41.2191 5.30334 40.8574 5.6164 40.4268 5.80957L41.9651 7.9797H39.8098L38.5014 6.1465ZM38.5399 2.55397H37.4203V4.57472H38.5382C39.3859 4.57472 39.8098 4.20044 39.8098 3.56393C39.7714 2.96559 39.3859 2.55397 38.5382 2.55397H38.5399Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M48.6205 6.44609V7.98053H42.8784V1.01953H48.5052V2.55397H44.8825V3.7158H48.0813V5.17555H44.8825V6.44775L48.6205 6.44609Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M51.5767 2.53444V4.07054H54.7387V5.60498H51.5767V8H49.5342V1H55.1609V2.53444H51.5767Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M56.0742 1.01953H58.1167V6.40874H61.5437V7.98053H56.1101V1.01953H56.0742Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M62.4575 1.02002H64.5V7.98019H62.4575V1.02002Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M72.235 1.02002V7.98019H70.578L67.4159 4.27562V7.98019H65.4136V1.02002H67.0707L70.2327 4.72458V1.02002H72.235Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M75.9234 5.45458L75.1542 6.24047V7.99898H73.1484V1.00146H75.1525V3.88279L77.9274 1.00146H80.1622L77.2335 4.072L80.3169 7.96412H77.9659L75.9234 5.45458Z", fill: "white" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M29.1533 14.1007C30.0847 14.1007 30.8987 14.2853 31.5952 14.6545C32.2917 15.0238 32.8288 15.5441 33.2064 16.2154C33.5924 16.8783 33.7854 17.6462 33.7854 18.5189C33.7854 19.3832 33.5924 20.151 33.2064 20.8224C32.8288 21.4937 32.2875 22.014 31.5826 22.3832C30.8861 22.7524 30.0763 22.9371 29.1533 22.9371H25.8428V14.1007H29.1533ZM29.0148 21.0741C29.8288 21.0741 30.4624 20.8517 30.9155 20.407C31.3686 19.9622 31.5952 19.3329 31.5952 18.5189C31.5952 17.7049 31.3686 17.0713 30.9155 16.6182C30.4624 16.165 29.8288 15.9385 29.0148 15.9385H27.9952V21.0741H29.0148Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M37.1408 15.8252V17.6126H40.0233V19.2741H37.1408V21.2126H40.4009V22.9371H34.9883V14.1007H40.4009V15.8252H37.1408Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M50.0934 14.1007L46.9591 22.9371H44.2654L41.1312 14.1007H43.4221L45.6123 20.772L47.8151 14.1007H50.0934Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M53.1455 14.1007V22.9371H50.993V14.1007H53.1455Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M54.3403 18.5063C54.3403 17.6336 54.5291 16.8573 54.9067 16.1776C55.2843 15.4895 55.8088 14.9566 56.4801 14.579C57.1599 14.193 57.9277 14 58.7836 14C59.8326 14 60.7305 14.2769 61.4773 14.8308C62.2242 15.3846 62.7235 16.1399 62.9752 17.0965H60.6088C60.4326 16.7273 60.1808 16.4462 59.8536 16.2531C59.5347 16.0601 59.1696 15.9636 58.7585 15.9636C58.0955 15.9636 57.5585 16.1944 57.1473 16.6559C56.7361 17.1175 56.5305 17.7343 56.5305 18.5063C56.5305 19.2783 56.7361 19.8951 57.1473 20.3566C57.5585 20.8182 58.0955 21.049 58.7585 21.049C59.1696 21.049 59.5347 20.9524 59.8536 20.7594C60.1808 20.5664 60.4326 20.2853 60.6088 19.9161H62.9752C62.7235 20.8727 62.2242 21.628 61.4773 22.1818C60.7305 22.7273 59.8326 23 58.7836 23C57.9277 23 57.1599 22.8112 56.4801 22.4336C55.8088 22.0476 55.2843 21.5147 54.9067 20.835C54.5291 20.1552 54.3403 19.379 54.3403 18.5063Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M66.4458 15.8252V17.6126H69.3283V19.2741H66.4458V21.2126H69.706V22.9371H64.2934V14.1007H69.706V15.8252H66.4458Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M79.5233 14.1007V15.8252H75.9233V17.6881H78.617V19.3622H75.9233V22.9371H73.7708V14.1007H79.5233Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M86.1553 21.3762H82.8574L82.3287 22.9371H80.0755L83.2727 14.1007H85.765L88.9622 22.9371H86.6839L86.1553 21.3762ZM85.6014 19.7147L84.5063 16.4797L83.4238 19.7147H85.6014Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M94.4416 22.9371L92.6038 19.6014H92.0878V22.9371H89.9353V14.1007H93.5479C94.2444 14.1007 94.836 14.2224 95.3227 14.4657C95.8178 14.7091 96.1871 15.0448 96.4304 15.4727C96.6738 15.8923 96.7955 16.3622 96.7955 16.8825C96.7955 17.4699 96.6276 17.9944 96.292 18.4559C95.9647 18.9175 95.478 19.2448 94.8318 19.4378L96.871 22.9371H94.4416ZM92.0878 18.0783H93.422C93.8164 18.0783 94.1101 17.9818 94.3031 17.7888C94.5045 17.5958 94.6052 17.3231 94.6052 16.9706C94.6052 16.635 94.5045 16.3706 94.3031 16.1776C94.1101 15.9846 93.8164 15.8881 93.422 15.8881H92.0878V18.0783Z", fill: "#DB7221" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M108.154 14.1007V22.9371H106.001V17.6378L104.025 22.9371H102.288L100.299 17.6252V22.9371H98.1466V14.1007H100.689L103.169 20.2182L105.624 14.1007H108.154Z", fill: "#DB7221" }));
2043
2046
 
2047
+ const SvgPassResultIcon = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { filter: "url(#filter0_ii_18056_5585)" }, /* @__PURE__ */ React__namespace.createElement("circle", { cx: 8, cy: 8, r: 8, fill: "#0AB828" })), /* @__PURE__ */ React__namespace.createElement("defs", null, /* @__PURE__ */ React__namespace.createElement("filter", { id: "filter0_ii_18056_5585", x: -4, y: 0, width: 24, height: 20, filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB" }, /* @__PURE__ */ React__namespace.createElement("feFlood", { floodOpacity: 0, result: "BackgroundImageFix" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), /* @__PURE__ */ React__namespace.createElement("feOffset", { dx: 4, dy: 4 }), /* @__PURE__ */ React__namespace.createElement("feGaussianBlur", { stdDeviation: 2 }), /* @__PURE__ */ React__namespace.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: -1, k3: 1 }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.46 0" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in2: "shape", result: "effect1_innerShadow_18056_5585" }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), /* @__PURE__ */ React__namespace.createElement("feOffset", { dx: -4 }), /* @__PURE__ */ React__namespace.createElement("feGaussianBlur", { stdDeviation: 2 }), /* @__PURE__ */ React__namespace.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: -1, k3: 1 }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.21 0" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in2: "effect1_innerShadow_18056_5585", result: "effect2_innerShadow_18056_5585" }))));
2048
+
2049
+ const SvgFailResultIcon = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { filter: "url(#filter0_ii_18056_5588)" }, /* @__PURE__ */ React__namespace.createElement("circle", { cx: 8, cy: 8, r: 8, fill: "#F00000" })), /* @__PURE__ */ React__namespace.createElement("defs", null, /* @__PURE__ */ React__namespace.createElement("filter", { id: "filter0_ii_18056_5588", x: -4, y: 0, width: 24, height: 20, filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB" }, /* @__PURE__ */ React__namespace.createElement("feFlood", { floodOpacity: 0, result: "BackgroundImageFix" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), /* @__PURE__ */ React__namespace.createElement("feOffset", { dx: 4, dy: 4 }), /* @__PURE__ */ React__namespace.createElement("feGaussianBlur", { stdDeviation: 2 }), /* @__PURE__ */ React__namespace.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: -1, k3: 1 }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { type: "matrix", values: "0 0 0 0 0.0680965 0 0 0 0 0.0629938 0 0 0 0 0.0629938 0 0 0 0.46 0" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in2: "shape", result: "effect1_innerShadow_18056_5588" }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), /* @__PURE__ */ React__namespace.createElement("feOffset", { dx: -4 }), /* @__PURE__ */ React__namespace.createElement("feGaussianBlur", { stdDeviation: 2 }), /* @__PURE__ */ React__namespace.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: -1, k3: 1 }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { type: "matrix", values: "0 0 0 0 0.561295 0 0 0 0 0.111782 0 0 0 0 0.111782 0 0 0 1 0" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in2: "effect1_innerShadow_18056_5588", result: "effect2_innerShadow_18056_5588" }))));
2050
+
2051
+ const SvgWarningResultIcon = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { filter: "url(#filter0_ii_18056_5591)" }, /* @__PURE__ */ React__namespace.createElement("circle", { cx: 8, cy: 8, r: 8, fill: "#FF8B00" })), /* @__PURE__ */ React__namespace.createElement("defs", null, /* @__PURE__ */ React__namespace.createElement("filter", { id: "filter0_ii_18056_5591", x: -4, y: 0, width: 24, height: 20, filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB" }, /* @__PURE__ */ React__namespace.createElement("feFlood", { floodOpacity: 0, result: "BackgroundImageFix" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), /* @__PURE__ */ React__namespace.createElement("feOffset", { dx: 4, dy: 4 }), /* @__PURE__ */ React__namespace.createElement("feGaussianBlur", { stdDeviation: 2 }), /* @__PURE__ */ React__namespace.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: -1, k3: 1 }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { type: "matrix", values: "0 0 0 0 0.122494 0 0 0 0 0.0803438 0 0 0 0 0.017119 0 0 0 0.46 0" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in2: "shape", result: "effect1_innerShadow_18056_5591" }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), /* @__PURE__ */ React__namespace.createElement("feOffset", { dx: -4 }), /* @__PURE__ */ React__namespace.createElement("feGaussianBlur", { stdDeviation: 2 }), /* @__PURE__ */ React__namespace.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: -1, k3: 1 }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { type: "matrix", values: "0 0 0 0 0.465004 0 0 0 0 0.246268 0 0 0 0 0.0124466 0 0 0 0.25 0" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in2: "effect1_innerShadow_18056_5591", result: "effect2_innerShadow_18056_5591" }))));
2052
+
2053
+ const SvgSkippedResultIcon = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { filter: "url(#filter0_ii_18056_5594)" }, /* @__PURE__ */ React__namespace.createElement("circle", { cx: 8, cy: 8, r: 8, fill: "#808080" })), /* @__PURE__ */ React__namespace.createElement("defs", null, /* @__PURE__ */ React__namespace.createElement("filter", { id: "filter0_ii_18056_5594", x: -4, y: 0, width: 24, height: 20, filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB" }, /* @__PURE__ */ React__namespace.createElement("feFlood", { floodOpacity: 0, result: "BackgroundImageFix" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), /* @__PURE__ */ React__namespace.createElement("feOffset", { dx: 4, dy: 4 }), /* @__PURE__ */ React__namespace.createElement("feGaussianBlur", { stdDeviation: 2 }), /* @__PURE__ */ React__namespace.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: -1, k3: 1 }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.46 0" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in2: "shape", result: "effect1_innerShadow_18056_5594" }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), /* @__PURE__ */ React__namespace.createElement("feOffset", { dx: -4 }), /* @__PURE__ */ React__namespace.createElement("feGaussianBlur", { stdDeviation: 2 }), /* @__PURE__ */ React__namespace.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: -1, k3: 1 }), /* @__PURE__ */ React__namespace.createElement("feColorMatrix", { type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.47 0" }), /* @__PURE__ */ React__namespace.createElement("feBlend", { mode: "normal", in2: "effect1_innerShadow_18056_5594", result: "effect2_innerShadow_18056_5594" }))));
2054
+
2044
2055
  let Components = {};
2045
2056
  Components['success'] = SvgSuccess;
2046
2057
  Components['setting_icon'] = SvgSettingIcon;
@@ -2153,11 +2164,16 @@ Components['zip_file_type'] = SvgZipFileType;
2153
2164
  Components['yaml_file_type'] = SvgYamlFileType;
2154
2165
  Components['tar_file_type'] = SvgTarFileType;
2155
2166
  Components['crx_file_type'] = SvgCrxFileType;
2167
+ Components['pass_result_icon'] = SvgPassResultIcon;
2168
+ Components['fail_result_icon'] = SvgFailResultIcon;
2169
+ Components['warning_result_icon'] = SvgWarningResultIcon;
2170
+ Components['skipped_result_icon'] = SvgSkippedResultIcon;
2156
2171
  Components['import'] = SvgImport;
2157
2172
  Components['info'] = SvgInfoIcon;
2158
2173
  Components['calendar_icon'] = SvgCalendarIcon;
2159
2174
  Components['hide_icon'] = SvgHideIcon;
2160
2175
  Components['vertical_separator'] = SvgVerticalSeparator;
2176
+ Components['separator_icon'] = SvgSeparatorIcon;
2161
2177
  Components['collapse_icon'] = SvgCollapseIcon$1;
2162
2178
  Components['refresh_icon'] = SvgRefreshIcon$1;
2163
2179
  Components['download_file'] = SvgDownloadIcon$1;
@@ -18686,7 +18702,7 @@ const EditLabel = ({
18686
18702
  });
18687
18703
  };
18688
18704
 
18689
- const SvgSpinner = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("style", null, "\n .spinner_DupU {\n animation: spinner_sM3D 1.2s infinite;\n fill: #71347b;\n }\n .spinner_GWtZ { animation-delay: .1s; }\n .spinner_dwN6 { animation-delay: .2s; }\n .spinner_46QP { animation-delay: .3s; }\n .spinner_PD82 { animation-delay: .4s; }\n .spinner_eUgh { animation-delay: .5s; }\n .spinner_eUaP { animation-delay: .6s; }\n .spinner_j38H { animation-delay: .7s; }\n .spinner_tVmX { animation-delay: .8s; }\n .spinner_DQhX { animation-delay: .9s; }\n .spinner_GIL4 { animation-delay: 1s; }\n .spinner_n0Yb { animation-delay: 1.1s; }\n\n @keyframes spinner_sM3D {\n 0%, 50% {\n animation-timing-function: cubic-bezier(0, 1, 0, 1);\n r: 0;\n }\n 10% {\n animation-timing-function: cubic-bezier(.53, 0, .61, .73);\n r: 2px;\n }\n }\n "), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU", cx: 12, cy: 3, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_GWtZ", cx: 16.5, cy: 4.21, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_n0Yb", cx: 7.5, cy: 4.21, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_dwN6", cx: 19.79, cy: 7.5, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_GIL4", cx: 4.21, cy: 7.5, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_46QP", cx: 21, cy: 12, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_DQhX", cx: 3, cy: 12, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_PD82", cx: 19.79, cy: 16.5, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_tVmX", cx: 4.21, cy: 16.5, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_eUgh", cx: 16.5, cy: 19.79, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_j38H", cx: 7.5, cy: 19.79, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_eUaP", cx: 12, cy: 21, r: 0 }));
18705
+ const SvgSpinner = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("style", null, "\r\n .spinner_DupU {\r\n animation: spinner_sM3D 1.2s infinite;\r\n fill: #71347b;\r\n }\r\n .spinner_GWtZ { animation-delay: .1s; }\r\n .spinner_dwN6 { animation-delay: .2s; }\r\n .spinner_46QP { animation-delay: .3s; }\r\n .spinner_PD82 { animation-delay: .4s; }\r\n .spinner_eUgh { animation-delay: .5s; }\r\n .spinner_eUaP { animation-delay: .6s; }\r\n .spinner_j38H { animation-delay: .7s; }\r\n .spinner_tVmX { animation-delay: .8s; }\r\n .spinner_DQhX { animation-delay: .9s; }\r\n .spinner_GIL4 { animation-delay: 1s; }\r\n .spinner_n0Yb { animation-delay: 1.1s; }\r\n\r\n @keyframes spinner_sM3D {\r\n 0%, 50% {\r\n animation-timing-function: cubic-bezier(0, 1, 0, 1);\r\n r: 0;\r\n }\r\n 10% {\r\n animation-timing-function: cubic-bezier(.53, 0, .61, .73);\r\n r: 2px;\r\n }\r\n }\r\n "), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU", cx: 12, cy: 3, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_GWtZ", cx: 16.5, cy: 4.21, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_n0Yb", cx: 7.5, cy: 4.21, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_dwN6", cx: 19.79, cy: 7.5, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_GIL4", cx: 4.21, cy: 7.5, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_46QP", cx: 21, cy: 12, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_DQhX", cx: 3, cy: 12, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_PD82", cx: 19.79, cy: 16.5, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_tVmX", cx: 4.21, cy: 16.5, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_eUgh", cx: 16.5, cy: 19.79, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_j38H", cx: 7.5, cy: 19.79, r: 0 }), /* @__PURE__ */ React__namespace.createElement("circle", { className: "spinner_DupU spinner_eUaP", cx: 12, cy: 21, r: 0 }));
18690
18706
 
18691
18707
  const renderSpaces$1 = (level, parentSiblings = [], isLast, isContainer) => {
18692
18708
  let siblingsArray = parentSiblings;
@@ -36105,7 +36121,8 @@ const NlpDropdown = ({
36105
36121
  containerWidth,
36106
36122
  loadMoreOptions,
36107
36123
  chipRef,
36108
- isWebservice = true
36124
+ isWebservice = true,
36125
+ dropDownMessage = ''
36109
36126
  }) => {
36110
36127
  const [nlpData, setNlpData] = React.useState(null);
36111
36128
  const [showNlpDetails, setShowNlpDetails] = React.useState('');
@@ -36344,7 +36361,7 @@ const NlpDropdown = ({
36344
36361
  as: "p",
36345
36362
  color: "var(--ff-nlp-text-color)",
36346
36363
  className: "ff-nlp-no-option",
36347
- children: "No Results Found"
36364
+ children: checkEmpty(dropDownMessage) ? 'No Results Found' : dropDownMessage
36348
36365
  })
36349
36366
  }), isWebservice && jsxRuntime.jsx("div", {
36350
36367
  children: jsxRuntime.jsx("div", {
@@ -36684,7 +36701,8 @@ const NlpInput = ({
36684
36701
  isWebservice = true,
36685
36702
  closeInputOnOutsideClick = () => {},
36686
36703
  tooltipText = 'Help',
36687
- ChipsAccordionWidth = '27.8%'
36704
+ ChipsAccordionWidth = '27.8%',
36705
+ dropDownMessage = ''
36688
36706
  }) => {
36689
36707
  const initialState = {
36690
36708
  isInputFocused: false,
@@ -36953,7 +36971,8 @@ const NlpInput = ({
36953
36971
  containerWidth: containerWidth,
36954
36972
  loadMoreOptions: loadMoreOptions,
36955
36973
  chipRef: ChipRef,
36956
- isWebservice: isWebservice
36974
+ isWebservice: isWebservice,
36975
+ dropDownMessage: dropDownMessage
36957
36976
  }), document.body)
36958
36977
  })]
36959
36978
  }), jsxRuntime.jsx("div", {
@@ -50913,7 +50932,7 @@ const CreateVariableSlider = ({
50913
50932
  return () => {
50914
50933
  window.removeEventListener('keydown', handleKeyDown);
50915
50934
  };
50916
- }, [isEnterKeySubmit, variableName, variableValue, hideValue, isSubmitting, mode, hasChanges]);
50935
+ }, [isEnterKeySubmit, variableName, variableValue, hideValue, isSubmitting, mode, hasChanges, selectedVariableType]);
50917
50936
  const FooterContent = () => {
50918
50937
  return jsxRuntime.jsxs("div", {
50919
50938
  className: "ff-create-slider-footer",
@@ -66032,7 +66051,7 @@ var metadata$1 = {
66032
66051
  "AR": ["54", "00", "(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}", [10, 11], [["(\\d{4})(\\d{2})(\\d{4})", "$1 $2-$3", ["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])", "2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["1"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[68]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2-$3", ["[23]"], "0$1", 1], ["(\\d)(\\d{4})(\\d{2})(\\d{4})", "$2 15-$3-$4", ["9(?:2[2-469]|3[3-578])", "9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))", "9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d)(\\d{2})(\\d{4})(\\d{4})", "$2 15-$3-$4", ["91"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d{3})(\\d{3})(\\d{5})", "$1-$2-$3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{4})", "$2 15-$3-$4", ["9"], "0$1", 0, "$1 $2 $3-$4"]], "0", 0, "0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?", "9$1"],
66033
66052
  "AS": ["1", "011", "(?:[58]\\d\\d|684|900)\\d{7}", [10], 0, "1", 0, "([267]\\d{6})$|1", "684$1", 0, "684"],
66034
66053
  "AT": ["43", "00", "1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{3,12})", "$1 $2", ["1(?:11|[2-9])"], "0$1"], ["(\\d{3})(\\d{2})", "$1 $2", ["517"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["5[079]"], "0$1"], ["(\\d{3})(\\d{3,10})", "$1 $2", ["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]", "(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"], "0$1"], ["(\\d{4})(\\d{3,9})", "$1 $2", ["[2-467]|5[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,7})", "$1 $2 $3", ["5"], "0$1"]], "0"],
66035
- "AU": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}", [5, 6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{3,4})", "$1 $2", ["16"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["16"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["14|4"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[2378]"], "(0$1)"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:30|[89])"]]], "0", 0, "(183[12])|0", 0, 0, 0, [["(?:(?:2(?:(?:[0-26-9]\\d|3[0-8]|5[0135-9])\\d|4(?:[02-9]\\d|10))|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90))|7(?:[013-57-9]\\d|2[0-8])\\d)\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}", [9]], ["4(?:79[01]|83[0-36-9])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, ["163\\d{2,6}", [5, 6, 7, 8, 9]], ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"],
66054
+ "AU": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}", [5, 6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{3,4})", "$1 $2", ["16"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["16"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["14|4"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[2378]"], "(0$1)"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:30|[89])"]]], "0", 0, "(183[12])|0", 0, 0, 0, [["(?:(?:2(?:(?:[0-26-9]\\d|3[0-8]|5[0135-9])\\d|4(?:[02-9]\\d|10))|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90))|7(?:[013-57-9]\\d|2[0-8])\\d)\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|94[0-478])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-37-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, ["163\\d{2,6}", [5, 6, 7, 8, 9]], ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"],
66036
66055
  "AW": ["297", "00", "(?:[25-79]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[25-9]"]]]],
66037
66056
  "AX": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}", [5, 6, 7, 8, 9, 10, 11, 12], 0, "0", 0, 0, 0, 0, "18", 0, "00"],
66038
66057
  "AZ": ["994", "00", "365\\d{6}|(?:[124579]\\d|60|88)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[28]|2|365|46", "1[28]|2|365[45]|46", "1[28]|2|365(?:4|5[02])|46"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[13-9]"], "0$1"]], "0"],
@@ -66057,7 +66076,7 @@ var metadata$1 = {
66057
66076
  "BY": ["375", "810", "(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3})", "$1 $2", ["800"], "8 $1"], ["(\\d{3})(\\d{2})(\\d{2,4})", "$1 $2 $3", ["800"], "8 $1"], ["(\\d{4})(\\d{2})(\\d{3})", "$1 $2-$3", ["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])", "1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"], "8 0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["1(?:[56]|7[467])|2[1-3]"], "8 0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-4]"], "8 0$1"], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[89]"], "8 $1"]], "8", 0, "0|80?", 0, 0, 0, 0, "8~10"],
66058
66077
  "BZ": ["501", "00", "(?:0800\\d|[2-8])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-8]"]], ["(\\d)(\\d{3})(\\d{4})(\\d{3})", "$1-$2-$3-$4", ["0"]]]],
66059
66078
  "CA": ["1", "011", "[2-9]\\d{9}|3\\d{6}", [7, 10], 0, "1", 0, 0, 0, 0, 0, [["(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}", [10]], ["", [10]], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}", [10]], ["900[2-9]\\d{6}", [10]], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[2-9]\\d{6}", [10]], 0, ["310\\d{4}", [7]], 0, ["600[2-9]\\d{6}", [10]]]],
66060
- "CC": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}", [9]], ["4(?:79[01]|83[0-36-9])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"],
66079
+ "CC": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|94[0-478])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-37-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"],
66061
66080
  "CD": ["243", "00", "(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}", [7, 8, 9, 10], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[1-6]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["5"], "0$1"]], "0"],
66062
66081
  "CF": ["236", "00", "(?:[27]\\d{3}|8776)\\d{4}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[278]"]]]],
66063
66082
  "CG": ["242", "00", "222\\d{6}|(?:0\\d|80)\\d{7}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[02]"]]]],
@@ -66072,7 +66091,7 @@ var metadata$1 = {
66072
66091
  "CU": ["53", "119", "(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}", [6, 7, 8, 10], [["(\\d{2})(\\d{4,6})", "$1 $2", ["2[1-4]|[34]"], "(0$1)"], ["(\\d)(\\d{6,7})", "$1 $2", ["7"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["[56]"], "0$1"], ["(\\d{3})(\\d{7})", "$1 $2", ["8"], "0$1"]], "0"],
66073
66092
  "CV": ["238", "0", "(?:[2-59]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-589]"]]]],
66074
66093
  "CW": ["599", "00", "(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[3467]"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["9[4-8]"]]], 0, 0, 0, 0, 0, "[69]"],
66075
- "CX": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}", [9]], ["4(?:79[01]|83[0-36-9])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"],
66094
+ "CX": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|94[0-478])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-37-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"],
66076
66095
  "CY": ["357", "00", "(?:[279]\\d|[58]0)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[257-9]"]]]],
66077
66096
  "CZ": ["420", "00", "(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}", [9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]]],
66078
66097
  "DE": ["49", "00", "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [["(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"], ["(\\d{3})(\\d{3,12})", "$1 $2", ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"], "0$1"], ["(\\d{4})(\\d{2,11})", "$1 $2", ["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]", "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"], ["(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"], ["(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"], ["(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"], ["(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"], ["(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["15[03568]", "15(?:[0568]|3[13])"], "0$1"], ["(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"], ["(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"], ["(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]], "0"],
@@ -66095,7 +66114,7 @@ var metadata$1 = {
66095
66114
  "FO": ["298", "00", "[2-9]\\d{5}", [6], [["(\\d{6})", "$1", ["[2-9]"]]], 0, 0, "(10(?:01|[12]0|88))"],
66096
66115
  "FR": ["33", "00", "[1-9]\\d{8}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0 $1"], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[1-79]"], "0$1"]], "0"],
66097
66116
  "GA": ["241", "00", "(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}", [7, 8], [["(\\d)(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-7]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["11|[67]"], "0$1"]], 0, 0, "0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})", "$1"],
66098
- "GB": ["44", "00", "[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}", [7, 9, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["800", "8001", "80011", "800111", "8001111"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["845", "8454", "84546", "845464"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["800"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["1(?:38|5[23]|69|76|94)", "1(?:(?:38|69)7|5(?:24|39)|768|946)", "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["1(?:[2-69][02-9]|[78])"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[25]|7(?:0|6[02-9])", "[25]|7(?:0|6(?:[03-9]|2[356]))"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1389]"], "0$1"]], "0", 0, "0|180020", 0, 0, 0, [["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}", [9, 10]], ["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]], 0, " x"],
66117
+ "GB": ["44", "00", "[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}", [7, 9, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["800", "8001", "80011", "800111", "8001111"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["845", "8454", "84546", "845464"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["800"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["1(?:38|5[23]|69|76|94)", "1(?:(?:38|69)7|5(?:24|39)|768|946)", "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["1(?:[2-69][02-9]|[78])"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[25]|7(?:0|6[02-9])", "[25]|7(?:0|6(?:[03-9]|2[356]))"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1389]"], "0$1"]], "0", 0, "0|180020", 0, 0, 0, [["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-35])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}", [9, 10]], ["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]], 0, " x"],
66099
66118
  "GD": ["1", "011", "(?:473|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "473$1", 0, "473"],
66100
66119
  "GE": ["995", "00", "(?:[3-57]\\d\\d|800)\\d{6}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["32"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[57]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[348]"], "0$1"]], "0"],
66101
66120
  "GF": ["594", "00", "(?:[56]94\\d|7093)\\d{5}|(?:80|9\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-7]|9[47]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[89]"], "0$1"]], "0"],
@@ -108758,3214 +108777,6 @@ const SessionManager = /*#__PURE__*/React.forwardRef(({
108758
108777
  });
108759
108778
  SessionManager.displayName = 'SessionManager';
108760
108779
 
108761
- /*
108762
- The MIT License (MIT)
108763
-
108764
- Copyright (c) 2016 Meetecho
108765
-
108766
- Permission is hereby granted, free of charge, to any person obtaining
108767
- a copy of this software and associated documentation files (the "Software"),
108768
- to deal in the Software without restriction, including without limitation
108769
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
108770
- and/or sell copies of the Software, and to permit persons to whom the
108771
- Software is furnished to do so, subject to the following conditions:
108772
-
108773
- The above copyright notice and this permission notice shall be included
108774
- in all copies or substantial portions of the Software.
108775
-
108776
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
108777
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
108778
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
108779
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
108780
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
108781
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
108782
- OTHER DEALINGS IN THE SOFTWARE.
108783
- */
108784
-
108785
- // eslint-disable-next-line no-unused-vars
108786
- var Janus = function (factory) {
108787
- if (typeof define === 'function' && define.amd) {
108788
- define(factory);
108789
- } else if (typeof module === 'object' && module.exports) {
108790
- module.exports = factory();
108791
- } else if (typeof window === 'object') {
108792
- return factory();
108793
- }
108794
- }(function () {
108795
- // List of sessions
108796
- Janus.sessions = new Map();
108797
- Janus.isExtensionEnabled = function () {
108798
- if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
108799
- // No need for the extension, getDisplayMedia is supported
108800
- return true;
108801
- }
108802
- if (window.navigator.userAgent.match('Chrome')) {
108803
- let chromever = parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1], 10);
108804
- let maxver = 33;
108805
- if (window.navigator.userAgent.match('Linux')) maxver = 35; // "known" crash in chrome 34 and 35 on linux
108806
- if (chromever >= 26 && chromever <= maxver) {
108807
- // Older versions of Chrome don't support this extension-based approach, so lie
108808
- return true;
108809
- }
108810
- return Janus.extension.isInstalled();
108811
- } else {
108812
- // Firefox and others, no need for the extension (but this doesn't mean it will work)
108813
- return true;
108814
- }
108815
- };
108816
- var defaultExtension = {
108817
- // Screensharing Chrome Extension ID
108818
- extensionId: 'hapfgfdkleiggjjpfpenajgdnfckjpaj',
108819
- isInstalled: function () {
108820
- return document.querySelector('#janus-extension-installed') !== null;
108821
- },
108822
- getScreen: function (callback) {
108823
- let pending = window.setTimeout(function () {
108824
- let error = new Error('NavigatorUserMediaError');
108825
- error.name = 'The required Chrome extension is not installed: click <a href="#">here</a> to install it. (NOTE: this will need you to refresh the page)';
108826
- return callback(error);
108827
- }, 1000);
108828
- this.cache[pending] = callback;
108829
- window.postMessage({
108830
- type: 'janusGetScreen',
108831
- id: pending
108832
- }, '*');
108833
- },
108834
- init: function () {
108835
- let cache = {};
108836
- this.cache = cache;
108837
- // Wait for events from the Chrome Extension
108838
- window.addEventListener('message', function (event) {
108839
- if (event.origin != window.location.origin) return;
108840
- if (event.data.type == 'janusGotScreen' && cache[event.data.id]) {
108841
- let callback = cache[event.data.id];
108842
- delete cache[event.data.id];
108843
- if (event.data.sourceId === '') {
108844
- // user canceled
108845
- let error = new Error('NavigatorUserMediaError');
108846
- error.name = 'You cancelled the request for permission, giving up...';
108847
- callback(error);
108848
- } else {
108849
- callback(null, event.data.sourceId);
108850
- }
108851
- } else if (event.data.type == 'janusGetScreenPending') {
108852
- window.clearTimeout(event.data.id);
108853
- }
108854
- });
108855
- }
108856
- };
108857
- Janus.useDefaultDependencies = function (deps) {
108858
- let f = deps && deps.fetch || fetch;
108859
- let p = deps && deps.Promise || Promise;
108860
- let socketCls = deps && deps.WebSocket || WebSocket;
108861
- return {
108862
- newWebSocket: function (server, proto) {
108863
- return new socketCls(server, proto);
108864
- },
108865
- extension: deps && deps.extension || defaultExtension,
108866
- isArray: function (arr) {
108867
- return Array.isArray(arr);
108868
- },
108869
- webRTCAdapter: deps && deps.adapter || adapter,
108870
- httpAPICall: function (url, options) {
108871
- let fetchOptions = {
108872
- method: options.verb,
108873
- headers: {
108874
- 'Accept': 'application/json, text/plain, */*'
108875
- },
108876
- cache: 'no-cache'
108877
- };
108878
- if (options.verb === "POST") {
108879
- fetchOptions.headers['Content-Type'] = 'application/json';
108880
- }
108881
- if (typeof options.withCredentials !== 'undefined') {
108882
- fetchOptions.credentials = options.withCredentials === true ? 'include' : options.withCredentials ? options.withCredentials : 'omit';
108883
- }
108884
- if (options.body) {
108885
- fetchOptions.body = JSON.stringify(options.body);
108886
- }
108887
- let fetching = f(url, fetchOptions).catch(function (error) {
108888
- return p.reject({
108889
- message: 'Probably a network error, is the server down?',
108890
- error: error
108891
- });
108892
- });
108893
-
108894
- /*
108895
- * fetch() does not natively support timeouts.
108896
- * Work around this by starting a timeout manually, and racing it agains the fetch() to see which thing resolves first.
108897
- */
108898
-
108899
- if (options.timeout) {
108900
- // eslint-disable-next-line no-unused-vars
108901
- let timeout = new p(function (resolve, reject) {
108902
- let timerId = setTimeout(function () {
108903
- clearTimeout(timerId);
108904
- return reject({
108905
- message: 'Request timed out',
108906
- timeout: options.timeout
108907
- });
108908
- }, options.timeout);
108909
- });
108910
- fetching = p.race([fetching, timeout]);
108911
- }
108912
- fetching.then(function (response) {
108913
- if (response.ok) {
108914
- if (typeof options.success === typeof Janus.noop) {
108915
- return response.json().then(function (parsed) {
108916
- try {
108917
- options.success(parsed);
108918
- } catch (error) {
108919
- Janus.error('Unhandled httpAPICall success callback error', error);
108920
- }
108921
- }, function (error) {
108922
- return p.reject({
108923
- message: 'Failed to parse response body',
108924
- error: error,
108925
- response: response
108926
- });
108927
- });
108928
- }
108929
- } else {
108930
- return p.reject({
108931
- message: 'API call failed',
108932
- response: response
108933
- });
108934
- }
108935
- }).catch(function (error) {
108936
- if (typeof options.error === typeof Janus.noop) {
108937
- options.error(error.message || '<< internal error >>', error);
108938
- }
108939
- });
108940
- return fetching;
108941
- }
108942
- };
108943
- };
108944
- Janus.useOldDependencies = function (deps) {
108945
- let jq = deps && deps.jQuery || jQuery;
108946
- let socketCls = deps && deps.WebSocket || WebSocket;
108947
- return {
108948
- newWebSocket: function (server, proto) {
108949
- return new socketCls(server, proto);
108950
- },
108951
- isArray: function (arr) {
108952
- return jq.isArray(arr);
108953
- },
108954
- extension: deps && deps.extension || defaultExtension,
108955
- webRTCAdapter: deps && deps.adapter || adapter,
108956
- httpAPICall: function (url, options) {
108957
- let payload = typeof options.body !== 'undefined' ? {
108958
- contentType: 'application/json',
108959
- data: JSON.stringify(options.body)
108960
- } : {};
108961
- let credentials = typeof options.withCredentials !== 'undefined' ? {
108962
- xhrFields: {
108963
- withCredentials: options.withCredentials
108964
- }
108965
- } : {};
108966
- return jq.ajax(jq.extend(payload, credentials, {
108967
- url: url,
108968
- type: options.verb,
108969
- cache: false,
108970
- dataType: 'json',
108971
- async: options.async,
108972
- timeout: options.timeout,
108973
- success: function (result) {
108974
- if (typeof options.success === typeof Janus.noop) {
108975
- options.success(result);
108976
- }
108977
- },
108978
- // eslint-disable-next-line no-unused-vars
108979
- error: function (xhr, status, err) {
108980
- if (typeof options.error === typeof Janus.noop) {
108981
- options.error(status, err);
108982
- }
108983
- }
108984
- }));
108985
- }
108986
- };
108987
- };
108988
-
108989
- // Helper function to convert a deprecated media object to a tracks array
108990
- Janus.mediaToTracks = function (media) {
108991
- let tracks = [];
108992
- if (!media) {
108993
- // Default is bidirectional audio and video, using default devices
108994
- tracks.push({
108995
- type: 'audio',
108996
- capture: true,
108997
- recv: true
108998
- });
108999
- tracks.push({
109000
- type: 'video',
109001
- capture: true,
109002
- recv: true
109003
- });
109004
- } else {
109005
- if (!media.keepAudio && media.audio !== false && (typeof media.audio === 'undefined' || media.audio || media.audioSend || media.audioRecv || media.addAudio || media.replaceAudio || media.removeAudio)) {
109006
- // We may need an audio track
109007
- let track = {
109008
- type: 'audio'
109009
- };
109010
- if (media.removeAudio) {
109011
- track.remove = true;
109012
- } else {
109013
- if (media.addAudio) track.add = true;else if (media.replaceAudio) track.replace = true;
109014
- // Check if we need to capture an audio device
109015
- if (media.audioSend !== false) track.capture = media.audio || true;
109016
- // Check if we need to receive audio
109017
- if (media.audioRecv !== false) track.recv = true;
109018
- }
109019
- // Add an audio track if needed
109020
- if (track.remove || track.capture || track.recv) tracks.push(track);
109021
- }
109022
- if (!media.keepVideo && media.video !== false && (typeof media.video === 'undefined' || media.video || media.videoSend || media.videoRecv || media.addVideo || media.replaceVideo || media.removeVideo)) {
109023
- // We may need a video track
109024
- let track = {
109025
- type: 'video'
109026
- };
109027
- if (media.removeVideo) {
109028
- track.remove = true;
109029
- } else {
109030
- if (media.addVideo) track.add = true;else if (media.replaceVideo) track.replace = true;
109031
- // Check if we need to capture a video device
109032
- if (media.videoSend !== false) {
109033
- track.capture = media.video || true;
109034
- if (['screen', 'window', 'desktop'].includes(track.capture)) {
109035
- // Change the type to 'screen'
109036
- track.type = 'screen';
109037
- track.capture = {
109038
- video: {}
109039
- };
109040
- // Check if there's constraints
109041
- if (media.screenshareFrameRate) track.capture.frameRate = media.screenshareFrameRate;
109042
- if (media.screenshareHeight) track.capture.height = media.screenshareHeight;
109043
- if (media.screenshareWidth) track.capture.width = media.screenshareWidth;
109044
- }
109045
- }
109046
- // Check if we need to receive video
109047
- if (media.videoRecv !== false) track.recv = true;
109048
- }
109049
- // Add a video track if needed
109050
- if (track.remove || track.capture || track.recv) tracks.push(track);
109051
- }
109052
- if (media.data) {
109053
- // We need a data channel
109054
- tracks.push({
109055
- type: 'data'
109056
- });
109057
- }
109058
- }
109059
- // Done
109060
- return tracks;
109061
- };
109062
-
109063
- // Helper function to convert a track object to a set of constraints
109064
- Janus.trackConstraints = function (track) {
109065
- let constraints = {};
109066
- if (!track || !track.capture) return constraints;
109067
- if (track.type === 'audio') {
109068
- // Just put the capture part in the constraints
109069
- constraints.audio = track.capture;
109070
- } else if (track.type === 'video') {
109071
- // Check if one of the keywords was passed
109072
- if ((track.simulcast || track.svc) && track.capture === true) track.capture = 'hires';
109073
- if (track.capture === true || typeof track.capture === 'object') {
109074
- // Use the provided capture object as video constraint
109075
- constraints.video = track.capture;
109076
- } else {
109077
- let width = 0;
109078
- let height = 0;
109079
- if (track.capture === 'lowres') {
109080
- // Small resolution, 4:3
109081
- width = 320;
109082
- height = 240;
109083
- } else if (track.capture === 'lowres-16:9') {
109084
- // Small resolution, 16:9
109085
- width = 320;
109086
- height = 180;
109087
- } else if (track.capture === 'hires' || track.capture === 'hires-16:9' || track.capture === 'hdres') {
109088
- // High(HD) resolution is only 16:9
109089
- width = 1280;
109090
- height = 720;
109091
- } else if (track.capture === 'fhdres') {
109092
- // Full HD resolution is only 16:9
109093
- width = 1920;
109094
- height = 1080;
109095
- } else if (track.capture === '4kres') {
109096
- // 4K resolution is only 16:9
109097
- width = 3840;
109098
- height = 2160;
109099
- } else if (track.capture === 'stdres') {
109100
- // Normal resolution, 4:3
109101
- width = 640;
109102
- height = 480;
109103
- } else if (track.capture === 'stdres-16:9') {
109104
- // Normal resolution, 16:9
109105
- width = 640;
109106
- height = 360;
109107
- } else {
109108
- Janus.log('Default video setting is stdres 4:3');
109109
- width = 640;
109110
- height = 480;
109111
- }
109112
- constraints.video = {
109113
- width: {
109114
- ideal: width
109115
- },
109116
- height: {
109117
- ideal: height
109118
- }
109119
- };
109120
- }
109121
- } else if (track.type === 'screen') {
109122
- // Use the provided capture object as video constraint
109123
- constraints.video = track.capture;
109124
- }
109125
- return constraints;
109126
- };
109127
- Janus.noop = function () {};
109128
- Janus.dataChanDefaultLabel = "JanusDataChannel";
109129
-
109130
- // Note: in the future we may want to change this, e.g., as was
109131
- // attempted in https://github.com/meetecho/janus-gateway/issues/1670
109132
- Janus.endOfCandidates = null;
109133
-
109134
- // Stop all tracks from a given stream
109135
- Janus.stopAllTracks = function (stream) {
109136
- try {
109137
- // Try a MediaStreamTrack.stop() for each track
109138
- let tracks = stream.getTracks();
109139
- for (let mst of tracks) {
109140
- Janus.log(mst);
109141
- if (mst && mst.dontStop !== true) {
109142
- mst.stop();
109143
- }
109144
- }
109145
- // eslint-disable-next-line no-unused-vars
109146
- } catch (e) {
109147
- // Do nothing if this fails
109148
- }
109149
- };
109150
-
109151
- // Initialization
109152
- Janus.init = function (options) {
109153
- options = options || {};
109154
- options.callback = typeof options.callback == "function" ? options.callback : Janus.noop;
109155
- if (Janus.initDone) {
109156
- // Already initialized
109157
- options.callback();
109158
- } else {
109159
- if (typeof console.log == "undefined") {
109160
- console.log = function () {};
109161
- }
109162
- // Console logging (all debugging disabled by default)
109163
- Janus.trace = Janus.noop;
109164
- Janus.debug = Janus.noop;
109165
- Janus.vdebug = Janus.noop;
109166
- Janus.log = Janus.noop;
109167
- Janus.warn = Janus.noop;
109168
- Janus.error = Janus.noop;
109169
- if (options.debug === true || options.debug === "all") {
109170
- // Enable all debugging levels
109171
- Janus.trace = console.trace.bind(console);
109172
- Janus.debug = console.debug.bind(console);
109173
- Janus.vdebug = console.debug.bind(console);
109174
- Janus.log = console.log.bind(console);
109175
- Janus.warn = console.warn.bind(console);
109176
- Janus.error = console.error.bind(console);
109177
- } else if (Array.isArray(options.debug)) {
109178
- for (let d of options.debug) {
109179
- switch (d) {
109180
- case "trace":
109181
- Janus.trace = console.trace.bind(console);
109182
- break;
109183
- case "debug":
109184
- Janus.debug = console.debug.bind(console);
109185
- break;
109186
- case "vdebug":
109187
- Janus.vdebug = console.debug.bind(console);
109188
- break;
109189
- case "log":
109190
- Janus.log = console.log.bind(console);
109191
- break;
109192
- case "warn":
109193
- Janus.warn = console.warn.bind(console);
109194
- break;
109195
- case "error":
109196
- Janus.error = console.error.bind(console);
109197
- break;
109198
- }
109199
- }
109200
- }
109201
- Janus.log("Initializing library");
109202
- let usedDependencies = options.dependencies || Janus.useDefaultDependencies();
109203
- Janus.isArray = usedDependencies.isArray;
109204
- Janus.webRTCAdapter = usedDependencies.webRTCAdapter;
109205
- Janus.httpAPICall = usedDependencies.httpAPICall;
109206
- Janus.newWebSocket = usedDependencies.newWebSocket;
109207
- Janus.extension = usedDependencies.extension;
109208
- Janus.extension.init();
109209
-
109210
- // Helper method to enumerate devices
109211
- Janus.listDevices = function (callback, config) {
109212
- callback = typeof callback == "function" ? callback : Janus.noop;
109213
- if (!config) config = {
109214
- audio: true,
109215
- video: true
109216
- };
109217
- if (Janus.isGetUserMediaAvailable()) {
109218
- navigator.mediaDevices.getUserMedia(config).then(function (stream) {
109219
- navigator.mediaDevices.enumerateDevices().then(function (devices) {
109220
- Janus.debug(devices);
109221
- callback(devices);
109222
- // Get rid of the now useless stream
109223
- Janus.stopAllTracks(stream);
109224
- });
109225
- }).catch(function (err) {
109226
- Janus.error(err);
109227
- callback([]);
109228
- });
109229
- } else {
109230
- Janus.warn("navigator.mediaDevices unavailable");
109231
- callback([]);
109232
- }
109233
- };
109234
- // Helper methods to attach/reattach a stream to a video element (previously part of adapter.js)
109235
- Janus.attachMediaStream = function (element, stream) {
109236
- try {
109237
- element.srcObject = stream;
109238
- // eslint-disable-next-line no-unused-vars
109239
- } catch (e) {
109240
- try {
109241
- element.src = URL.createObjectURL(stream);
109242
- } catch (e) {
109243
- Janus.error("Error attaching stream to element", e);
109244
- }
109245
- }
109246
- };
109247
- Janus.reattachMediaStream = function (to, from) {
109248
- try {
109249
- to.srcObject = from.srcObject;
109250
- // eslint-disable-next-line no-unused-vars
109251
- } catch (e) {
109252
- try {
109253
- to.src = from.src;
109254
- } catch (e) {
109255
- Janus.error("Error reattaching stream to element", e);
109256
- }
109257
- }
109258
- };
109259
- // Detect tab close: make sure we don't loose existing onbeforeunload handlers
109260
- // (note: for iOS we need to subscribe to a different event, 'pagehide', see
109261
- // https://gist.github.com/thehunmonkgroup/6bee8941a49b86be31a787fe8f4b8cfe)
109262
- let iOS = ['iPad', 'iPhone', 'iPod'].indexOf(navigator.platform) >= 0;
109263
- let eventName = iOS ? 'pagehide' : 'beforeunload';
109264
- let oldOBF = window["on" + eventName];
109265
- window.addEventListener(eventName, function () {
109266
- Janus.log("Closing window");
109267
- for (const [sessionId, session] of Janus.sessions) {
109268
- if (session && session.destroyOnUnload) {
109269
- Janus.log("Destroying session " + sessionId);
109270
- session.destroy({
109271
- unload: true,
109272
- notifyDestroyed: false
109273
- });
109274
- }
109275
- }
109276
- if (oldOBF && typeof oldOBF == "function") {
109277
- oldOBF();
109278
- }
109279
- });
109280
- // If this is a Safari, check if VP8 or VP9 are supported
109281
- Janus.safariVp8 = false;
109282
- Janus.safariVp9 = false;
109283
- if (Janus.webRTCAdapter.browserDetails.browser === 'safari' && Janus.webRTCAdapter.browserDetails.version >= 605) {
109284
- // Let's see if RTCRtpSender.getCapabilities() is there
109285
- if (RTCRtpSender && RTCRtpSender.getCapabilities && RTCRtpSender.getCapabilities("video") && RTCRtpSender.getCapabilities("video").codecs && RTCRtpSender.getCapabilities("video").codecs.length) {
109286
- for (let codec of RTCRtpSender.getCapabilities("video").codecs) {
109287
- if (codec && codec.mimeType && codec.mimeType.toLowerCase() === "video/vp8") {
109288
- Janus.safariVp8 = true;
109289
- } else if (codec && codec.mimeType && codec.mimeType.toLowerCase() === "video/vp9") {
109290
- Janus.safariVp9 = true;
109291
- }
109292
- }
109293
- if (Janus.safariVp8) {
109294
- Janus.log("This version of Safari supports VP8");
109295
- } else {
109296
- Janus.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, " + "try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu");
109297
- }
109298
- } else {
109299
- // We do it in a very ugly way, as there's no alternative...
109300
- // We create a PeerConnection to see if VP8 is in an offer
109301
- let testpc = new RTCPeerConnection({});
109302
- testpc.createOffer({
109303
- offerToReceiveVideo: true
109304
- }).then(function (offer) {
109305
- Janus.safariVp8 = offer.sdp.indexOf("VP8") !== -1;
109306
- Janus.safariVp9 = offer.sdp.indexOf("VP9") !== -1;
109307
- if (Janus.safariVp8) {
109308
- Janus.log("This version of Safari supports VP8");
109309
- } else {
109310
- Janus.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, " + "try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu");
109311
- }
109312
- testpc.close();
109313
- testpc = null;
109314
- });
109315
- }
109316
- }
109317
- Janus.initDone = true;
109318
- options.callback();
109319
- }
109320
- };
109321
-
109322
- // Helper method to check whether WebRTC is supported by this browser
109323
- Janus.isWebrtcSupported = function () {
109324
- return !!window.RTCPeerConnection;
109325
- };
109326
- // Helper method to check whether devices can be accessed by this browser (e.g., not possible via plain HTTP)
109327
- Janus.isGetUserMediaAvailable = function () {
109328
- return navigator.mediaDevices && navigator.mediaDevices.getUserMedia;
109329
- };
109330
-
109331
- // Helper method to create random identifiers (e.g., transaction)
109332
- Janus.randomString = function (len) {
109333
- let charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
109334
- let randomString = '';
109335
- for (let i = 0; i < len; i++) {
109336
- let randomPoz = Math.floor(Math.random() * charSet.length);
109337
- randomString += charSet.charAt(randomPoz);
109338
- }
109339
- return randomString;
109340
- };
109341
- function Janus(gatewayCallbacks) {
109342
- gatewayCallbacks = gatewayCallbacks || {};
109343
- gatewayCallbacks.success = typeof gatewayCallbacks.success == "function" ? gatewayCallbacks.success : Janus.noop;
109344
- gatewayCallbacks.error = typeof gatewayCallbacks.error == "function" ? gatewayCallbacks.error : Janus.noop;
109345
- gatewayCallbacks.destroyed = typeof gatewayCallbacks.destroyed == "function" ? gatewayCallbacks.destroyed : Janus.noop;
109346
- if (!Janus.initDone) {
109347
- gatewayCallbacks.error("Library not initialized");
109348
- return {};
109349
- }
109350
- if (!Janus.isWebrtcSupported()) {
109351
- gatewayCallbacks.error("WebRTC not supported by this browser");
109352
- return {};
109353
- }
109354
- Janus.log("Library initialized: " + Janus.initDone);
109355
- if (!gatewayCallbacks.server) {
109356
- gatewayCallbacks.error("Invalid server url");
109357
- return {};
109358
- }
109359
- let websockets = false;
109360
- let ws = null;
109361
- let wsHandlers = {};
109362
- let wsKeepaliveTimeoutId = null;
109363
- let servers = null;
109364
- let serversIndex = 0;
109365
- let server = gatewayCallbacks.server;
109366
- if (Janus.isArray(server)) {
109367
- Janus.log("Multiple servers provided (" + server.length + "), will use the first that works");
109368
- server = null;
109369
- servers = gatewayCallbacks.server;
109370
- Janus.debug(servers);
109371
- } else {
109372
- if (server.indexOf("ws") === 0) {
109373
- websockets = true;
109374
- Janus.log("Using WebSockets to contact Janus: " + server);
109375
- } else {
109376
- websockets = false;
109377
- Janus.log("Using REST API to contact Janus: " + server);
109378
- }
109379
- }
109380
- let iceServers = gatewayCallbacks.iceServers || [{
109381
- urls: "stun:stun.l.google.com:19302"
109382
- }];
109383
- let iceTransportPolicy = gatewayCallbacks.iceTransportPolicy;
109384
- let bundlePolicy = gatewayCallbacks.bundlePolicy;
109385
- // Whether we should enable the withCredentials flag for XHR requests
109386
- let withCredentials = false;
109387
- if (typeof gatewayCallbacks.withCredentials !== 'undefined' && gatewayCallbacks.withCredentials !== null) withCredentials = gatewayCallbacks.withCredentials === true;
109388
- // Optional max events
109389
- let maxev = 10;
109390
- if (typeof gatewayCallbacks.max_poll_events !== 'undefined' && gatewayCallbacks.max_poll_events !== null) maxev = gatewayCallbacks.max_poll_events;
109391
- if (maxev < 1) maxev = 1;
109392
- // Token to use (only if the token based authentication mechanism is enabled)
109393
- let token = null;
109394
- if (typeof gatewayCallbacks.token !== 'undefined' && gatewayCallbacks.token !== null) token = gatewayCallbacks.token;
109395
- // API secret to use (only if the shared API secret is enabled)
109396
- let apisecret = null;
109397
- if (typeof gatewayCallbacks.apisecret !== 'undefined' && gatewayCallbacks.apisecret !== null) apisecret = gatewayCallbacks.apisecret;
109398
- // Whether we should destroy this session when onbeforeunload is called
109399
- this.destroyOnUnload = true;
109400
- if (typeof gatewayCallbacks.destroyOnUnload !== 'undefined' && gatewayCallbacks.destroyOnUnload !== null) this.destroyOnUnload = gatewayCallbacks.destroyOnUnload === true;
109401
- // Some timeout-related values
109402
- let keepAlivePeriod = 25000;
109403
- if (typeof gatewayCallbacks.keepAlivePeriod !== 'undefined' && gatewayCallbacks.keepAlivePeriod !== null) keepAlivePeriod = gatewayCallbacks.keepAlivePeriod;
109404
- if (isNaN(keepAlivePeriod)) keepAlivePeriod = 25000;
109405
- let longPollTimeout = 60000;
109406
- if (typeof gatewayCallbacks.longPollTimeout !== 'undefined' && gatewayCallbacks.longPollTimeout !== null) longPollTimeout = gatewayCallbacks.longPollTimeout;
109407
- if (isNaN(longPollTimeout)) longPollTimeout = 60000;
109408
-
109409
- // overrides for default maxBitrate values for simulcasting
109410
- function getMaxBitrates(simulcastMaxBitrates) {
109411
- let maxBitrates = {
109412
- high: 900000,
109413
- medium: 300000,
109414
- low: 100000
109415
- };
109416
- if (typeof simulcastMaxBitrates !== 'undefined' && simulcastMaxBitrates !== null) {
109417
- if (simulcastMaxBitrates.high) maxBitrates.high = simulcastMaxBitrates.high;
109418
- if (simulcastMaxBitrates.medium) maxBitrates.medium = simulcastMaxBitrates.medium;
109419
- if (simulcastMaxBitrates.low) maxBitrates.low = simulcastMaxBitrates.low;
109420
- }
109421
- return maxBitrates;
109422
- }
109423
- let connected = false;
109424
- let sessionId = null;
109425
- let pluginHandles = new Map();
109426
- let that = this;
109427
- let retries = 0;
109428
- let transactions = new Map();
109429
- createSession(gatewayCallbacks);
109430
-
109431
- // Public methods
109432
- this.getServer = function () {
109433
- return server;
109434
- };
109435
- this.isConnected = function () {
109436
- return connected;
109437
- };
109438
- this.reconnect = function (callbacks) {
109439
- callbacks = callbacks || {};
109440
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
109441
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
109442
- callbacks["reconnect"] = true;
109443
- createSession(callbacks);
109444
- };
109445
- this.getSessionId = function () {
109446
- return sessionId;
109447
- };
109448
- this.getInfo = function (callbacks) {
109449
- getInfo(callbacks);
109450
- };
109451
- this.destroy = function (callbacks) {
109452
- destroySession(callbacks);
109453
- };
109454
- this.attach = function (callbacks) {
109455
- createHandle(callbacks);
109456
- };
109457
- function eventHandler() {
109458
- if (sessionId == null) return;
109459
- Janus.debug('Long poll...');
109460
- if (!connected) {
109461
- Janus.warn("Is the server down? (connected=false)");
109462
- return;
109463
- }
109464
- let longpoll = server + "/" + sessionId + "?rid=" + new Date().getTime();
109465
- if (maxev) longpoll = longpoll + "&maxev=" + maxev;
109466
- if (token) longpoll = longpoll + "&token=" + encodeURIComponent(token);
109467
- if (apisecret) longpoll = longpoll + "&apisecret=" + encodeURIComponent(apisecret);
109468
- Janus.httpAPICall(longpoll, {
109469
- verb: 'GET',
109470
- withCredentials: withCredentials,
109471
- success: handleEvent,
109472
- timeout: longPollTimeout,
109473
- error: function (textStatus, errorThrown) {
109474
- Janus.error(textStatus + ":", errorThrown);
109475
- retries++;
109476
- if (retries > 3) {
109477
- // Did we just lose the server? :-(
109478
- connected = false;
109479
- gatewayCallbacks.error("Lost connection to the server (is it down?)");
109480
- return;
109481
- }
109482
- eventHandler();
109483
- }
109484
- });
109485
- }
109486
-
109487
- // Private event handler: this will trigger plugin callbacks, if set
109488
- function handleEvent(json, skipTimeout) {
109489
- retries = 0;
109490
- if (!websockets && typeof sessionId !== 'undefined' && sessionId !== null && skipTimeout !== true) eventHandler();
109491
- if (!websockets && Janus.isArray(json)) {
109492
- // We got an array: it means we passed a maxev > 1, iterate on all objects
109493
- for (let i = 0; i < json.length; i++) {
109494
- handleEvent(json[i], true);
109495
- }
109496
- return;
109497
- }
109498
- if (json["janus"] === "keepalive") {
109499
- // Nothing happened
109500
- Janus.vdebug("Got a keepalive on session " + sessionId);
109501
- return;
109502
- } else if (json["janus"] === "server_info") {
109503
- // Just info on the Janus instance
109504
- Janus.debug("Got info on the Janus instance");
109505
- Janus.debug(json);
109506
- const transaction = json["transaction"];
109507
- if (transaction) {
109508
- const reportSuccess = transactions.get(transaction);
109509
- if (reportSuccess) reportSuccess(json);
109510
- transactions.delete(transaction);
109511
- }
109512
- return;
109513
- } else if (json["janus"] === "ack") {
109514
- // Just an ack, we can probably ignore
109515
- Janus.debug("Got an ack on session " + sessionId);
109516
- Janus.debug(json);
109517
- const transaction = json["transaction"];
109518
- if (transaction) {
109519
- const reportSuccess = transactions.get(transaction);
109520
- if (reportSuccess) reportSuccess(json);
109521
- transactions.delete(transaction);
109522
- }
109523
- return;
109524
- } else if (json["janus"] === "success") {
109525
- // Success!
109526
- Janus.debug("Got a success on session " + sessionId);
109527
- Janus.debug(json);
109528
- const transaction = json["transaction"];
109529
- if (transaction) {
109530
- const reportSuccess = transactions.get(transaction);
109531
- if (reportSuccess) reportSuccess(json);
109532
- transactions.delete(transaction);
109533
- }
109534
- return;
109535
- } else if (json["janus"] === "trickle") {
109536
- // We got a trickle candidate from Janus
109537
- const sender = json["sender"];
109538
- if (!sender) {
109539
- Janus.warn("Missing sender...");
109540
- return;
109541
- }
109542
- const pluginHandle = pluginHandles.get(sender);
109543
- if (!pluginHandle) {
109544
- Janus.debug("This handle is not attached to this session");
109545
- return;
109546
- }
109547
- let candidate = json["candidate"];
109548
- Janus.debug("Got a trickled candidate on session " + sessionId);
109549
- Janus.debug(candidate);
109550
- let config = pluginHandle.webrtcStuff;
109551
- if (config.pc && config.remoteSdp) {
109552
- // Add candidate right now
109553
- Janus.debug("Adding remote candidate:", candidate);
109554
- if (!candidate || candidate.completed === true) {
109555
- // end-of-candidates
109556
- config.pc.addIceCandidate(Janus.endOfCandidates);
109557
- } else {
109558
- // New candidate
109559
- config.pc.addIceCandidate(candidate);
109560
- }
109561
- } else {
109562
- // We didn't do setRemoteDescription (trickle got here before the offer?)
109563
- Janus.debug("We didn't do setRemoteDescription (trickle got here before the offer?), caching candidate");
109564
- if (!config.candidates) config.candidates = [];
109565
- config.candidates.push(candidate);
109566
- Janus.debug(config.candidates);
109567
- }
109568
- } else if (json["janus"] === "webrtcup") {
109569
- // The PeerConnection with the server is up! Notify this
109570
- Janus.debug("Got a webrtcup event on session " + sessionId);
109571
- Janus.debug(json);
109572
- const sender = json["sender"];
109573
- if (!sender) {
109574
- Janus.warn("Missing sender...");
109575
- return;
109576
- }
109577
- const pluginHandle = pluginHandles.get(sender);
109578
- if (!pluginHandle) {
109579
- Janus.debug("This handle is not attached to this session");
109580
- return;
109581
- }
109582
- pluginHandle.webrtcState(true);
109583
- return;
109584
- } else if (json["janus"] === "hangup") {
109585
- // A plugin asked the core to hangup a PeerConnection on one of our handles
109586
- Janus.debug("Got a hangup event on session " + sessionId);
109587
- Janus.debug(json);
109588
- const sender = json["sender"];
109589
- if (!sender) {
109590
- Janus.warn("Missing sender...");
109591
- return;
109592
- }
109593
- const pluginHandle = pluginHandles.get(sender);
109594
- if (!pluginHandle) {
109595
- Janus.debug("This handle is not attached to this session");
109596
- return;
109597
- }
109598
- pluginHandle.webrtcState(false, json["reason"]);
109599
- pluginHandle.hangup();
109600
- } else if (json["janus"] === "detached") {
109601
- // A plugin asked the core to detach one of our handles
109602
- Janus.debug("Got a detached event on session " + sessionId);
109603
- Janus.debug(json);
109604
- const sender = json["sender"];
109605
- if (!sender) {
109606
- Janus.warn("Missing sender...");
109607
- return;
109608
- }
109609
- const pluginHandle = pluginHandles.get(sender);
109610
- if (!pluginHandle) {
109611
- // Don't warn here because destroyHandle causes this situation.
109612
- return;
109613
- }
109614
- pluginHandle.ondetached();
109615
- pluginHandle.detach();
109616
- } else if (json["janus"] === "media") {
109617
- // Media started/stopped flowing
109618
- Janus.debug("Got a media event on session " + sessionId);
109619
- Janus.debug(json);
109620
- const sender = json["sender"];
109621
- if (!sender) {
109622
- Janus.warn("Missing sender...");
109623
- return;
109624
- }
109625
- const pluginHandle = pluginHandles.get(sender);
109626
- if (!pluginHandle) {
109627
- Janus.debug("This handle is not attached to this session");
109628
- return;
109629
- }
109630
- pluginHandle.mediaState(json["type"], json["receiving"], json["mid"]);
109631
- } else if (json["janus"] === "slowlink") {
109632
- Janus.debug("Got a slowlink event on session " + sessionId);
109633
- Janus.debug(json);
109634
- // Trouble uplink or downlink
109635
- const sender = json["sender"];
109636
- if (!sender) {
109637
- Janus.warn("Missing sender...");
109638
- return;
109639
- }
109640
- const pluginHandle = pluginHandles.get(sender);
109641
- if (!pluginHandle) {
109642
- Janus.debug("This handle is not attached to this session");
109643
- return;
109644
- }
109645
- pluginHandle.slowLink(json["uplink"], json["lost"], json["mid"]);
109646
- } else if (json["janus"] === "error") {
109647
- // Oops, something wrong happened
109648
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
109649
- Janus.debug(json);
109650
- let transaction = json["transaction"];
109651
- if (transaction) {
109652
- let reportSuccess = transactions.get(transaction);
109653
- if (reportSuccess) {
109654
- reportSuccess(json);
109655
- }
109656
- transactions.delete(transaction);
109657
- }
109658
- return;
109659
- } else if (json["janus"] === "event") {
109660
- Janus.debug("Got a plugin event on session " + sessionId);
109661
- Janus.debug(json);
109662
- const sender = json["sender"];
109663
- if (!sender) {
109664
- Janus.warn("Missing sender...");
109665
- return;
109666
- }
109667
- let plugindata = json["plugindata"];
109668
- if (!plugindata) {
109669
- Janus.warn("Missing plugindata...");
109670
- return;
109671
- }
109672
- Janus.debug(" -- Event is coming from " + sender + " (" + plugindata["plugin"] + ")");
109673
- let data = plugindata["data"];
109674
- Janus.debug(data);
109675
- const pluginHandle = pluginHandles.get(sender);
109676
- if (!pluginHandle) {
109677
- Janus.warn("This handle is not attached to this session");
109678
- return;
109679
- }
109680
- let jsep = json["jsep"];
109681
- if (jsep) {
109682
- Janus.debug("Handling SDP as well...");
109683
- Janus.debug(jsep);
109684
- }
109685
- let callback = pluginHandle.onmessage;
109686
- if (callback) {
109687
- Janus.debug("Notifying application...");
109688
- // Send to callback specified when attaching plugin handle
109689
- callback(data, jsep);
109690
- } else {
109691
- // Send to generic callback (?)
109692
- Janus.debug("No provided notification callback");
109693
- }
109694
- } else if (json["janus"] === "timeout") {
109695
- Janus.error("Timeout on session " + sessionId);
109696
- Janus.debug(json);
109697
- if (websockets) {
109698
- ws.close(3504, "Gateway timeout");
109699
- }
109700
- return;
109701
- } else {
109702
- Janus.warn("Unknown message/event '" + json["janus"] + "' on session " + sessionId);
109703
- Janus.debug(json);
109704
- }
109705
- }
109706
-
109707
- // Private helper to send keep-alive messages on WebSockets
109708
- function keepAlive() {
109709
- if (!server || !websockets || !connected) return;
109710
- wsKeepaliveTimeoutId = setTimeout(keepAlive, keepAlivePeriod);
109711
- let request = {
109712
- "janus": "keepalive",
109713
- "session_id": sessionId,
109714
- "transaction": Janus.randomString(12)
109715
- };
109716
- if (token) request["token"] = token;
109717
- if (apisecret) request["apisecret"] = apisecret;
109718
- ws.send(JSON.stringify(request));
109719
- }
109720
-
109721
- // Private method to create a session
109722
- function createSession(callbacks) {
109723
- let transaction = Janus.randomString(12);
109724
- let request = {
109725
- "janus": "create",
109726
- "transaction": transaction
109727
- };
109728
- if (callbacks["reconnect"]) {
109729
- // We're reconnecting, claim the session
109730
- connected = false;
109731
- request["janus"] = "claim";
109732
- request["session_id"] = sessionId;
109733
- // If we were using websockets, ignore the old connection
109734
- if (ws) {
109735
- ws.onopen = null;
109736
- ws.onerror = null;
109737
- ws.onclose = null;
109738
- if (wsKeepaliveTimeoutId) {
109739
- clearTimeout(wsKeepaliveTimeoutId);
109740
- wsKeepaliveTimeoutId = null;
109741
- }
109742
- }
109743
- }
109744
- if (token) request["token"] = token;
109745
- if (apisecret) request["apisecret"] = apisecret;
109746
- if (!server && Janus.isArray(servers)) {
109747
- // We still need to find a working server from the list we were given
109748
- server = servers[serversIndex];
109749
- if (server.indexOf("ws") === 0) {
109750
- websockets = true;
109751
- Janus.log("Server #" + (serversIndex + 1) + ": trying WebSockets to contact Janus (" + server + ")");
109752
- } else {
109753
- websockets = false;
109754
- Janus.log("Server #" + (serversIndex + 1) + ": trying REST API to contact Janus (" + server + ")");
109755
- }
109756
- }
109757
- if (websockets) {
109758
- ws = Janus.newWebSocket(server, 'janus-protocol');
109759
- wsHandlers = {
109760
- 'error': function () {
109761
- Janus.error("Error connecting to the Janus WebSockets server... " + server);
109762
- if (Janus.isArray(servers) && !callbacks["reconnect"]) {
109763
- serversIndex++;
109764
- if (serversIndex === servers.length) {
109765
- // We tried all the servers the user gave us and they all failed
109766
- callbacks.error("Error connecting to any of the provided Janus servers: Is the server down?");
109767
- return;
109768
- }
109769
- // Let's try the next server
109770
- server = null;
109771
- setTimeout(function () {
109772
- createSession(callbacks);
109773
- }, 200);
109774
- return;
109775
- }
109776
- callbacks.error("Error connecting to the Janus WebSockets server: Is the server down?");
109777
- },
109778
- 'open': function () {
109779
- // We need to be notified about the success
109780
- transactions.set(transaction, function (json) {
109781
- Janus.debug(json);
109782
- if (json["janus"] !== "success") {
109783
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
109784
- callbacks.error(json["error"].reason);
109785
- return;
109786
- }
109787
- wsKeepaliveTimeoutId = setTimeout(keepAlive, keepAlivePeriod);
109788
- connected = true;
109789
- sessionId = json["session_id"] ? json["session_id"] : json.data["id"];
109790
- if (callbacks["reconnect"]) {
109791
- Janus.log("Claimed session: " + sessionId);
109792
- } else {
109793
- Janus.log("Created session: " + sessionId);
109794
- }
109795
- Janus.sessions.set(sessionId, that);
109796
- callbacks.success();
109797
- });
109798
- ws.send(JSON.stringify(request));
109799
- },
109800
- 'message': function (event) {
109801
- handleEvent(JSON.parse(event.data));
109802
- },
109803
- 'close': function () {
109804
- if (!server || !connected) {
109805
- return;
109806
- }
109807
- connected = false;
109808
- // FIXME What if this is called when the page is closed?
109809
- gatewayCallbacks.error("Lost connection to the server (is it down?)");
109810
- }
109811
- };
109812
- for (let eventName in wsHandlers) {
109813
- ws.addEventListener(eventName, wsHandlers[eventName]);
109814
- }
109815
- return;
109816
- }
109817
- Janus.httpAPICall(server, {
109818
- verb: 'POST',
109819
- withCredentials: withCredentials,
109820
- body: request,
109821
- success: function (json) {
109822
- Janus.debug(json);
109823
- if (json["janus"] !== "success") {
109824
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
109825
- callbacks.error(json["error"].reason);
109826
- return;
109827
- }
109828
- connected = true;
109829
- sessionId = json["session_id"] ? json["session_id"] : json.data["id"];
109830
- if (callbacks["reconnect"]) {
109831
- Janus.log("Claimed session: " + sessionId);
109832
- } else {
109833
- Janus.log("Created session: " + sessionId);
109834
- }
109835
- Janus.sessions.set(sessionId, that);
109836
- eventHandler();
109837
- callbacks.success();
109838
- },
109839
- error: function (textStatus, errorThrown) {
109840
- Janus.error(textStatus + ":", errorThrown); // FIXME
109841
- if (Janus.isArray(servers) && !callbacks["reconnect"]) {
109842
- serversIndex++;
109843
- if (serversIndex === servers.length) {
109844
- // We tried all the servers the user gave us and they all failed
109845
- callbacks.error("Error connecting to any of the provided Janus servers: Is the server down?");
109846
- return;
109847
- }
109848
- // Let's try the next server
109849
- server = null;
109850
- setTimeout(function () {
109851
- createSession(callbacks);
109852
- }, 200);
109853
- return;
109854
- }
109855
- if (errorThrown === "") callbacks.error(textStatus + ": Is the server down?");else if (errorThrown && errorThrown.error) callbacks.error(textStatus + ": " + errorThrown.error.message);else callbacks.error(textStatus + ": " + errorThrown);
109856
- }
109857
- });
109858
- }
109859
-
109860
- // Private method to get info on the server
109861
- function getInfo(callbacks) {
109862
- callbacks = callbacks || {};
109863
- // FIXME This method triggers a success even when we fail
109864
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
109865
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
109866
- Janus.log("Getting info on Janus instance");
109867
- if (!connected) {
109868
- Janus.warn("Is the server down? (connected=false)");
109869
- callbacks.error("Is the server down? (connected=false)");
109870
- return;
109871
- }
109872
- // We just need to send an "info" request
109873
- let transaction = Janus.randomString(12);
109874
- let request = {
109875
- "janus": "info",
109876
- "transaction": transaction
109877
- };
109878
- if (token) request["token"] = token;
109879
- if (apisecret) request["apisecret"] = apisecret;
109880
- if (websockets) {
109881
- transactions.set(transaction, function (json) {
109882
- Janus.log("Server info:");
109883
- Janus.debug(json);
109884
- if (json["janus"] !== "server_info") {
109885
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
109886
- }
109887
- callbacks.success(json);
109888
- });
109889
- ws.send(JSON.stringify(request));
109890
- return;
109891
- }
109892
- Janus.httpAPICall(server, {
109893
- verb: 'POST',
109894
- withCredentials: withCredentials,
109895
- body: request,
109896
- success: function (json) {
109897
- Janus.log("Server info:");
109898
- Janus.debug(json);
109899
- if (json["janus"] !== "server_info") {
109900
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
109901
- }
109902
- callbacks.success(json);
109903
- },
109904
- error: function (textStatus, errorThrown) {
109905
- Janus.error(textStatus + ":", errorThrown); // FIXME
109906
- if (errorThrown === "") callbacks.error(textStatus + ": Is the server down?");else callbacks.error(textStatus + ": " + errorThrown);
109907
- }
109908
- });
109909
- }
109910
-
109911
- // Private method to destroy a session
109912
- function destroySession(callbacks) {
109913
- callbacks = callbacks || {};
109914
- // FIXME This method triggers a success even when we fail
109915
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
109916
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
109917
- let unload = callbacks.unload === true;
109918
- let notifyDestroyed = true;
109919
- if (typeof callbacks.notifyDestroyed !== 'undefined' && callbacks.notifyDestroyed !== null) notifyDestroyed = callbacks.notifyDestroyed === true;
109920
- let cleanupHandles = callbacks.cleanupHandles === true;
109921
- Janus.log("Destroying session " + sessionId + " (unload=" + unload + ")");
109922
- if (!sessionId) {
109923
- Janus.warn("No session to destroy");
109924
- callbacks.success();
109925
- if (notifyDestroyed) gatewayCallbacks.destroyed();
109926
- return;
109927
- }
109928
- if (cleanupHandles) {
109929
- for (const handleId of pluginHandles.keys()) destroyHandle(handleId, {
109930
- noRequest: true
109931
- });
109932
- }
109933
- if (!connected) {
109934
- Janus.warn("Is the server down? (connected=false)");
109935
- sessionId = null;
109936
- callbacks.success();
109937
- return;
109938
- }
109939
- // No need to destroy all handles first, Janus will do that itself
109940
- let request = {
109941
- "janus": "destroy",
109942
- "transaction": Janus.randomString(12)
109943
- };
109944
- if (token) request["token"] = token;
109945
- if (apisecret) request["apisecret"] = apisecret;
109946
- if (unload) {
109947
- // We're unloading the page: use sendBeacon for HTTP instead,
109948
- // or just close the WebSocket connection if we're using that
109949
- if (websockets) {
109950
- ws.onclose = null;
109951
- ws.close();
109952
- ws = null;
109953
- } else {
109954
- navigator.sendBeacon(server + "/" + sessionId, JSON.stringify(request));
109955
- }
109956
- Janus.log("Destroyed session:");
109957
- sessionId = null;
109958
- connected = false;
109959
- callbacks.success();
109960
- if (notifyDestroyed) gatewayCallbacks.destroyed();
109961
- return;
109962
- }
109963
- if (websockets) {
109964
- request["session_id"] = sessionId;
109965
- let unbindWebSocket = function () {
109966
- for (let eventName in wsHandlers) {
109967
- ws.removeEventListener(eventName, wsHandlers[eventName]);
109968
- }
109969
- ws.removeEventListener('message', onUnbindMessage);
109970
- ws.removeEventListener('error', onUnbindError);
109971
- if (wsKeepaliveTimeoutId) {
109972
- clearTimeout(wsKeepaliveTimeoutId);
109973
- }
109974
- ws.close();
109975
- };
109976
- let onUnbindMessage = function (event) {
109977
- let data = JSON.parse(event.data);
109978
- if (data.session_id == request.session_id && data.transaction == request.transaction) {
109979
- unbindWebSocket();
109980
- callbacks.success();
109981
- if (notifyDestroyed) gatewayCallbacks.destroyed();
109982
- }
109983
- };
109984
- let onUnbindError = function () {
109985
- unbindWebSocket();
109986
- callbacks.error("Failed to destroy the server: Is the server down?");
109987
- if (notifyDestroyed) gatewayCallbacks.destroyed();
109988
- };
109989
- ws.addEventListener('message', onUnbindMessage);
109990
- ws.addEventListener('error', onUnbindError);
109991
- if (ws.readyState === 1) {
109992
- ws.send(JSON.stringify(request));
109993
- } else {
109994
- onUnbindError();
109995
- }
109996
- return;
109997
- }
109998
- Janus.httpAPICall(server + "/" + sessionId, {
109999
- verb: 'POST',
110000
- withCredentials: withCredentials,
110001
- body: request,
110002
- success: function (json) {
110003
- Janus.log("Destroyed session:");
110004
- Janus.debug(json);
110005
- sessionId = null;
110006
- connected = false;
110007
- if (json["janus"] !== "success") {
110008
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
110009
- }
110010
- callbacks.success();
110011
- if (notifyDestroyed) gatewayCallbacks.destroyed();
110012
- },
110013
- error: function (textStatus, errorThrown) {
110014
- Janus.error(textStatus + ":", errorThrown); // FIXME
110015
- // Reset everything anyway
110016
- sessionId = null;
110017
- connected = false;
110018
- callbacks.success();
110019
- if (notifyDestroyed) gatewayCallbacks.destroyed();
110020
- }
110021
- });
110022
- }
110023
-
110024
- // Private method to create a plugin handle
110025
- function createHandle(callbacks) {
110026
- callbacks = callbacks || {};
110027
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
110028
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
110029
- callbacks.dataChannelOptions = callbacks.dataChannelOptions || {
110030
- ordered: true
110031
- };
110032
- callbacks.consentDialog = typeof callbacks.consentDialog == "function" ? callbacks.consentDialog : Janus.noop;
110033
- callbacks.connectionState = typeof callbacks.connectionState == "function" ? callbacks.connectionState : Janus.noop;
110034
- callbacks.iceState = typeof callbacks.iceState == "function" ? callbacks.iceState : Janus.noop;
110035
- callbacks.mediaState = typeof callbacks.mediaState == "function" ? callbacks.mediaState : Janus.noop;
110036
- callbacks.webrtcState = typeof callbacks.webrtcState == "function" ? callbacks.webrtcState : Janus.noop;
110037
- callbacks.slowLink = typeof callbacks.slowLink == "function" ? callbacks.slowLink : Janus.noop;
110038
- callbacks.onmessage = typeof callbacks.onmessage == "function" ? callbacks.onmessage : Janus.noop;
110039
- callbacks.onlocaltrack = typeof callbacks.onlocaltrack == "function" ? callbacks.onlocaltrack : Janus.noop;
110040
- callbacks.onremotetrack = typeof callbacks.onremotetrack == "function" ? callbacks.onremotetrack : Janus.noop;
110041
- callbacks.ondata = typeof callbacks.ondata == "function" ? callbacks.ondata : Janus.noop;
110042
- callbacks.ondataopen = typeof callbacks.ondataopen == "function" ? callbacks.ondataopen : Janus.noop;
110043
- callbacks.oncleanup = typeof callbacks.oncleanup == "function" ? callbacks.oncleanup : Janus.noop;
110044
- callbacks.ondetached = typeof callbacks.ondetached == "function" ? callbacks.ondetached : Janus.noop;
110045
- if (!connected) {
110046
- Janus.warn("Is the server down? (connected=false)");
110047
- callbacks.error("Is the server down? (connected=false)");
110048
- return;
110049
- }
110050
- let plugin = callbacks.plugin;
110051
- if (!plugin) {
110052
- Janus.error("Invalid plugin");
110053
- callbacks.error("Invalid plugin");
110054
- return;
110055
- }
110056
- let opaqueId = callbacks.opaqueId;
110057
- let loopIndex = callbacks.loopIndex;
110058
- let handleToken = callbacks.token ? callbacks.token : token;
110059
- let transaction = Janus.randomString(12);
110060
- let request = {
110061
- "janus": "attach",
110062
- "plugin": plugin,
110063
- "opaque_id": opaqueId,
110064
- "loop_index": loopIndex,
110065
- "transaction": transaction
110066
- };
110067
- if (handleToken) request["token"] = handleToken;
110068
- if (apisecret) request["apisecret"] = apisecret;
110069
- if (websockets) {
110070
- transactions.set(transaction, function (json) {
110071
- Janus.debug(json);
110072
- if (json["janus"] !== "success") {
110073
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
110074
- callbacks.error("Ooops: " + json["error"].code + " " + json["error"].reason);
110075
- return;
110076
- }
110077
- let handleId = json.data["id"];
110078
- Janus.log("Created handle: " + handleId);
110079
- let pluginHandle = {
110080
- session: that,
110081
- plugin: plugin,
110082
- id: handleId,
110083
- token: handleToken,
110084
- detached: false,
110085
- webrtcStuff: {
110086
- started: false,
110087
- myStream: null,
110088
- streamExternal: false,
110089
- mySdp: null,
110090
- mediaConstraints: null,
110091
- pc: null,
110092
- dataChannelOptions: callbacks.dataChannelOptions,
110093
- dataChannel: {},
110094
- dtmfSender: null,
110095
- trickle: true,
110096
- iceDone: false,
110097
- bitrate: {}
110098
- },
110099
- getId: function () {
110100
- return handleId;
110101
- },
110102
- getPlugin: function () {
110103
- return plugin;
110104
- },
110105
- getVolume: function (mid, result) {
110106
- return getVolume(handleId, mid, true, result);
110107
- },
110108
- getRemoteVolume: function (mid, result) {
110109
- return getVolume(handleId, mid, true, result);
110110
- },
110111
- getLocalVolume: function (mid, result) {
110112
- return getVolume(handleId, mid, false, result);
110113
- },
110114
- isAudioMuted: function (mid) {
110115
- return isMuted(handleId, mid, false);
110116
- },
110117
- muteAudio: function (mid) {
110118
- return mute(handleId, mid, false, true);
110119
- },
110120
- unmuteAudio: function (mid) {
110121
- return mute(handleId, mid, false, false);
110122
- },
110123
- isVideoMuted: function (mid) {
110124
- return isMuted(handleId, mid, true);
110125
- },
110126
- muteVideo: function (mid) {
110127
- return mute(handleId, mid, true, true);
110128
- },
110129
- unmuteVideo: function (mid) {
110130
- return mute(handleId, mid, true, false);
110131
- },
110132
- getBitrate: function (mid) {
110133
- return getBitrate(handleId, mid);
110134
- },
110135
- setMaxBitrate: function (mid, bitrate) {
110136
- return setBitrate(handleId, mid, bitrate);
110137
- },
110138
- send: function (callbacks) {
110139
- sendMessage(handleId, callbacks);
110140
- },
110141
- data: function (callbacks) {
110142
- sendData(handleId, callbacks);
110143
- },
110144
- dtmf: function (callbacks) {
110145
- sendDtmf(handleId, callbacks);
110146
- },
110147
- consentDialog: callbacks.consentDialog,
110148
- connectionState: callbacks.connectionState,
110149
- iceState: callbacks.iceState,
110150
- mediaState: callbacks.mediaState,
110151
- webrtcState: callbacks.webrtcState,
110152
- slowLink: callbacks.slowLink,
110153
- onmessage: callbacks.onmessage,
110154
- createOffer: function (callbacks) {
110155
- prepareWebrtc(handleId, true, callbacks);
110156
- },
110157
- createAnswer: function (callbacks) {
110158
- prepareWebrtc(handleId, false, callbacks);
110159
- },
110160
- handleRemoteJsep: function (callbacks) {
110161
- prepareWebrtcPeer(handleId, callbacks);
110162
- },
110163
- replaceTracks: function (callbacks) {
110164
- replaceTracks(handleId, callbacks);
110165
- },
110166
- getLocalTracks: function () {
110167
- return getLocalTracks(handleId);
110168
- },
110169
- getRemoteTracks: function () {
110170
- return getRemoteTracks(handleId);
110171
- },
110172
- onlocaltrack: callbacks.onlocaltrack,
110173
- onremotetrack: callbacks.onremotetrack,
110174
- ondata: callbacks.ondata,
110175
- ondataopen: callbacks.ondataopen,
110176
- oncleanup: callbacks.oncleanup,
110177
- ondetached: callbacks.ondetached,
110178
- hangup: function (sendRequest) {
110179
- cleanupWebrtc(handleId, sendRequest === true);
110180
- },
110181
- detach: function (callbacks) {
110182
- destroyHandle(handleId, callbacks);
110183
- }
110184
- };
110185
- pluginHandles.set(handleId, pluginHandle);
110186
- callbacks.success(pluginHandle);
110187
- });
110188
- request["session_id"] = sessionId;
110189
- ws.send(JSON.stringify(request));
110190
- return;
110191
- }
110192
- Janus.httpAPICall(server + "/" + sessionId, {
110193
- verb: 'POST',
110194
- withCredentials: withCredentials,
110195
- body: request,
110196
- success: function (json) {
110197
- Janus.debug(json);
110198
- if (json["janus"] !== "success") {
110199
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
110200
- callbacks.error("Ooops: " + json["error"].code + " " + json["error"].reason);
110201
- return;
110202
- }
110203
- let handleId = json.data["id"];
110204
- Janus.log("Created handle: " + handleId);
110205
- let pluginHandle = {
110206
- session: that,
110207
- plugin: plugin,
110208
- id: handleId,
110209
- token: handleToken,
110210
- detached: false,
110211
- webrtcStuff: {
110212
- started: false,
110213
- myStream: null,
110214
- streamExternal: false,
110215
- mySdp: null,
110216
- mediaConstraints: null,
110217
- pc: null,
110218
- dataChannelOptions: callbacks.dataChannelOptions,
110219
- dataChannel: {},
110220
- dtmfSender: null,
110221
- trickle: true,
110222
- iceDone: false,
110223
- bitrate: {}
110224
- },
110225
- getId: function () {
110226
- return handleId;
110227
- },
110228
- getPlugin: function () {
110229
- return plugin;
110230
- },
110231
- getVolume: function (mid, result) {
110232
- return getVolume(handleId, mid, true, result);
110233
- },
110234
- getRemoteVolume: function (mid, result) {
110235
- return getVolume(handleId, mid, true, result);
110236
- },
110237
- getLocalVolume: function (mid, result) {
110238
- return getVolume(handleId, mid, false, result);
110239
- },
110240
- isAudioMuted: function (mid) {
110241
- return isMuted(handleId, mid, false);
110242
- },
110243
- muteAudio: function (mid) {
110244
- return mute(handleId, mid, false, true);
110245
- },
110246
- unmuteAudio: function (mid) {
110247
- return mute(handleId, mid, false, false);
110248
- },
110249
- isVideoMuted: function (mid) {
110250
- return isMuted(handleId, mid, true);
110251
- },
110252
- muteVideo: function (mid) {
110253
- return mute(handleId, mid, true, true);
110254
- },
110255
- unmuteVideo: function (mid) {
110256
- return mute(handleId, mid, true, false);
110257
- },
110258
- getBitrate: function (mid) {
110259
- return getBitrate(handleId, mid);
110260
- },
110261
- setMaxBitrate: function (mid, bitrate) {
110262
- return setBitrate(handleId, mid, bitrate);
110263
- },
110264
- send: function (callbacks) {
110265
- sendMessage(handleId, callbacks);
110266
- },
110267
- data: function (callbacks) {
110268
- sendData(handleId, callbacks);
110269
- },
110270
- dtmf: function (callbacks) {
110271
- sendDtmf(handleId, callbacks);
110272
- },
110273
- consentDialog: callbacks.consentDialog,
110274
- connectionState: callbacks.connectionState,
110275
- iceState: callbacks.iceState,
110276
- mediaState: callbacks.mediaState,
110277
- webrtcState: callbacks.webrtcState,
110278
- slowLink: callbacks.slowLink,
110279
- onmessage: callbacks.onmessage,
110280
- createOffer: function (callbacks) {
110281
- prepareWebrtc(handleId, true, callbacks);
110282
- },
110283
- createAnswer: function (callbacks) {
110284
- prepareWebrtc(handleId, false, callbacks);
110285
- },
110286
- handleRemoteJsep: function (callbacks) {
110287
- prepareWebrtcPeer(handleId, callbacks);
110288
- },
110289
- replaceTracks: function (callbacks) {
110290
- replaceTracks(handleId, callbacks);
110291
- },
110292
- getLocalTracks: function () {
110293
- return getLocalTracks(handleId);
110294
- },
110295
- getRemoteTracks: function () {
110296
- return getRemoteTracks(handleId);
110297
- },
110298
- onlocaltrack: callbacks.onlocaltrack,
110299
- onremotetrack: callbacks.onremotetrack,
110300
- ondata: callbacks.ondata,
110301
- ondataopen: callbacks.ondataopen,
110302
- oncleanup: callbacks.oncleanup,
110303
- ondetached: callbacks.ondetached,
110304
- hangup: function (sendRequest) {
110305
- cleanupWebrtc(handleId, sendRequest === true);
110306
- },
110307
- detach: function (callbacks) {
110308
- destroyHandle(handleId, callbacks);
110309
- }
110310
- };
110311
- pluginHandles.set(handleId, pluginHandle);
110312
- callbacks.success(pluginHandle);
110313
- },
110314
- error: function (textStatus, errorThrown) {
110315
- Janus.error(textStatus + ":", errorThrown); // FIXME
110316
- if (errorThrown === "") callbacks.error(textStatus + ": Is the server down?");else callbacks.error(textStatus + ": " + errorThrown);
110317
- }
110318
- });
110319
- }
110320
-
110321
- // Private method to send a message
110322
- function sendMessage(handleId, callbacks) {
110323
- callbacks = callbacks || {};
110324
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
110325
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
110326
- if (!connected) {
110327
- Janus.warn("Is the server down? (connected=false)");
110328
- callbacks.error("Is the server down? (connected=false)");
110329
- return;
110330
- }
110331
- let pluginHandle = pluginHandles.get(handleId);
110332
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
110333
- Janus.warn("Invalid handle");
110334
- callbacks.error("Invalid handle");
110335
- return;
110336
- }
110337
- let message = callbacks.message;
110338
- let jsep = callbacks.jsep;
110339
- let transaction = Janus.randomString(12);
110340
- let request = {
110341
- "janus": "message",
110342
- "body": message,
110343
- "transaction": transaction
110344
- };
110345
- if (pluginHandle.token) request["token"] = pluginHandle.token;
110346
- if (apisecret) request["apisecret"] = apisecret;
110347
- if (jsep) {
110348
- request.jsep = {
110349
- type: jsep.type,
110350
- sdp: jsep.sdp
110351
- };
110352
- if (jsep.e2ee) request.jsep.e2ee = true;
110353
- if (jsep.rid_order === "hml" || jsep.rid_order === "lmh") request.jsep.rid_order = jsep.rid_order;
110354
- if (jsep.force_relay) request.jsep.force_relay = true;
110355
- // Check if there's SVC video streams to tell Janus about
110356
- let svc = null;
110357
- let config = pluginHandle.webrtcStuff;
110358
- if (config.pc) {
110359
- let transceivers = config.pc.getTransceivers();
110360
- if (transceivers && transceivers.length > 0) {
110361
- for (let mindex in transceivers) {
110362
- let tr = transceivers[mindex];
110363
- if (tr && tr.sender && tr.sender.track && tr.sender.track.kind === 'video') {
110364
- let params = tr.sender.getParameters();
110365
- if (params && params.encodings && params.encodings.length === 1 && params.encodings[0] && params.encodings[0].scalabilityMode) {
110366
- // This video stream uses SVC
110367
- if (!svc) svc = [];
110368
- svc.push({
110369
- mindex: parseInt(mindex),
110370
- mid: tr.mid,
110371
- svc: params.encodings[0].scalabilityMode
110372
- });
110373
- }
110374
- }
110375
- }
110376
- }
110377
- }
110378
- if (svc) request.jsep.svc = svc;
110379
- }
110380
- Janus.debug("Sending message to plugin (handle=" + handleId + "):");
110381
- Janus.debug(request);
110382
- if (websockets) {
110383
- request["session_id"] = sessionId;
110384
- request["handle_id"] = handleId;
110385
- transactions.set(transaction, function (json) {
110386
- Janus.debug("Message sent!");
110387
- Janus.debug(json);
110388
- if (json["janus"] === "success") {
110389
- // We got a success, must have been a synchronous transaction
110390
- let plugindata = json["plugindata"];
110391
- if (!plugindata) {
110392
- Janus.warn("Request succeeded, but missing plugindata...");
110393
- callbacks.success();
110394
- return;
110395
- }
110396
- Janus.log("Synchronous transaction successful (" + plugindata["plugin"] + ")");
110397
- let data = plugindata["data"];
110398
- Janus.debug(data);
110399
- callbacks.success(data);
110400
- return;
110401
- } else if (json["janus"] !== "ack") {
110402
- // Not a success and not an ack, must be an error
110403
- if (json["error"]) {
110404
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
110405
- callbacks.error(json["error"].code + " " + json["error"].reason);
110406
- } else {
110407
- Janus.error("Unknown error"); // FIXME
110408
- callbacks.error("Unknown error");
110409
- }
110410
- return;
110411
- }
110412
- // If we got here, the plugin decided to handle the request asynchronously
110413
- callbacks.success();
110414
- });
110415
- ws.send(JSON.stringify(request));
110416
- return;
110417
- }
110418
- Janus.httpAPICall(server + "/" + sessionId + "/" + handleId, {
110419
- verb: 'POST',
110420
- withCredentials: withCredentials,
110421
- body: request,
110422
- success: function (json) {
110423
- Janus.debug("Message sent!");
110424
- Janus.debug(json);
110425
- if (json["janus"] === "success") {
110426
- // We got a success, must have been a synchronous transaction
110427
- let plugindata = json["plugindata"];
110428
- if (!plugindata) {
110429
- Janus.warn("Request succeeded, but missing plugindata...");
110430
- callbacks.success();
110431
- return;
110432
- }
110433
- Janus.log("Synchronous transaction successful (" + plugindata["plugin"] + ")");
110434
- let data = plugindata["data"];
110435
- Janus.debug(data);
110436
- callbacks.success(data);
110437
- return;
110438
- } else if (json["janus"] !== "ack") {
110439
- // Not a success and not an ack, must be an error
110440
- if (json["error"]) {
110441
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
110442
- callbacks.error(json["error"].code + " " + json["error"].reason);
110443
- } else {
110444
- Janus.error("Unknown error"); // FIXME
110445
- callbacks.error("Unknown error");
110446
- }
110447
- return;
110448
- }
110449
- // If we got here, the plugin decided to handle the request asynchronously
110450
- callbacks.success();
110451
- },
110452
- error: function (textStatus, errorThrown) {
110453
- Janus.error(textStatus + ":", errorThrown); // FIXME
110454
- callbacks.error(textStatus + ": " + errorThrown);
110455
- }
110456
- });
110457
- }
110458
-
110459
- // Private method to send a trickle candidate
110460
- function sendTrickleCandidate(handleId, candidate) {
110461
- if (!connected) {
110462
- Janus.warn("Is the server down? (connected=false)");
110463
- return;
110464
- }
110465
- let pluginHandle = pluginHandles.get(handleId);
110466
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
110467
- Janus.warn("Invalid handle");
110468
- return;
110469
- }
110470
- let request = {
110471
- "janus": "trickle",
110472
- "candidate": candidate,
110473
- "transaction": Janus.randomString(12)
110474
- };
110475
- if (pluginHandle.token) request["token"] = pluginHandle.token;
110476
- if (apisecret) request["apisecret"] = apisecret;
110477
- Janus.vdebug("Sending trickle candidate (handle=" + handleId + "):");
110478
- Janus.vdebug(request);
110479
- if (websockets) {
110480
- request["session_id"] = sessionId;
110481
- request["handle_id"] = handleId;
110482
- ws.send(JSON.stringify(request));
110483
- return;
110484
- }
110485
- Janus.httpAPICall(server + "/" + sessionId + "/" + handleId, {
110486
- verb: 'POST',
110487
- withCredentials: withCredentials,
110488
- body: request,
110489
- success: function (json) {
110490
- Janus.vdebug("Candidate sent!");
110491
- Janus.vdebug(json);
110492
- if (json["janus"] !== "ack") {
110493
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
110494
- return;
110495
- }
110496
- },
110497
- error: function (textStatus, errorThrown) {
110498
- Janus.error(textStatus + ":", errorThrown); // FIXME
110499
- }
110500
- });
110501
- }
110502
-
110503
- // Private method to create a data channel
110504
- function createDataChannel(handleId, dclabel, dcprotocol, incoming, pendingData) {
110505
- let pluginHandle = pluginHandles.get(handleId);
110506
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
110507
- Janus.warn("Invalid handle");
110508
- return;
110509
- }
110510
- let config = pluginHandle.webrtcStuff;
110511
- if (!config.pc) {
110512
- Janus.warn("Invalid PeerConnection");
110513
- return;
110514
- }
110515
- let onDataChannelMessage = function (event) {
110516
- Janus.log('Received message on data channel:', event);
110517
- let label = event.target.label;
110518
- pluginHandle.ondata(event.data, label);
110519
- };
110520
- let onDataChannelStateChange = function (event) {
110521
- Janus.log('Received state change on data channel:', event);
110522
- let label = event.target.label;
110523
- let protocol = event.target.protocol;
110524
- let dcState = config.dataChannel[label] ? config.dataChannel[label].readyState : "null";
110525
- Janus.log('State change on <' + label + '> data channel: ' + dcState);
110526
- if (dcState === 'open') {
110527
- // Any pending messages to send?
110528
- if (config.dataChannel[label].pending && config.dataChannel[label].pending.length > 0) {
110529
- Janus.log("Sending pending messages on <" + label + ">:", config.dataChannel[label].pending.length);
110530
- for (let data of config.dataChannel[label].pending) {
110531
- Janus.log("Sending data on data channel <" + label + ">");
110532
- Janus.debug(data);
110533
- config.dataChannel[label].send(data);
110534
- }
110535
- config.dataChannel[label].pending = [];
110536
- }
110537
- // Notify the open data channel
110538
- pluginHandle.ondataopen(label, protocol);
110539
- }
110540
- };
110541
- let onDataChannelError = function (error) {
110542
- Janus.error('Got error on data channel:', error);
110543
- // TODO
110544
- };
110545
- if (!incoming) {
110546
- // FIXME Add options (ordered, maxRetransmits, etc.)
110547
- let dcoptions = config.dataChannelOptions;
110548
- if (dcprotocol) dcoptions.protocol = dcprotocol;
110549
- config.dataChannel[dclabel] = config.pc.createDataChannel(dclabel, dcoptions);
110550
- } else {
110551
- // The channel was created by Janus
110552
- config.dataChannel[dclabel] = incoming;
110553
- }
110554
- config.dataChannel[dclabel].onmessage = onDataChannelMessage;
110555
- config.dataChannel[dclabel].onopen = onDataChannelStateChange;
110556
- config.dataChannel[dclabel].onclose = onDataChannelStateChange;
110557
- config.dataChannel[dclabel].onerror = onDataChannelError;
110558
- config.dataChannel[dclabel].pending = [];
110559
- if (pendingData) config.dataChannel[dclabel].pending.push(pendingData);
110560
- }
110561
-
110562
- // Private method to send a data channel message
110563
- function sendData(handleId, callbacks) {
110564
- callbacks = callbacks || {};
110565
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
110566
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
110567
- let pluginHandle = pluginHandles.get(handleId);
110568
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
110569
- Janus.warn("Invalid handle");
110570
- callbacks.error("Invalid handle");
110571
- return;
110572
- }
110573
- let config = pluginHandle.webrtcStuff;
110574
- let data = callbacks.text || callbacks.data;
110575
- if (!data) {
110576
- Janus.warn("Invalid data");
110577
- callbacks.error("Invalid data");
110578
- return;
110579
- }
110580
- let label = callbacks.label ? callbacks.label : Janus.dataChanDefaultLabel;
110581
- if (!config.dataChannel[label]) {
110582
- // Create new data channel and wait for it to open
110583
- createDataChannel(handleId, label, callbacks.protocol, false, data, callbacks.protocol);
110584
- callbacks.success();
110585
- return;
110586
- }
110587
- if (config.dataChannel[label].readyState !== "open") {
110588
- config.dataChannel[label].pending.push(data);
110589
- callbacks.success();
110590
- return;
110591
- }
110592
- Janus.log("Sending data on data channel <" + label + ">");
110593
- Janus.debug(data);
110594
- config.dataChannel[label].send(data);
110595
- callbacks.success();
110596
- }
110597
-
110598
- // Private method to send a DTMF tone
110599
- function sendDtmf(handleId, callbacks) {
110600
- callbacks = callbacks || {};
110601
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
110602
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
110603
- let pluginHandle = pluginHandles.get(handleId);
110604
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
110605
- Janus.warn("Invalid handle");
110606
- callbacks.error("Invalid handle");
110607
- return;
110608
- }
110609
- let config = pluginHandle.webrtcStuff;
110610
- if (!config.dtmfSender) {
110611
- // Create the DTMF sender the proper way, if possible
110612
- if (config.pc) {
110613
- let senders = config.pc.getSenders();
110614
- let audioSender = senders.find(function (sender) {
110615
- return sender.track && sender.track.kind === 'audio';
110616
- });
110617
- if (!audioSender) {
110618
- Janus.warn("Invalid DTMF configuration (no audio track)");
110619
- callbacks.error("Invalid DTMF configuration (no audio track)");
110620
- return;
110621
- }
110622
- config.dtmfSender = audioSender.dtmf;
110623
- if (config.dtmfSender) {
110624
- Janus.log("Created DTMF Sender");
110625
- config.dtmfSender.ontonechange = function (tone) {
110626
- Janus.debug("Sent DTMF tone: " + tone.tone);
110627
- };
110628
- }
110629
- }
110630
- if (!config.dtmfSender) {
110631
- Janus.warn("Invalid DTMF configuration");
110632
- callbacks.error("Invalid DTMF configuration");
110633
- return;
110634
- }
110635
- }
110636
- let dtmf = callbacks.dtmf;
110637
- if (!dtmf) {
110638
- Janus.warn("Invalid DTMF parameters");
110639
- callbacks.error("Invalid DTMF parameters");
110640
- return;
110641
- }
110642
- let tones = dtmf.tones;
110643
- if (!tones) {
110644
- Janus.warn("Invalid DTMF string");
110645
- callbacks.error("Invalid DTMF string");
110646
- return;
110647
- }
110648
- let duration = typeof dtmf.duration === 'number' ? dtmf.duration : 500; // We choose 500ms as the default duration for a tone
110649
- let gap = typeof dtmf.gap === 'number' ? dtmf.gap : 50; // We choose 50ms as the default gap between tones
110650
- Janus.debug("Sending DTMF string " + tones + " (duration " + duration + "ms, gap " + gap + "ms)");
110651
- config.dtmfSender.insertDTMF(tones, duration, gap);
110652
- callbacks.success();
110653
- }
110654
-
110655
- // Private method to destroy a plugin handle
110656
- function destroyHandle(handleId, callbacks) {
110657
- callbacks = callbacks || {};
110658
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
110659
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
110660
- let noRequest = callbacks.noRequest === true;
110661
- Janus.log("Destroying handle " + handleId + " (only-locally=" + noRequest + ")");
110662
- cleanupWebrtc(handleId);
110663
- let pluginHandle = pluginHandles.get(handleId);
110664
- if (!pluginHandle || pluginHandle.detached) {
110665
- // Plugin was already detached by Janus, calling detach again will return a handle not found error, so just exit here
110666
- pluginHandles.delete(handleId);
110667
- callbacks.success();
110668
- return;
110669
- }
110670
- pluginHandle.detached = true;
110671
- if (noRequest) {
110672
- // We're only removing the handle locally
110673
- pluginHandles.delete(handleId);
110674
- callbacks.success();
110675
- return;
110676
- }
110677
- if (!connected) {
110678
- Janus.warn("Is the server down? (connected=false)");
110679
- callbacks.error("Is the server down? (connected=false)");
110680
- return;
110681
- }
110682
- let request = {
110683
- "janus": "detach",
110684
- "transaction": Janus.randomString(12)
110685
- };
110686
- if (pluginHandle.token) request["token"] = pluginHandle.token;
110687
- if (apisecret) request["apisecret"] = apisecret;
110688
- if (websockets) {
110689
- request["session_id"] = sessionId;
110690
- request["handle_id"] = handleId;
110691
- ws.send(JSON.stringify(request));
110692
- pluginHandles.delete(handleId);
110693
- callbacks.success();
110694
- return;
110695
- }
110696
- Janus.httpAPICall(server + "/" + sessionId + "/" + handleId, {
110697
- verb: 'POST',
110698
- withCredentials: withCredentials,
110699
- body: request,
110700
- success: function (json) {
110701
- Janus.log("Destroyed handle:");
110702
- Janus.debug(json);
110703
- if (json["janus"] !== "success") {
110704
- Janus.error("Ooops: " + json["error"].code + " " + json["error"].reason); // FIXME
110705
- }
110706
- pluginHandles.delete(handleId);
110707
- callbacks.success();
110708
- },
110709
- error: function (textStatus, errorThrown) {
110710
- Janus.error(textStatus + ":", errorThrown); // FIXME
110711
- // We cleanup anyway
110712
- pluginHandles.delete(handleId);
110713
- callbacks.success();
110714
- }
110715
- });
110716
- }
110717
-
110718
- // WebRTC stuff
110719
- // Helper function to create a new PeerConnection, if we need one
110720
- function createPeerconnectionIfNeeded(handleId, callbacks) {
110721
- let pluginHandle = pluginHandles.get(handleId);
110722
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
110723
- Janus.warn("Invalid handle");
110724
- throw "Invalid handle";
110725
- }
110726
- let config = pluginHandle.webrtcStuff;
110727
- if (config.pc) {
110728
- // Nothing to do, we have a PeerConnection already
110729
- return;
110730
- }
110731
- let pc_config = {
110732
- iceServers: iceServers,
110733
- iceTransportPolicy: iceTransportPolicy,
110734
- bundlePolicy: bundlePolicy
110735
- };
110736
- pc_config.sdpSemantics = 'unified-plan';
110737
- // Check if a sender or receiver transform has been provided
110738
- let insertableStreams = false;
110739
- if (callbacks.tracks) {
110740
- for (let track of callbacks.tracks) {
110741
- if (track.transforms && (track.transforms.sender || track.transforms.receiver)) {
110742
- insertableStreams = true;
110743
- break;
110744
- }
110745
- }
110746
- }
110747
- if (callbacks.externalEncryption) {
110748
- insertableStreams = true;
110749
- config.externalEncryption = true;
110750
- }
110751
- if (RTCRtpSender && (RTCRtpSender.prototype.createEncodedStreams || RTCRtpSender.prototype.createEncodedAudioStreams && RTCRtpSender.prototype.createEncodedVideoStreams) && insertableStreams) {
110752
- config.insertableStreams = true;
110753
- pc_config.forceEncodedAudioInsertableStreams = true;
110754
- pc_config.forceEncodedVideoInsertableStreams = true;
110755
- pc_config.encodedInsertableStreams = true;
110756
- }
110757
- Janus.log('Creating PeerConnection');
110758
- config.pc = new RTCPeerConnection(pc_config);
110759
- Janus.debug(config.pc);
110760
- if (config.pc.getStats) {
110761
- // FIXME
110762
- config.volume = {};
110763
- config.bitrate.value = '0 kbits/sec';
110764
- }
110765
- Janus.log('Preparing local SDP and gathering candidates (trickle=' + config.trickle + ')');
110766
- config.pc.onconnectionstatechange = function () {
110767
- if (config.pc) pluginHandle.connectionState(config.pc.connectionState);
110768
- };
110769
- config.pc.oniceconnectionstatechange = function () {
110770
- if (config.pc) pluginHandle.iceState(config.pc.iceConnectionState);
110771
- };
110772
- config.pc.onicecandidate = function (event) {
110773
- if (!event.candidate || event.candidate.candidate && event.candidate.candidate.indexOf('endOfCandidates') > 0) {
110774
- Janus.log('End of candidates.');
110775
- config.iceDone = true;
110776
- if (config.trickle === true) {
110777
- // Notify end of candidates
110778
- sendTrickleCandidate(handleId, {
110779
- completed: true
110780
- });
110781
- } else {
110782
- // No trickle, time to send the complete SDP (including all candidates)
110783
- sendSDP(handleId, callbacks);
110784
- }
110785
- } else {
110786
- // JSON.stringify doesn't work on some WebRTC objects anymore
110787
- // See https://code.google.com/p/chromium/issues/detail?id=467366
110788
- let candidate = {
110789
- candidate: event.candidate.candidate,
110790
- sdpMid: event.candidate.sdpMid,
110791
- sdpMLineIndex: event.candidate.sdpMLineIndex
110792
- };
110793
- if (config.trickle === true) {
110794
- // Send candidate
110795
- sendTrickleCandidate(handleId, candidate);
110796
- }
110797
- }
110798
- };
110799
- config.pc.ontrack = function (event) {
110800
- Janus.log('Handling Remote Track', event);
110801
- if (!event.streams) return;
110802
- if (!event.track) return;
110803
- // Notify about the new track event
110804
- let mid = event.transceiver ? event.transceiver.mid : event.track.id;
110805
- try {
110806
- if (event.transceiver && event.transceiver.mid && event.track.id) {
110807
- // Keep track of the mapping between track ID and mid, since
110808
- // when a track is removed the transceiver may be gone already
110809
- if (!pluginHandle.mids) pluginHandle.mids = {};
110810
- pluginHandle.mids[event.track.id] = event.transceiver.mid;
110811
- }
110812
- pluginHandle.onremotetrack(event.track, mid, true, {
110813
- reason: 'created'
110814
- });
110815
- } catch (e) {
110816
- Janus.error("Error calling onremotetrack", e);
110817
- }
110818
- if (event.track.onended) return;
110819
- let trackMutedTimeoutId = null;
110820
- Janus.log('Adding onended callback to track:', event.track);
110821
- event.track.onended = function (ev) {
110822
- Janus.log('Remote track removed:', ev);
110823
- clearTimeout(trackMutedTimeoutId);
110824
- // Notify the application
110825
- let transceivers = config.pc ? config.pc.getTransceivers() : null;
110826
- let transceiver = transceivers ? transceivers.find(t => t.receiver.track === ev.target) : null;
110827
- let mid = transceiver ? transceiver.mid : ev.target.id;
110828
- if (mid === ev.target.id && pluginHandle.mids && pluginHandle.mids[event.track.id]) mid = pluginHandle.mids[event.track.id];
110829
- try {
110830
- pluginHandle.onremotetrack(ev.target, mid, false, {
110831
- reason: 'ended'
110832
- });
110833
- } catch (e) {
110834
- Janus.error("Error calling onremotetrack on removal", e);
110835
- }
110836
- delete pluginHandle.mids[event.track.id];
110837
- };
110838
- event.track.onmute = function (ev) {
110839
- Janus.log('Remote track muted:', ev);
110840
- if (!trackMutedTimeoutId) {
110841
- trackMutedTimeoutId = setTimeout(function () {
110842
- Janus.log('Removing remote track');
110843
- // Notify the application the track is gone
110844
- let transceivers = config.pc ? config.pc.getTransceivers() : null;
110845
- let transceiver = transceivers ? transceivers.find(t => t.receiver.track === ev.target) : null;
110846
- let mid = transceiver ? transceiver.mid : ev.target.id;
110847
- if (mid === ev.target.id && pluginHandle.mids && pluginHandle.mids[event.track.id]) mid = pluginHandle.mids[event.track.id];
110848
- try {
110849
- pluginHandle.onremotetrack(ev.target, mid, false, {
110850
- reason: 'mute'
110851
- });
110852
- } catch (e) {
110853
- Janus.error("Error calling onremotetrack on mute", e);
110854
- }
110855
- trackMutedTimeoutId = null;
110856
- // Chrome seems to raise mute events only at multiples of 834ms;
110857
- // we set the timeout to three times this value (rounded to 840ms)
110858
- }, 3 * 840);
110859
- }
110860
- };
110861
- event.track.onunmute = function (ev) {
110862
- Janus.log('Remote track flowing again:', ev);
110863
- if (trackMutedTimeoutId != null) {
110864
- clearTimeout(trackMutedTimeoutId);
110865
- trackMutedTimeoutId = null;
110866
- } else {
110867
- try {
110868
- // Notify the application the track is back
110869
- let transceivers = config.pc ? config.pc.getTransceivers() : null;
110870
- let transceiver = transceivers ? transceivers.find(t => t.receiver.track === ev.target) : null;
110871
- let mid = transceiver ? transceiver.mid : ev.target.id;
110872
- pluginHandle.onremotetrack(ev.target, mid, true, {
110873
- reason: 'unmute'
110874
- });
110875
- } catch (e) {
110876
- Janus.error("Error calling onremotetrack on unmute", e);
110877
- }
110878
- }
110879
- };
110880
- };
110881
- }
110882
-
110883
- // Helper function used when creating either an offer or answer: it
110884
- // prepares what needs to be prepared, including creating a new
110885
- // PeerConnection (if needed) and updating the tracks configuration,
110886
- // before invoking the function to actually generate the offer/answer
110887
- async function prepareWebrtc(handleId, offer, callbacks) {
110888
- callbacks = callbacks || {};
110889
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
110890
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : webrtcError;
110891
- let jsep = callbacks.jsep;
110892
- if (offer && jsep) {
110893
- Janus.error("Provided a JSEP to a createOffer");
110894
- callbacks.error("Provided a JSEP to a createOffer");
110895
- return;
110896
- } else if (!offer && (!jsep || !jsep.type || !jsep.sdp)) {
110897
- Janus.error("A valid JSEP is required for createAnswer");
110898
- callbacks.error("A valid JSEP is required for createAnswer");
110899
- return;
110900
- }
110901
- // If the deprecated media was provided instead of tracks, translate it
110902
- if (callbacks.media && !callbacks.tracks) {
110903
- callbacks.tracks = Janus.mediaToTracks(callbacks.media);
110904
- if (callbacks.simulcast === true || callbacks.simulcast2 === true || callbacks.svc) {
110905
- // Find the video track and add simulcast/SVC info there
110906
- for (let track of callbacks.tracks) {
110907
- if (track.type === 'video') {
110908
- if (callbacks.simulcast === true || callbacks.simulcast2 === true) track.simulcast = true;else if (callbacks.svc) track.svc = callbacks.svc;
110909
- break;
110910
- }
110911
- }
110912
- }
110913
- Janus.warn('Deprecated media object passed, use tracks instead. Automatically translated to:', callbacks.tracks);
110914
- }
110915
- // Check that callbacks.array is a valid array
110916
- if (callbacks.tracks && !Array.isArray(callbacks.tracks)) {
110917
- Janus.error("Tracks must be an array");
110918
- callbacks.error("Tracks must be an array");
110919
- return;
110920
- }
110921
- // Get the plugin handle
110922
- let pluginHandle = pluginHandles.get(handleId);
110923
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
110924
- Janus.warn("Invalid handle");
110925
- callbacks.error("Invalid handle");
110926
- return;
110927
- }
110928
- let config = pluginHandle.webrtcStuff;
110929
- config.trickle = isTrickleEnabled(callbacks.trickle);
110930
- try {
110931
- // Create a PeerConnection, if needed
110932
- createPeerconnectionIfNeeded(handleId, callbacks);
110933
- if (offer) {
110934
- // Capture devices and setup tracks, if needed
110935
- await captureDevices(handleId, callbacks);
110936
- }
110937
- // Create offer or answer now (depending on the context)
110938
- if (!jsep) {
110939
- let offer = await createOffer(handleId, callbacks);
110940
- callbacks.success(offer);
110941
- } else {
110942
- await config.pc.setRemoteDescription(jsep);
110943
- Janus.log("Remote description accepted!");
110944
- config.remoteSdp = jsep.sdp;
110945
- // Any trickle candidate we cached?
110946
- if (config.candidates && config.candidates.length > 0) {
110947
- for (let i = 0; i < config.candidates.length; i++) {
110948
- let candidate = config.candidates[i];
110949
- Janus.debug("Adding remote candidate:", candidate);
110950
- if (!candidate || candidate.completed === true) {
110951
- // end-of-candidates
110952
- config.pc.addIceCandidate(Janus.endOfCandidates);
110953
- } else {
110954
- // New candidate
110955
- config.pc.addIceCandidate(candidate);
110956
- }
110957
- }
110958
- config.candidates = [];
110959
- }
110960
- // Capture devices and setup tracks, if needed
110961
- await captureDevices(handleId, callbacks);
110962
- // Create the answer now
110963
- let answer = await createAnswer(handleId, callbacks);
110964
- callbacks.success(answer);
110965
- }
110966
- } catch (err) {
110967
- Janus.error(err);
110968
- callbacks.error(err);
110969
- }
110970
- }
110971
- function prepareWebrtcPeer(handleId, callbacks) {
110972
- callbacks = callbacks || {};
110973
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
110974
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : webrtcError;
110975
- callbacks.customizeSdp = typeof callbacks.customizeSdp == "function" ? callbacks.customizeSdp : Janus.noop;
110976
- let jsep = callbacks.jsep;
110977
- let pluginHandle = pluginHandles.get(handleId);
110978
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
110979
- Janus.warn("Invalid handle");
110980
- callbacks.error("Invalid handle");
110981
- return;
110982
- }
110983
- let config = pluginHandle.webrtcStuff;
110984
- if (jsep) {
110985
- if (!config.pc) {
110986
- Janus.warn("Wait, no PeerConnection?? if this is an answer, use createAnswer and not handleRemoteJsep");
110987
- callbacks.error("No PeerConnection: if this is an answer, use createAnswer and not handleRemoteJsep");
110988
- return;
110989
- }
110990
- callbacks.customizeSdp(jsep);
110991
- config.pc.setRemoteDescription(jsep).then(function () {
110992
- Janus.log("Remote description accepted!");
110993
- config.remoteSdp = jsep.sdp;
110994
- // Any trickle candidate we cached?
110995
- if (config.candidates && config.candidates.length > 0) {
110996
- for (let i = 0; i < config.candidates.length; i++) {
110997
- let candidate = config.candidates[i];
110998
- Janus.debug("Adding remote candidate:", candidate);
110999
- if (!candidate || candidate.completed === true) {
111000
- // end-of-candidates
111001
- config.pc.addIceCandidate(Janus.endOfCandidates);
111002
- } else {
111003
- // New candidate
111004
- config.pc.addIceCandidate(candidate);
111005
- }
111006
- }
111007
- config.candidates = [];
111008
- }
111009
- // Done
111010
- callbacks.success();
111011
- }, callbacks.error);
111012
- } else {
111013
- callbacks.error("Invalid JSEP");
111014
- }
111015
- }
111016
- async function createOffer(handleId, callbacks) {
111017
- callbacks = callbacks || {};
111018
- callbacks.customizeSdp = typeof callbacks.customizeSdp == "function" ? callbacks.customizeSdp : Janus.noop;
111019
- let pluginHandle = pluginHandles.get(handleId);
111020
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111021
- Janus.warn("Invalid handle");
111022
- throw "Invalid handle";
111023
- }
111024
- let config = pluginHandle.webrtcStuff;
111025
- Janus.log("Creating offer (iceDone=" + config.iceDone + ")");
111026
- // https://code.google.com/p/webrtc/issues/detail?id=3508
111027
- let mediaConstraints = {};
111028
- let iceRestart = callbacks.iceRestart === true;
111029
- // If we need an ICE restart, set the related constraint
111030
- if (iceRestart) mediaConstraints.iceRestart = true;
111031
- Janus.debug(mediaConstraints);
111032
- let offer = await config.pc.createOffer(mediaConstraints);
111033
- Janus.debug(offer);
111034
- // JSON.stringify doesn't work on some WebRTC objects anymore
111035
- // See https://code.google.com/p/chromium/issues/detail?id=467366
111036
- let jsep = {
111037
- type: 'offer',
111038
- sdp: offer.sdp
111039
- };
111040
- callbacks.customizeSdp(jsep);
111041
- offer.sdp = jsep.sdp;
111042
- Janus.log("Setting local description");
111043
- config.mySdp = {
111044
- type: 'offer',
111045
- sdp: offer.sdp
111046
- };
111047
- await config.pc.setLocalDescription(offer);
111048
- config.mediaConstraints = mediaConstraints;
111049
- if (!config.iceDone && !config.trickle) {
111050
- // FIXME Don't do anything until we have all candidates
111051
- Janus.log("Waiting for all candidates...");
111052
- return null;
111053
- }
111054
- // If transforms are present, notify Janus that the media is end-to-end encrypted
111055
- if (config.insertableStreams || config.externalEncryption) offer.e2ee = true;
111056
- return offer;
111057
- }
111058
- async function createAnswer(handleId, callbacks) {
111059
- callbacks = callbacks || {};
111060
- callbacks.customizeSdp = typeof callbacks.customizeSdp == "function" ? callbacks.customizeSdp : Janus.noop;
111061
- let pluginHandle = pluginHandles.get(handleId);
111062
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111063
- Janus.warn("Invalid handle");
111064
- throw "Invalid handle";
111065
- }
111066
- let config = pluginHandle.webrtcStuff;
111067
- Janus.log("Creating answer (iceDone=" + config.iceDone + ")");
111068
- let answer = await config.pc.createAnswer();
111069
- Janus.debug(answer);
111070
- // JSON.stringify doesn't work on some WebRTC objects anymore
111071
- // See https://code.google.com/p/chromium/issues/detail?id=467366
111072
- let jsep = {
111073
- type: 'answer',
111074
- sdp: answer.sdp
111075
- };
111076
- callbacks.customizeSdp(jsep);
111077
- answer.sdp = jsep.sdp;
111078
- Janus.log("Setting local description");
111079
- config.mySdp = {
111080
- type: 'answer',
111081
- sdp: answer.sdp
111082
- };
111083
- await config.pc.setLocalDescription(answer);
111084
- if (!config.iceDone && !config.trickle) {
111085
- // FIXME Don't do anything until we have all candidates
111086
- Janus.log("Waiting for all candidates...");
111087
- return null;
111088
- }
111089
- // If transforms are present, notify Janus that the media is end-to-end encrypted
111090
- if (config.insertableStreams || config.externalEncryption) answer.e2ee = true;
111091
- return answer;
111092
- }
111093
- function sendSDP(handleId, callbacks) {
111094
- callbacks = callbacks || {};
111095
- callbacks.success = typeof callbacks.success == "function" ? callbacks.success : Janus.noop;
111096
- callbacks.error = typeof callbacks.error == "function" ? callbacks.error : Janus.noop;
111097
- let pluginHandle = pluginHandles.get(handleId);
111098
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111099
- Janus.warn("Invalid handle, not sending anything");
111100
- return;
111101
- }
111102
- let config = pluginHandle.webrtcStuff;
111103
- Janus.log("Sending offer/answer SDP...");
111104
- if (!config.mySdp) {
111105
- Janus.warn("Local SDP instance is invalid, not sending anything...");
111106
- return;
111107
- }
111108
- config.mySdp = {
111109
- type: config.pc.localDescription.type,
111110
- sdp: config.pc.localDescription.sdp
111111
- };
111112
- if (config.trickle === false) config.mySdp["trickle"] = false;
111113
- Janus.debug(callbacks);
111114
- config.sdpSent = true;
111115
- callbacks.success(config.mySdp);
111116
- }
111117
- async function replaceTracks(handleId, callbacks) {
111118
- callbacks = callbacks || {};
111119
- callbacks.success = typeof callbacks.success == 'function' ? callbacks.success : Janus.noop;
111120
- callbacks.error = typeof callbacks.error == 'function' ? callbacks.error : Janus.noop;
111121
- // Check that callbacks.array is a valid array
111122
- if (callbacks.tracks && !Array.isArray(callbacks.tracks)) {
111123
- Janus.error('Tracks must be an array');
111124
- callbacks.error('Tracks must be an array');
111125
- return;
111126
- }
111127
- // Add the replace:true if it's missing
111128
- for (let track of callbacks.tracks) {
111129
- if (track.add || !track.replace && !track.remove) track.replace = true;
111130
- }
111131
- try {
111132
- await captureDevices(handleId, callbacks);
111133
- callbacks.success();
111134
- } catch (err) {
111135
- Janus.error(err);
111136
- callbacks.error(err);
111137
- }
111138
- }
111139
- async function captureDevices(handleId, callbacks) {
111140
- let pluginHandle = pluginHandles.get(handleId);
111141
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111142
- Janus.warn('Invalid handle, not sending anything');
111143
- throw 'Invalid handle';
111144
- }
111145
- let config = pluginHandle.webrtcStuff;
111146
- if (!config.pc) {
111147
- Janus.warn('Invalid PeerConnection');
111148
- throw 'Invalid PeerConnection';
111149
- }
111150
- let tracks = callbacks.tracks;
111151
- if (!tracks || !Array.isArray(tracks) || tracks.length === 0) {
111152
- // Nothing to do
111153
- return;
111154
- }
111155
- let openedConsentDialog = false;
111156
- // Check if we can/should group getUserMedia calls
111157
- let groups = {};
111158
- for (let track of tracks) {
111159
- delete track.gumGroup;
111160
- if (!track.type || !['audio', 'video'].includes(track.type)) continue;
111161
- if (!track.capture || track.capture instanceof MediaStreamTrack) continue;
111162
- let group = track.group ? track.group : 'default';
111163
- if (!groups[group]) groups[group] = {};
111164
- if (groups[group][track.type]) continue;
111165
- track.gumGroup = group;
111166
- groups[group][track.type] = track;
111167
- }
111168
- let keys = Object.keys(groups);
111169
- for (let key of keys) {
111170
- let group = groups[key];
111171
- if (!group.audio || !group.video) {
111172
- if (group.audio) delete group.audio.gumGroup;
111173
- if (group.video) delete group.video.gumGroup;
111174
- delete groups[key];
111175
- }
111176
- }
111177
- let answer = callbacks.jsep ? true : false;
111178
- for (let track of tracks) {
111179
- if (!track.type) {
111180
- Janus.warn('Missing track type:', track);
111181
- continue;
111182
- }
111183
- if (track.type === 'data') {
111184
- // Easy enough: create a datachannel if we don't have one already
111185
- if (config.pc.ondatachannel) {
111186
- Janus.warn('Data channel exists already, not creating another one');
111187
- continue;
111188
- }
111189
- Janus.log('Creating default data channel');
111190
- createDataChannel(handleId, Janus.dataChanDefaultLabel, null, false);
111191
- config.pc.ondatachannel = function (event) {
111192
- Janus.log('Data channel created by Janus:', event);
111193
- createDataChannel(handleId, event.channel.label, event.channel.protocol, event.channel);
111194
- };
111195
- continue;
111196
- }
111197
- if ((typeof track.add === 'undefined' || track.add === null) && (typeof track.remove === 'undefined' || track.remove === null) && (typeof track.replace === 'undefined' || track.replace === null)) {
111198
- // Let's default to 'add'
111199
- track.add = true;
111200
- }
111201
- if (track.add && track.remove || track.add && track.remove && track.replace) {
111202
- Janus.warn('Conflicting actions for track, ignoring:', track);
111203
- continue;
111204
- }
111205
- if (track.add && track.replace) {
111206
- Janus.warn('Both add and replace provided, falling back to replace:', track);
111207
- delete track.add;
111208
- } else if (track.remove && track.replace) {
111209
- Janus.warn('Both remove and replace provided, falling back to remove:', track);
111210
- delete track.replace;
111211
- }
111212
- let kind = track.type;
111213
- if (track.type === 'screen') kind = 'video'; // FIXME
111214
- let transceiver = null,
111215
- sender = null;
111216
- if (track.mid) {
111217
- // Search by mid
111218
- transceiver = config.pc.getTransceivers().find(t => t.mid === track.mid && t.receiver.track.kind === kind);
111219
- } else if (!track.add) {
111220
- // Find the first track of this type
111221
- transceiver = config.pc.getTransceivers().find(t => t.receiver.track.kind === kind);
111222
- }
111223
- if (track.replace || track.remove) {
111224
- if (!transceiver) {
111225
- Janus.warn("Couldn't find a transceiver for track:", track);
111226
- continue;
111227
- }
111228
- if (!transceiver.sender) {
111229
- Janus.warn('No sender in the transceiver for track:', track);
111230
- continue;
111231
- }
111232
- sender = transceiver.sender;
111233
- }
111234
- if (answer && !transceiver) {
111235
- transceiver = config.pc.getTransceivers().find(t => t.receiver.track.kind === kind);
111236
- if (!transceiver) {
111237
- Janus.warn("Couldn't find a transceiver for track:", track);
111238
- continue;
111239
- }
111240
- }
111241
- // Capture the new track, if we need to
111242
- let nt = null,
111243
- trackId = null;
111244
- if (track.remove || track.replace) {
111245
- Janus.log('Removing track from PeerConnection', track);
111246
- trackId = sender.track ? sender.track.id : null;
111247
- await sender.replaceTrack(null);
111248
- // Get rid of the old track
111249
- if (trackId && config.myStream) {
111250
- let rt = null;
111251
- if (kind === 'audio' && config.myStream.getAudioTracks() && config.myStream.getAudioTracks().length) {
111252
- for (let t of config.myStream.getAudioTracks()) {
111253
- if (t.id === trackId) {
111254
- rt = t;
111255
- Janus.log('Removing audio track:', rt);
111256
- }
111257
- }
111258
- } else if (kind === 'video' && config.myStream.getVideoTracks() && config.myStream.getVideoTracks().length) {
111259
- for (let t of config.myStream.getVideoTracks()) {
111260
- if (t.id === trackId) {
111261
- rt = t;
111262
- Janus.log('Removing video track:', rt);
111263
- }
111264
- }
111265
- }
111266
- if (rt) {
111267
- // Remove the track and notify the application
111268
- try {
111269
- config.myStream.removeTrack(rt);
111270
- pluginHandle.onlocaltrack(rt, false);
111271
- } catch (e) {
111272
- Janus.error("Error calling onlocaltrack on removal for renegotiation", e);
111273
- }
111274
- // Close the old track (unless we've been asked not to)
111275
- if (rt.dontStop !== true) {
111276
- try {
111277
- rt.stop();
111278
- // eslint-disable-next-line no-unused-vars
111279
- } catch (e) {}
111280
- }
111281
- }
111282
- }
111283
- }
111284
- if (track.capture) {
111285
- if (track.gumGroup && groups[track.gumGroup] && groups[track.gumGroup].stream) {
111286
- // We did a getUserMedia before already
111287
- let stream = groups[track.gumGroup].stream;
111288
- nt = track.type === 'audio' ? stream.getAudioTracks()[0] : stream.getVideoTracks()[0];
111289
- delete groups[track.gumGroup].stream;
111290
- delete groups[track.gumGroup];
111291
- delete track.gumGroup;
111292
- } else if (track.capture instanceof MediaStreamTrack) {
111293
- // An external track was provided, use that
111294
- nt = track.capture;
111295
- } else {
111296
- if (!openedConsentDialog) {
111297
- openedConsentDialog = true;
111298
- pluginHandle.consentDialog(true);
111299
- }
111300
- let constraints = Janus.trackConstraints(track),
111301
- stream = null;
111302
- if (track.type === 'audio' || track.type === 'video') {
111303
- // Use getUserMedia: check if we need to group audio and video together
111304
- if (track.gumGroup) {
111305
- let otherType = track.type === 'audio' ? 'video' : 'audio';
111306
- if (groups[track.gumGroup] && groups[track.gumGroup][otherType]) {
111307
- let otherTrack = groups[track.gumGroup][otherType];
111308
- let otherConstraints = Janus.trackConstraints(otherTrack);
111309
- constraints[otherType] = otherConstraints[otherType];
111310
- }
111311
- }
111312
- stream = await navigator.mediaDevices.getUserMedia(constraints);
111313
- if (track.gumGroup && constraints.audio && constraints.video) {
111314
- // We just performed a grouped getUserMedia, keep track of the
111315
- // stream so that we can immediately assign the track later
111316
- groups[track.gumGroup].stream = stream;
111317
- delete track.gumGroup;
111318
- }
111319
- } else {
111320
- // Use getDisplayMedia
111321
- stream = await navigator.mediaDevices.getDisplayMedia(constraints);
111322
- }
111323
- nt = track.type === 'audio' ? stream.getAudioTracks()[0] : stream.getVideoTracks()[0];
111324
- }
111325
- if (track.replace) {
111326
- // Replace the track
111327
- await sender.replaceTrack(nt);
111328
- // Update the transceiver direction
111329
- let newDirection = 'sendrecv';
111330
- if (track.recv === false || transceiver.direction === 'inactive' || transceiver.direction === 'sendonly') newDirection = 'sendonly';
111331
- if (transceiver.setDirection) transceiver.setDirection(newDirection);else transceiver.direction = newDirection;
111332
- } else {
111333
- // FIXME Add as a new track
111334
- if (!config.myStream) config.myStream = new MediaStream();
111335
- if (kind === 'audio' || !track.simulcast && !track.svc) {
111336
- sender = config.pc.addTrack(nt, config.myStream);
111337
- transceiver = config.pc.getTransceivers().find(t => t.sender === sender);
111338
- } else if (track.simulcast) {
111339
- // Standard RID
111340
- Janus.log('Enabling rid-based simulcasting:', nt);
111341
- let maxBitrates = getMaxBitrates(track.simulcastMaxBitrates);
111342
- transceiver = config.pc.addTransceiver(nt, {
111343
- direction: 'sendrecv',
111344
- streams: [config.myStream],
111345
- sendEncodings: track.sendEncodings || [{
111346
- rid: 'h',
111347
- active: true,
111348
- scalabilityMode: 'L1T2',
111349
- maxBitrate: maxBitrates.high
111350
- }, {
111351
- rid: 'm',
111352
- active: true,
111353
- scalabilityMode: 'L1T2',
111354
- maxBitrate: maxBitrates.medium,
111355
- scaleResolutionDownBy: 2
111356
- }, {
111357
- rid: 'l',
111358
- active: true,
111359
- scalabilityMode: 'L1T2',
111360
- maxBitrate: maxBitrates.low,
111361
- scaleResolutionDownBy: 4
111362
- }]
111363
- });
111364
- } else {
111365
- Janus.log('Enabling SVC (' + track.svc + '):', nt);
111366
- transceiver = config.pc.addTransceiver(nt, {
111367
- direction: 'sendrecv',
111368
- streams: [config.myStream],
111369
- sendEncodings: [{
111370
- scalabilityMode: track.svc
111371
- }]
111372
- });
111373
- }
111374
- if (!sender) sender = transceiver ? transceiver.sender : null;
111375
- // Check if we need to override some settings
111376
- if (track.codec) {
111377
- if (Janus.webRTCAdapter.browserDetails.browser === 'firefox') {
111378
- Janus.warn('setCodecPreferences not supported in Firefox, ignoring codec for track:', track);
111379
- } else if (typeof track.codec !== 'string') {
111380
- Janus.warn('Invalid codec value, ignoring for track:', track);
111381
- } else {
111382
- let mimeType = kind + '/' + track.codec.toLowerCase();
111383
- let codecs = RTCRtpReceiver.getCapabilities(kind).codecs.filter(function (codec) {
111384
- return codec.mimeType.toLowerCase() === mimeType;
111385
- });
111386
- if (!codecs || codecs.length === 0) {
111387
- Janus.warn('Codec not supported in this browser for this track, ignoring:', track);
111388
- } else if (transceiver) {
111389
- try {
111390
- transceiver.setCodecPreferences(codecs);
111391
- } catch (err) {
111392
- Janus.warn('Failed enforcing codec for this ' + kind + ' track:', err);
111393
- }
111394
- }
111395
- }
111396
- }
111397
- if (track.bitrate) {
111398
- // Override maximum bitrate
111399
- if (track.simulcast || track.svc) {
111400
- Janus.warn('Ignoring bitrate for simulcast/SVC track, use sendEncodings for that');
111401
- } else if (isNaN(track.bitrate) || track.bitrate < 0) {
111402
- Janus.warn('Ignoring invalid bitrate for track:', track);
111403
- } else if (sender) {
111404
- let params = sender.getParameters();
111405
- if (!params || !params.encodings || params.encodings.length === 0) {
111406
- Janus.warn('No encodings in the sender parameters, ignoring bitrate for track:', track);
111407
- } else {
111408
- params.encodings[0].maxBitrate = track.bitrate;
111409
- await sender.setParameters(params);
111410
- }
111411
- }
111412
- }
111413
- if (kind === 'video' && track.framerate) {
111414
- // Override maximum framerate
111415
- if (track.simulcast || track.svc) {
111416
- Janus.warn('Ignoring framerate for simulcast/SVC track, use sendEncodings for that');
111417
- } else if (isNaN(track.framerate) || track.framerate < 0) {
111418
- Janus.warn('Ignoring invalid framerate for track:', track);
111419
- } else if (sender) {
111420
- let params = sender.getParameters();
111421
- if (!params || !params.encodings || params.encodings.length === 0) {
111422
- Janus.warn('No encodings in the sender parameters, ignoring framerate for track:', track);
111423
- } else {
111424
- params.encodings[0].maxFramerate = track.framerate;
111425
- await sender.setParameters(params);
111426
- }
111427
- }
111428
- }
111429
- // Check if insertable streams are involved
111430
- if (track.transforms) {
111431
- if (sender && track.transforms.sender) {
111432
- // There's a sender transform, set it on the transceiver sender
111433
- let senderStreams = null;
111434
- if (RTCRtpSender.prototype.createEncodedStreams) {
111435
- senderStreams = sender.createEncodedStreams();
111436
- } else if (RTCRtpSender.prototype.createAudioEncodedStreams || RTCRtpSender.prototype.createEncodedVideoStreams) {
111437
- if (kind === 'audio') {
111438
- senderStreams = sender.createEncodedAudioStreams();
111439
- } else if (kind === 'video') {
111440
- senderStreams = sender.createEncodedVideoStreams();
111441
- }
111442
- }
111443
- if (senderStreams) {
111444
- if (senderStreams.readableStream && senderStreams.writableStream) {
111445
- senderStreams.readableStream.pipeThrough(track.transforms.sender).pipeTo(senderStreams.writableStream);
111446
- } else if (senderStreams.readable && senderStreams.writable) {
111447
- senderStreams.readable.pipeThrough(track.transforms.sender).pipeTo(senderStreams.writable);
111448
- }
111449
- }
111450
- }
111451
- if (transceiver && transceiver.receiver && track.transforms.receiver) {
111452
- // There's a receiver transform, set it on the transceiver receiver
111453
- let receiverStreams = null;
111454
- if (RTCRtpReceiver.prototype.createEncodedStreams) {
111455
- receiverStreams = transceiver.receiver.createEncodedStreams();
111456
- } else if (RTCRtpReceiver.prototype.createAudioEncodedStreams || RTCRtpReceiver.prototype.createEncodedVideoStreams) {
111457
- if (kind === 'audio') {
111458
- receiverStreams = transceiver.receiver.createEncodedAudioStreams();
111459
- } else if (kind === 'video') {
111460
- receiverStreams = transceiver.receiver.createEncodedVideoStreams();
111461
- }
111462
- }
111463
- if (receiverStreams) {
111464
- if (receiverStreams.readableStream && receiverStreams.writableStream) {
111465
- receiverStreams.readableStream.pipeThrough(track.transforms.receiver).pipeTo(receiverStreams.writableStream);
111466
- } else if (receiverStreams.readable && receiverStreams.writable) {
111467
- receiverStreams.readable.pipeThrough(track.transforms.receiver).pipeTo(receiverStreams.writable);
111468
- }
111469
- }
111470
- }
111471
- }
111472
- }
111473
- if (nt && track.dontStop === true) nt.dontStop = true;
111474
- } else if (track.recv) {
111475
- // Maybe a new recvonly track
111476
- if (!transceiver) transceiver = config.pc.addTransceiver(kind);
111477
- if (transceiver) {
111478
- // Check if we need to override some settings
111479
- if (track.codec) {
111480
- if (Janus.webRTCAdapter.browserDetails.browser === 'firefox') {
111481
- Janus.warn('setCodecPreferences not supported in Firefox, ignoring codec for track:', track);
111482
- } else if (typeof track.codec !== 'string') {
111483
- Janus.warn('Invalid codec value, ignoring for track:', track);
111484
- } else {
111485
- let mimeType = kind + '/' + track.codec.toLowerCase();
111486
- let codecs = RTCRtpReceiver.getCapabilities(kind).codecs.filter(function (codec) {
111487
- return codec.mimeType.toLowerCase() === mimeType;
111488
- });
111489
- if (!codecs || codecs.length === 0) {
111490
- Janus.warn('Codec not supported in this browser for this track, ignoring:', track);
111491
- } else {
111492
- try {
111493
- transceiver.setCodecPreferences(codecs);
111494
- } catch (err) {
111495
- Janus.warn('Failed enforcing codec for this ' + kind + ' track:', err);
111496
- }
111497
- }
111498
- }
111499
- }
111500
- // Check if insertable streams are involved
111501
- if (transceiver.receiver && track.transforms && track.transforms.receiver) {
111502
- // There's a receiver transform, set it on the transceiver receiver
111503
- let receiverStreams = null;
111504
- if (RTCRtpReceiver.prototype.createEncodedStreams) {
111505
- receiverStreams = transceiver.receiver.createEncodedStreams();
111506
- } else if (RTCRtpReceiver.prototype.createAudioEncodedStreams || RTCRtpReceiver.prototype.createEncodedVideoStreams) {
111507
- if (kind === 'audio') {
111508
- receiverStreams = transceiver.receiver.createEncodedAudioStreams();
111509
- } else if (kind === 'video') {
111510
- receiverStreams = transceiver.receiver.createEncodedVideoStreams();
111511
- }
111512
- }
111513
- if (receiverStreams) {
111514
- if (receiverStreams.readableStream && receiverStreams.writableStream) {
111515
- receiverStreams.readableStream.pipeThrough(track.transforms.receiver).pipeTo(receiverStreams.writableStream);
111516
- } else if (receiverStreams.readable && receiverStreams.writable) {
111517
- receiverStreams.readable.pipeThrough(track.transforms.receiver).pipeTo(receiverStreams.writable);
111518
- }
111519
- }
111520
- }
111521
- }
111522
- }
111523
- if (nt) {
111524
- // FIXME Add the new track locally
111525
- config.myStream.addTrack(nt);
111526
- // Notify the application about the new local track, if any
111527
- nt.onended = function (ev) {
111528
- Janus.log('Local track removed:', ev);
111529
- try {
111530
- pluginHandle.onlocaltrack(ev.target, false);
111531
- } catch (e) {
111532
- Janus.error("Error calling onlocaltrack following end", e);
111533
- }
111534
- };
111535
- try {
111536
- pluginHandle.onlocaltrack(nt, true);
111537
- } catch (e) {
111538
- Janus.error("Error calling onlocaltrack for track add", e);
111539
- }
111540
- }
111541
- // Update the direction of the transceiver
111542
- if (transceiver) {
111543
- let curdir = transceiver.direction,
111544
- newdir = null;
111545
- let send = nt && transceiver.sender.track,
111546
- recv = track.recv !== false && transceiver.receiver.track;
111547
- if (send && recv) newdir = 'sendrecv';else if (send && !recv) newdir = 'sendonly';else if (!send && recv) newdir = 'recvonly';else if (!send && !recv) newdir = 'inactive';
111548
- if (newdir && newdir !== curdir) {
111549
- Janus.warn('Changing direction of transceiver to ' + newdir + ' (was ' + curdir + ')', track);
111550
- if (transceiver.setDirection) transceiver.setDirection(newdir);else transceiver.direction = newdir;
111551
- }
111552
- }
111553
- }
111554
- if (openedConsentDialog) pluginHandle.consentDialog(false);
111555
- }
111556
- function getLocalTracks(handleId) {
111557
- let pluginHandle = pluginHandles.get(handleId);
111558
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111559
- Janus.warn('Invalid handle');
111560
- return null;
111561
- }
111562
- let config = pluginHandle.webrtcStuff;
111563
- if (!config.pc) {
111564
- Janus.warn('Invalid PeerConnection');
111565
- return null;
111566
- }
111567
- let tracks = [];
111568
- let transceivers = config.pc.getTransceivers();
111569
- for (let tr of transceivers) {
111570
- let track = null;
111571
- if (tr.sender && tr.sender.track) {
111572
- track = {
111573
- mid: tr.mid
111574
- };
111575
- track.type = tr.sender.track.kind;
111576
- track.id = tr.sender.track.id;
111577
- track.label = tr.sender.track.label;
111578
- }
111579
- if (track) tracks.push(track);
111580
- }
111581
- return tracks;
111582
- }
111583
- function getRemoteTracks(handleId) {
111584
- let pluginHandle = pluginHandles.get(handleId);
111585
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111586
- Janus.warn('Invalid handle');
111587
- return null;
111588
- }
111589
- let config = pluginHandle.webrtcStuff;
111590
- if (!config.pc) {
111591
- Janus.warn('Invalid PeerConnection');
111592
- return null;
111593
- }
111594
- let tracks = [];
111595
- let transceivers = config.pc.getTransceivers();
111596
- for (let tr of transceivers) {
111597
- let track = null;
111598
- if (tr.receiver && tr.receiver.track) {
111599
- track = {
111600
- mid: tr.mid
111601
- };
111602
- track.type = tr.receiver.track.kind;
111603
- track.id = tr.receiver.track.id;
111604
- track.label = tr.receiver.track.label;
111605
- }
111606
- if (track) tracks.push(track);
111607
- }
111608
- return tracks;
111609
- }
111610
- function getVolume(handleId, mid, remote, result) {
111611
- result = typeof result == "function" ? result : Janus.noop;
111612
- let pluginHandle = pluginHandles.get(handleId);
111613
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111614
- Janus.warn("Invalid handle");
111615
- result(0);
111616
- return;
111617
- }
111618
- let stream = remote ? "remote" : "local";
111619
- let config = pluginHandle.webrtcStuff;
111620
- if (!config.volume[stream]) config.volume[stream] = {
111621
- value: 0
111622
- };
111623
- // Start getting the volume, if audioLevel in getStats is supported (apparently
111624
- // they're only available in Chrome/Safari right now: https://webrtc-stats.callstats.io/)
111625
- if (config.pc && config.pc.getStats && (Janus.webRTCAdapter.browserDetails.browser === "chrome" || Janus.webRTCAdapter.browserDetails.browser === "safari")) {
111626
- // Are we interested in a mid in particular?
111627
- let query = config.pc;
111628
- if (mid) {
111629
- let transceiver = config.pc.getTransceivers().find(t => t.mid === mid && t.receiver.track.kind === "audio");
111630
- if (!transceiver) {
111631
- Janus.warn("No audio transceiver with mid " + mid);
111632
- result(0);
111633
- return;
111634
- }
111635
- if (remote && !transceiver.receiver) {
111636
- Janus.warn("Remote transceiver track unavailable");
111637
- result(0);
111638
- return;
111639
- } else if (!remote && !transceiver.sender) {
111640
- Janus.warn("Local transceiver track unavailable");
111641
- result(0);
111642
- return;
111643
- }
111644
- query = remote ? transceiver.receiver : transceiver.sender;
111645
- }
111646
- query.getStats().then(function (stats) {
111647
- stats.forEach(function (res) {
111648
- if (!res || res.kind !== "audio") return;
111649
- if (remote && !res.remoteSource || !remote && res.type !== "media-source") return;
111650
- result(res.audioLevel ? res.audioLevel : 0);
111651
- });
111652
- });
111653
- return config.volume[stream].value;
111654
- } else {
111655
- // audioInputLevel and audioOutputLevel seem only available in Chrome? audioLevel
111656
- // seems to be available on Chrome and Firefox, but they don't seem to work
111657
- Janus.warn("Getting the " + stream + " volume unsupported by browser");
111658
- result(0);
111659
- return;
111660
- }
111661
- }
111662
- function isMuted(handleId, mid, video) {
111663
- let pluginHandle = pluginHandles.get(handleId);
111664
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111665
- Janus.warn("Invalid handle");
111666
- return true;
111667
- }
111668
- let config = pluginHandle.webrtcStuff;
111669
- if (!config.pc) {
111670
- Janus.warn("Invalid PeerConnection");
111671
- return true;
111672
- }
111673
- if (!config.myStream) {
111674
- Janus.warn("Invalid local MediaStream");
111675
- return true;
111676
- }
111677
- if (video) {
111678
- // Check video track
111679
- if (!config.myStream.getVideoTracks() || config.myStream.getVideoTracks().length === 0) {
111680
- Janus.warn("No video track");
111681
- return true;
111682
- }
111683
- if (mid) {
111684
- let transceiver = config.pc.getTransceivers().find(t => t.mid === mid && t.receiver.track.kind === "video");
111685
- if (!transceiver) {
111686
- Janus.warn("No video transceiver with mid " + mid);
111687
- return true;
111688
- }
111689
- if (!transceiver.sender || !transceiver.sender.track) {
111690
- Janus.warn("No video sender with mid " + mid);
111691
- return true;
111692
- }
111693
- return !transceiver.sender.track.enabled;
111694
- } else {
111695
- return !config.myStream.getVideoTracks()[0].enabled;
111696
- }
111697
- } else {
111698
- // Check audio track
111699
- if (!config.myStream.getAudioTracks() || config.myStream.getAudioTracks().length === 0) {
111700
- Janus.warn("No audio track");
111701
- return true;
111702
- }
111703
- if (mid) {
111704
- let transceiver = config.pc.getTransceivers().find(t => t.mid === mid && t.receiver.track.kind === "audio");
111705
- if (!transceiver) {
111706
- Janus.warn("No audio transceiver with mid " + mid);
111707
- return true;
111708
- }
111709
- if (!transceiver.sender || !transceiver.sender.track) {
111710
- Janus.warn("No audio sender with mid " + mid);
111711
- return true;
111712
- }
111713
- return !transceiver.sender.track.enabled;
111714
- } else {
111715
- return !config.myStream.getAudioTracks()[0].enabled;
111716
- }
111717
- }
111718
- }
111719
- function mute(handleId, mid, video, mute) {
111720
- let pluginHandle = pluginHandles.get(handleId);
111721
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111722
- Janus.warn("Invalid handle");
111723
- return false;
111724
- }
111725
- let config = pluginHandle.webrtcStuff;
111726
- if (!config.pc) {
111727
- Janus.warn("Invalid PeerConnection");
111728
- return false;
111729
- }
111730
- if (!config.myStream) {
111731
- Janus.warn("Invalid local MediaStream");
111732
- return false;
111733
- }
111734
- if (video) {
111735
- // Mute/unmute video track
111736
- if (!config.myStream.getVideoTracks() || config.myStream.getVideoTracks().length === 0) {
111737
- Janus.warn("No video track");
111738
- return false;
111739
- }
111740
- if (mid) {
111741
- let transceiver = config.pc.getTransceivers().find(t => t.mid === mid && t.receiver.track.kind === "video");
111742
- if (!transceiver) {
111743
- Janus.warn("No video transceiver with mid " + mid);
111744
- return false;
111745
- }
111746
- if (!transceiver.sender || !transceiver.sender.track) {
111747
- Janus.warn("No video sender with mid " + mid);
111748
- return false;
111749
- }
111750
- transceiver.sender.track.enabled = mute ? false : true;
111751
- } else {
111752
- for (const videostream of config.myStream.getVideoTracks()) {
111753
- videostream.enabled = !mute;
111754
- }
111755
- }
111756
- } else {
111757
- // Mute/unmute audio track
111758
- if (!config.myStream.getAudioTracks() || config.myStream.getAudioTracks().length === 0) {
111759
- Janus.warn("No audio track");
111760
- return false;
111761
- }
111762
- if (mid) {
111763
- let transceiver = config.pc.getTransceivers().find(t => t.mid === mid && t.receiver.track.kind === "audio");
111764
- if (!transceiver) {
111765
- Janus.warn("No audio transceiver with mid " + mid);
111766
- return false;
111767
- }
111768
- if (!transceiver.sender || !transceiver.sender.track) {
111769
- Janus.warn("No audio sender with mid " + mid);
111770
- return false;
111771
- }
111772
- transceiver.sender.track.enabled = mute ? false : true;
111773
- } else {
111774
- for (const audiostream of config.myStream.getAudioTracks()) {
111775
- audiostream.enabled = !mute;
111776
- }
111777
- }
111778
- }
111779
- return true;
111780
- }
111781
- function getBitrate(handleId, mid) {
111782
- let pluginHandle = pluginHandles.get(handleId);
111783
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111784
- Janus.warn("Invalid handle");
111785
- return "Invalid handle";
111786
- }
111787
- let config = pluginHandle.webrtcStuff;
111788
- if (!config.pc) return "Invalid PeerConnection";
111789
- // Start getting the bitrate, if getStats is supported
111790
- if (config.pc.getStats) {
111791
- let query = config.pc;
111792
- let target = mid ? mid : "default";
111793
- if (mid) {
111794
- let transceiver = config.pc.getTransceivers().find(t => t.mid === mid && t.receiver.track.kind === "video");
111795
- if (!transceiver) {
111796
- Janus.warn("No video transceiver with mid " + mid);
111797
- return "No video transceiver with mid " + mid;
111798
- }
111799
- if (!transceiver.receiver) {
111800
- Janus.warn("No video receiver with mid " + mid);
111801
- return "No video receiver with mid " + mid;
111802
- }
111803
- query = transceiver.receiver;
111804
- }
111805
- if (!config.bitrate[target]) {
111806
- config.bitrate[target] = {
111807
- timer: null,
111808
- bsnow: null,
111809
- bsbefore: null,
111810
- tsnow: null,
111811
- tsbefore: null,
111812
- value: "0 kbits/sec"
111813
- };
111814
- }
111815
- if (!config.bitrate[target].timer) {
111816
- Janus.log("Starting bitrate timer" + (mid ? " for mid " + mid : "") + " (via getStats)");
111817
- config.bitrate[target].timer = setInterval(function () {
111818
- query.getStats().then(function (stats) {
111819
- stats.forEach(function (res) {
111820
- if (!res) return;
111821
- let inStats = false;
111822
- // Check if these are statistics on incoming media
111823
- if ((res.mediaType === "video" || res.kind === "video" || res.id.toLowerCase().indexOf("video") > -1) && res.type === "inbound-rtp" && res.id.indexOf("rtcp") < 0) {
111824
- // New stats
111825
- inStats = true;
111826
- } else if (res.type == 'ssrc' && res.bytesReceived && (res.googCodecName === "VP8" || res.googCodecName === "")) {
111827
- // Older Chromer versions
111828
- inStats = true;
111829
- }
111830
- // Parse stats now
111831
- if (inStats) {
111832
- config.bitrate[target].bsnow = res.bytesReceived;
111833
- config.bitrate[target].tsnow = res.timestamp;
111834
- if (config.bitrate[target].bsbefore === null || config.bitrate[target].tsbefore === null) {
111835
- // Skip this round
111836
- config.bitrate[target].bsbefore = config.bitrate[target].bsnow;
111837
- config.bitrate[target].tsbefore = config.bitrate[target].tsnow;
111838
- } else {
111839
- // Calculate bitrate
111840
- let timePassed = config.bitrate[target].tsnow - config.bitrate[target].tsbefore;
111841
- if (Janus.webRTCAdapter.browserDetails.browser === "safari") timePassed = timePassed / 1000; // Apparently the timestamp is in microseconds, in Safari
111842
- let bitRate = Math.round((config.bitrate[target].bsnow - config.bitrate[target].bsbefore) * 8 / timePassed);
111843
- if (Janus.webRTCAdapter.browserDetails.browser === "safari") bitRate = parseInt(bitRate / 1000);
111844
- config.bitrate[target].value = bitRate + ' kbits/sec';
111845
- //~ Janus.log("Estimated bitrate is " + config.bitrate.value);
111846
- config.bitrate[target].bsbefore = config.bitrate[target].bsnow;
111847
- config.bitrate[target].tsbefore = config.bitrate[target].tsnow;
111848
- }
111849
- }
111850
- });
111851
- });
111852
- }, 1000);
111853
- return "0 kbits/sec"; // We don't have a bitrate value yet
111854
- }
111855
- return config.bitrate[target].value;
111856
- } else {
111857
- Janus.warn("Getting the video bitrate unsupported by browser");
111858
- return "Feature unsupported by browser";
111859
- }
111860
- }
111861
- function setBitrate(handleId, mid, bitrate) {
111862
- let pluginHandle = pluginHandles.get(handleId);
111863
- if (!pluginHandle || !pluginHandle.webrtcStuff) {
111864
- Janus.warn('Invalid handle');
111865
- return;
111866
- }
111867
- let config = pluginHandle.webrtcStuff;
111868
- if (!config.pc) {
111869
- Janus.warn('Invalid PeerConnection');
111870
- return;
111871
- }
111872
- let transceiver = config.pc.getTransceivers().find(t => t.mid === mid);
111873
- if (!transceiver) {
111874
- Janus.warn('No transceiver with mid', mid);
111875
- return;
111876
- }
111877
- if (!transceiver.sender) {
111878
- Janus.warn('No sender for transceiver with mid', mid);
111879
- return;
111880
- }
111881
- let params = transceiver.sender.getParameters();
111882
- if (!params || !params.encodings || params.encodings.length === 0) {
111883
- Janus.warn('No parameters encodings');
111884
- } else if (params.encodings.length > 1) {
111885
- Janus.warn('Ignoring bitrate for simulcast track, use sendEncodings for that');
111886
- } else if (isNaN(bitrate) || bitrate < 0) {
111887
- Janus.warn('Invalid bitrate (must be a positive integer)');
111888
- } else {
111889
- params.encodings[0].maxBitrate = bitrate;
111890
- transceiver.sender.setParameters(params);
111891
- }
111892
- }
111893
- function webrtcError(error) {
111894
- Janus.error("WebRTC error:", error);
111895
- }
111896
- function cleanupWebrtc(handleId, hangupRequest) {
111897
- Janus.log("Cleaning WebRTC stuff");
111898
- let pluginHandle = pluginHandles.get(handleId);
111899
- if (!pluginHandle) {
111900
- // Nothing to clean
111901
- return;
111902
- }
111903
- let config = pluginHandle.webrtcStuff;
111904
- if (config) {
111905
- if (hangupRequest === true) {
111906
- // Send a hangup request (we don't really care about the response)
111907
- let request = {
111908
- "janus": "hangup",
111909
- "transaction": Janus.randomString(12)
111910
- };
111911
- if (pluginHandle.token) request["token"] = pluginHandle.token;
111912
- if (apisecret) request["apisecret"] = apisecret;
111913
- Janus.debug("Sending hangup request (handle=" + handleId + "):");
111914
- Janus.debug(request);
111915
- if (websockets) {
111916
- request["session_id"] = sessionId;
111917
- request["handle_id"] = handleId;
111918
- ws.send(JSON.stringify(request));
111919
- } else {
111920
- Janus.httpAPICall(server + "/" + sessionId + "/" + handleId, {
111921
- verb: 'POST',
111922
- withCredentials: withCredentials,
111923
- body: request
111924
- });
111925
- }
111926
- }
111927
- // Cleanup stack
111928
- if (config.volume) {
111929
- if (config.volume["local"] && config.volume["local"].timer) clearInterval(config.volume["local"].timer);
111930
- if (config.volume["remote"] && config.volume["remote"].timer) clearInterval(config.volume["remote"].timer);
111931
- }
111932
- for (let i in config.bitrate) {
111933
- if (config.bitrate[i].timer) clearInterval(config.bitrate[i].timer);
111934
- }
111935
- config.bitrate = {};
111936
- if (!config.streamExternal && config.myStream) {
111937
- Janus.log("Stopping local stream tracks");
111938
- Janus.stopAllTracks(config.myStream);
111939
- }
111940
- config.streamExternal = false;
111941
- config.myStream = null;
111942
- // Close PeerConnection
111943
- try {
111944
- config.pc.close();
111945
- // eslint-disable-next-line no-unused-vars
111946
- } catch (e) {
111947
- // Do nothing
111948
- }
111949
- config.pc = null;
111950
- config.candidates = null;
111951
- config.mySdp = null;
111952
- config.remoteSdp = null;
111953
- config.iceDone = false;
111954
- config.dataChannel = {};
111955
- config.dtmfSender = null;
111956
- config.insertableStreams = false;
111957
- config.externalEncryption = false;
111958
- }
111959
- pluginHandle.oncleanup();
111960
- }
111961
- function isTrickleEnabled(trickle) {
111962
- Janus.debug("isTrickleEnabled:", trickle);
111963
- return trickle === false ? false : true;
111964
- }
111965
- }
111966
- return Janus;
111967
- });
111968
-
111969
108780
  /*
111970
108781
  * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
111971
108782
  *
@@ -114990,7 +111801,7 @@ function adapterFactory({
114990
111801
  */
114991
111802
  /* eslint-env node */
114992
111803
 
114993
- const adapter$1 = adapterFactory({
111804
+ const adapter = adapterFactory({
114994
111805
  window: typeof window === 'undefined' ? undefined : window
114995
111806
  });
114996
111807
 
@@ -115104,6 +111915,7 @@ const copyToClipboard = text => {
115104
111915
  return successful;
115105
111916
  };
115106
111917
 
111918
+ exports.Janus = Janus;
115107
111919
  exports.AADHAAR_REGEX = AADHAAR_REGEX;
115108
111920
  exports.ALPHABET_ONLY_REGEX = ALPHABET_ONLY_REGEX;
115109
111921
  exports.ALPHABET_WITH_SPACES_ONLY_REGEX = ALPHABET_WITH_SPACES_ONLY_REGEX;
@@ -115206,7 +112018,6 @@ exports.IconRadioGroup = IconRadioGroup;
115206
112018
  exports.Input = Input$1;
115207
112019
  exports.InputWithDropdown = InputWithDropdown;
115208
112020
  exports.JAVASCRIPT_FILE_TYPE_VALIDATION = JAVASCRIPT_FILE_TYPE_VALIDATION;
115209
- exports.Janus = Janus;
115210
112021
  exports.LINKEDIN_PROFILE_REGEX = LINKEDIN_PROFILE_REGEX;
115211
112022
  exports.LINK_VALIDATION_REGEX = LINK_VALIDATION_REGEX;
115212
112023
  exports.LabelEditTextField = LabelEditTextField;
@@ -115304,7 +112115,7 @@ exports.VariableInput = VariableInput;
115304
112115
  exports.VariableSuggestionInputDropDown = VariableSuggestionInputDropDown;
115305
112116
  exports.WHITESPACE_REGEX = WHITESPACE_REGEX;
115306
112117
  exports.XML_FILE_TYPE_VALIDATION = XML_FILE_TYPE_VALIDATION;
115307
- exports.adapter = adapter$1;
112118
+ exports.adapter = adapter;
115308
112119
  exports.addPrePostStepGroup = addPrePostStepGroup;
115309
112120
  exports.addStepGroup = addStepGroup;
115310
112121
  exports.autoScrollToTableLastRow = autoScrollToTableLastRow;