Merge remote-tracking branch 'origin/master' into deploy-docker-compose

pull/431/head
micaelgallego 2020-04-06 03:56:35 +02:00
commit 69e75b9b1a
79 changed files with 996 additions and 3916 deletions

View File

@ -19,6 +19,10 @@ module.exports = {
],
excludeExternals: true,
excludePrivate: true,
excludeNotExported: true,
theme: "default",
readme: "none"
readme: "none",
includeVersion: true,
listInvalidSymbolLinks: true,
out: "./docs"
}

View File

@ -0,0 +1,19 @@
#!/bin/bash
if [[ -z "$BASEHREF_VERSION" ]]; then
echo "Example of use: \"BASEHREF_VERSION=2.12.0 ${0}\"" 1>&2
exit 1
fi
# Replace version from "stable" to the specified one in all TypeDoc links
grep -rl '/en/stable/' src | xargs sed -i -e 's|/en/stable/|/en/'${BASEHREF_VERSION}'/|g'
# Generate TypeDoc
./node_modules/typedoc/bin/typedoc --options ./config/typedoc.js ./src
# Return links to "stable" version
grep -rl '/en/'${BASEHREF_VERSION}'/' src | xargs sed -i -e 's|/en/'${BASEHREF_VERSION}'/|/en/stable/|g'
# Clean previous docs from openvidu.io-docs repo and copy new ones
rm -rf ../../openvidu.io-docs/docs/api/openvidu-browser/*
cp -R ./docs/. ../../openvidu.io-docs/docs/api/openvidu-browser

View File

@ -13,27 +13,27 @@
"@babel/highlight": "^7.8.3"
}
},
"@babel/helper-validator-identifier": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz",
"integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==",
"dev": true
},
"@babel/highlight": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz",
"integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==",
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz",
"integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==",
"dev": true,
"requires": {
"@babel/helper-validator-identifier": "^7.9.0",
"chalk": "^2.0.0",
"esutils": "^2.0.2",
"js-tokens": "^4.0.0"
}
},
"@types/minimatch": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
"dev": true
},
"@types/node": {
"version": "13.7.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.1.tgz",
"integrity": "sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA=="
"version": "13.9.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.5.tgz",
"integrity": "sha512-hkzMMD3xu6BrJpGVLeQ3htQQNAcOrJjX7WFmtK8zWQpz2UJf13LCFF2ALA7c9OVdvc2vQJeDdjfR35M0sBCxvw=="
},
"@types/platform": {
"version": "1.3.2",
@ -57,9 +57,9 @@
"dev": true
},
"acorn": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
"integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==",
"dev": true
},
"acorn-node": {
@ -242,15 +242,6 @@
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"dev": true
},
"backbone": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/backbone/-/backbone-1.4.0.tgz",
"integrity": "sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ==",
"dev": true,
"requires": {
"underscore": ">=1.8.3"
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -556,9 +547,9 @@
}
},
"buffer": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz",
"integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.5.0.tgz",
"integrity": "sha512-9FTEDjLjwoAkEwyMGDjYJQN2gfRgOKBKRfiglhvibGbpeeU/pQn1bJxQqm32OD/AIeEuHxU9roxXxg34Byp/Ww==",
"dev": true,
"requires": {
"base64-js": "^1.0.2",
@ -1154,12 +1145,6 @@
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
},
"eventemitter2": {
"version": "0.4.14",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz",
@ -1488,9 +1473,9 @@
"dev": true
},
"fsevents": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz",
"integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==",
"version": "1.2.12",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz",
"integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==",
"dev": true,
"optional": true,
"requires": {
@ -1508,7 +1493,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -1529,19 +1515,21 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"chownr": {
"version": "1.1.3",
"version": "1.1.4",
"bundled": true,
"dev": true,
"optional": true
@ -1549,17 +1537,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -1676,7 +1667,8 @@
"inherits": {
"version": "2.0.4",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -1688,6 +1680,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -1702,19 +1695,22 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"version": "1.2.5",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -1730,11 +1726,12 @@
}
},
"mkdirp": {
"version": "0.5.1",
"version": "0.5.3",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
"minimist": "^1.2.5"
}
},
"ms": {
@ -1744,7 +1741,7 @@
"optional": true
},
"needle": {
"version": "2.4.0",
"version": "2.3.3",
"bundled": true,
"dev": true,
"optional": true,
@ -1773,7 +1770,7 @@
}
},
"nopt": {
"version": "4.0.1",
"version": "4.0.3",
"bundled": true,
"dev": true,
"optional": true,
@ -1798,13 +1795,14 @@
"optional": true
},
"npm-packlist": {
"version": "1.4.7",
"version": "1.4.8",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ignore-walk": "^3.0.1",
"npm-bundled": "^1.0.1"
"npm-bundled": "^1.0.1",
"npm-normalize-package-bin": "^1.0.1"
}
},
"npmlog": {
@ -1822,7 +1820,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -1834,6 +1833,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -1882,18 +1882,10 @@
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"bundled": true,
"dev": true,
"optional": true
}
}
},
"readable-stream": {
"version": "2.3.6",
"version": "2.3.7",
"bundled": true,
"dev": true,
"optional": true,
@ -1919,7 +1911,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -1955,6 +1948,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -1974,6 +1968,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -2017,12 +2012,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
@ -2131,9 +2128,9 @@
"dev": true
},
"grunt": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.4.tgz",
"integrity": "sha512-PYsMOrOC+MsdGEkFVwMaMyc6Ob7pKmq+deg1Sjr+vvMWp35sztfwKE7qoN51V+UEtHsyNuMcGdgMLFkBHvMxHQ==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.1.0.tgz",
"integrity": "sha512-+NGod0grmviZ7Nzdi9am7vuRS/h76PcWDsV635mEXF0PEQMUV6Kb+OjTdsVxbi0PZmfQOjCMKb3w8CVZcqsn1g==",
"dev": true,
"requires": {
"coffeescript": "~1.10.0",
@ -2147,9 +2144,9 @@
"grunt-legacy-log": "~2.0.0",
"grunt-legacy-util": "~1.1.1",
"iconv-lite": "~0.4.13",
"js-yaml": "~3.13.0",
"js-yaml": "~3.13.1",
"minimatch": "~3.0.2",
"mkdirp": "~0.5.1",
"mkdirp": "~1.0.3",
"nopt": "~3.0.6",
"path-is-absolute": "~1.0.0",
"rimraf": "~2.6.2"
@ -2181,6 +2178,12 @@
"resolve": "~1.1.0"
}
},
"mkdirp": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz",
"integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==",
"dev": true
},
"resolve": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
@ -2203,9 +2206,9 @@
},
"dependencies": {
"nopt": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz",
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",
"integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",
"dev": true,
"requires": {
"abbrev": "1",
@ -2605,9 +2608,9 @@
"dev": true
},
"hosted-git-info": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
"integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
"dev": true
},
"htmlescape": {
@ -2901,12 +2904,6 @@
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
"dev": true
},
"jquery": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==",
"dev": true
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -3215,9 +3212,9 @@
}
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
},
"mixin-deep": {
@ -3242,20 +3239,12 @@
}
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz",
"integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==",
"dev": true,
"requires": {
"minimist": "0.0.8"
},
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
}
"minimist": "^1.2.5"
}
},
"module-deps": {
@ -3733,9 +3722,9 @@
"dev": true
},
"qs": {
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.1.tgz",
"integrity": "sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==",
"version": "6.9.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.3.tgz",
"integrity": "sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw==",
"dev": true
},
"querystring": {
@ -4075,9 +4064,9 @@
}
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"dev": true
},
"simple-concat": {
@ -4547,15 +4536,15 @@
}
},
"tslib": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
"integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==",
"dev": true
},
"tslint": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-6.0.0.tgz",
"integrity": "sha512-9nLya8GBtlFmmFMW7oXXwoXS1NkrccqTqAtwXzdPV9e2mqSEvCki6iHL/Fbzi5oqbugshzgGPk7KBb2qNP1DSA==",
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.0.tgz",
"integrity": "sha512-fXjYd/61vU6da04E505OZQGb2VCN2Mq3doeWcOIryuG+eqdmFUXTYVwdhnbEu2k46LNLgUYt9bI5icQze/j0bQ==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@ -4603,46 +4592,41 @@
"dev": true
},
"typedoc": {
"version": "0.16.10",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.16.10.tgz",
"integrity": "sha512-Eo1+K+XTiqSi4lz5cPrV4RncLv6abjCd/jfL5tTueNZGO2p8x2yDIrXkxL9C+SoLjJm2xpMs3CXYmTnilxk1cA==",
"version": "0.17.3",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.17.3.tgz",
"integrity": "sha512-sCKyLeXMUYHyul0kd/jSGSGY+o7lfLvbNlnp8kAamQSLPp/f4EOOR50JGjwfYEQkEeETWMXILdU4UUXS42MmSQ==",
"dev": true,
"requires": {
"@types/minimatch": "3.0.3",
"fs-extra": "^8.1.0",
"handlebars": "^4.7.2",
"highlight.js": "^9.17.1",
"handlebars": "^4.7.3",
"highlight.js": "^9.18.1",
"lodash": "^4.17.15",
"marked": "^0.8.0",
"marked": "0.8.0",
"minimatch": "^3.0.0",
"progress": "^2.0.3",
"shelljs": "^0.8.3",
"typedoc-default-themes": "^0.7.2",
"typescript": "3.7.x"
"typedoc-default-themes": "^0.9.0"
}
},
"typedoc-default-themes": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.7.2.tgz",
"integrity": "sha512-fiFKlFO6VTqjcno8w6WpTsbCgXmfPHVjnLfYkmByZE7moaz+E2DSpAT+oHtDHv7E0BM5kAhPrHJELP2J2Y2T9A==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.9.0.tgz",
"integrity": "sha512-ExfIAg3EjZvWnnDsv2wQcZ9I8Lnln643LsfV05BrRGcIMSYPuavils96j4yGXiBYUzldIYw3xmZ7rsdqWfDunQ==",
"dev": true,
"requires": {
"backbone": "^1.4.0",
"jquery": "^3.4.1",
"lunr": "^2.3.8",
"underscore": "^1.9.1"
"lunr": "^2.3.8"
}
},
"typescript": {
"version": "3.7.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
"dev": true
},
"uglify-js": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.0.tgz",
"integrity": "sha512-ugNSTT8ierCsDHso2jkBHXYrU8Y5/fY2ZUprfrJUiD7YpuFvV4jODLFmb3h4btQjqr5Nh4TX4XtgDfCU1WdioQ==",
"version": "3.8.1",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.1.tgz",
"integrity": "sha512-W7KxyzeaQmZvUFbGj4+YFshhVrMBGSg2IbcYAjGWGvx8DHvJMclbTDMpffdxFUGPBHjIytk7KJUR/KUXstUGDw==",
"dev": true,
"requires": {
"commander": "~2.20.3",
@ -4682,12 +4666,6 @@
"xtend": "^4.0.1"
}
},
"underscore": {
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.2.tgz",
"integrity": "sha512-D39qtimx0c1fI3ya1Lnhk3E9nONswSKhnffBI0gME9C99fYOkNi04xs8K6pePLhvl1frbDemkaBQ5ikWllR2HQ==",
"dev": true
},
"underscore.string": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz",
@ -4822,9 +4800,9 @@
"dev": true
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.2.tgz",
"integrity": "sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw=="
},
"v8flags": {
"version": "3.1.3",

View File

@ -1,18 +1,18 @@
{
"author": "OpenVidu",
"dependencies": {
"@types/node": "13.7.1",
"@types/node": "13.9.5",
"@types/platform": "1.3.2",
"freeice": "2.2.2",
"hark": "1.2.3",
"platform": "1.3.5",
"uuid": "3.4.0",
"uuid": "7.0.2",
"wolfy87-eventemitter": "5.2.9"
},
"description": "OpenVidu Browser",
"devDependencies": {
"browserify": "16.5.0",
"grunt": "1.0.4",
"grunt": "1.1.0",
"grunt-cli": "1.3.2",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-sass": "1.0.0",
@ -22,10 +22,10 @@
"grunt-string-replace": "1.3.1",
"grunt-ts": "6.0.0-beta.22",
"tsify": "4.0.1",
"tslint": "6.0.0",
"typedoc": "0.16.10",
"typescript": "3.7.5",
"uglify-js": "3.8.0"
"tslint": "6.1.0",
"typedoc": "0.17.3",
"typescript": "3.8.3",
"uglify-js": "3.8.1"
},
"license": "Apache-2.0",
"main": "lib/index.js",
@ -38,7 +38,7 @@
"browserify": "VERSION=${VERSION:-dev}; cd src && ../node_modules/browserify/bin/cmd.js Main.ts -p [ tsify ] --exclude kurento-browser-extensions --debug -o ../static/js/openvidu-browser-$VERSION.js -v",
"browserify-prod": "VERSION=${VERSION:-dev}; cd src && ../node_modules/browserify/bin/cmd.js --debug Main.ts -p [ tsify ] --exclude kurento-browser-extensions | ../node_modules/uglify-js/bin/uglifyjs --source-map content=inline --output ../static/js/openvidu-browser-$VERSION.min.js",
"build": "cd src/OpenVidu && ./../../node_modules/typescript/bin/tsc && cd ../.. && ./node_modules/typescript/bin/tsc --declaration src/index.ts --outDir ./lib --sourceMap --lib dom,es5,es2015.promise,scripthost",
"docs": "./node_modules/typedoc/bin/typedoc --options ./config/typedoc.js --out ./docs ./src && rm -rf ../../openvidu.io-docs/docs/api/openvidu-browser/* && cp -R ./docs/. ../../openvidu.io-docs/docs/api/openvidu-browser"
"docs": "./generate-docs.sh"
},
"types": "lib/index.d.ts",
"version": "2.12.0"

View File

@ -216,12 +216,12 @@ export class OpenVidu {
* The [[Publisher]] object will dispatch an `accessAllowed` or `accessDenied` event once it has been granted access to the requested input devices or not.
*
* The [[Publisher]] object will dispatch a `videoElementCreated` event once a HTML video element has been added to DOM (only if you
* [let OpenVidu take care of the video players](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)). See [[VideoElementEvent]] to learn more.
* [let OpenVidu take care of the video players](/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)). See [[VideoElementEvent]] to learn more.
*
* The [[Publisher]] object will dispatch a `streamPlaying` event once the local streams starts playing. See [[StreamManagerEvent]] to learn more.
*
* @param targetElement HTML DOM element (or its `id` attribute) in which the video element of the Publisher will be inserted (see [[PublisherProperties.insertMode]]). If *null* or *undefined* no default video will be created for this Publisher.
* You can always call method [[Publisher.addVideoElement]] or [[Publisher.createVideoElement]] to manage the video elements on your own (see [Manage video players](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos) section)
* You can always call method [[Publisher.addVideoElement]] or [[Publisher.createVideoElement]] to manage the video elements on your own (see [Manage video players](/en/stable/cheatsheet/manage-videos) section)
* @param completionHandler `error` parameter is null if `initPublisher` succeeds, and is defined if it fails.
* `completionHandler` function is called before the Publisher dispatches an `accessAllowed` or an `accessDenied` event
*/
@ -652,7 +652,7 @@ export class OpenVidu {
* Set OpenVidu advanced configuration options. Currently `configuration` is an object with the following optional properties (see [[OpenViduAdvancedConfiguration]] for more details):
* - `iceServers`: set custom STUN/TURN servers to be used by OpenVidu Browser
* - `screenShareChromeExtension`: url to a custom screen share extension for Chrome to be used instead of the default one, based on ours [https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension](https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension)
* - `publisherSpeakingEventsOptions`: custom configuration for the [[PublisherSpeakingEvent]] feature and the [StreamManagerEvent.streamAudioVolumeChange](/api/openvidu-browser/classes/streammanagerevent.html) feature
* - `publisherSpeakingEventsOptions`: custom configuration for the [[PublisherSpeakingEvent]] feature and the [StreamManagerEvent.streamAudioVolumeChange](/en/stable/api/openvidu-browser/classes/streammanagerevent.html) feature
*
* Call this method to override previous values at any moment.
*/

View File

@ -117,7 +117,8 @@ export class Publisher extends StreamManager {
*/
publishAudio(value: boolean): void {
if (this.stream.audioActive !== value) {
this.stream.getMediaStream().getAudioTracks().forEach((track) => {
const affectedMediaStream: MediaStream = this.stream.displayMyRemote() ? this.stream.localMediaStreamWhenSubscribedToRemote : this.stream.getMediaStream();
affectedMediaStream.getAudioTracks().forEach((track) => {
track.enabled = value;
});
if (!!this.session && !!this.stream.streamId) {
@ -163,7 +164,8 @@ export class Publisher extends StreamManager {
*/
publishVideo(value: boolean): void {
if (this.stream.videoActive !== value) {
this.stream.getMediaStream().getVideoTracks().forEach((track) => {
const affectedMediaStream: MediaStream = this.stream.displayMyRemote() ? this.stream.localMediaStreamWhenSubscribedToRemote : this.stream.getMediaStream();
affectedMediaStream.getVideoTracks().forEach((track) => {
track.enabled = value;
});
if (!!this.session && !!this.stream.streamId) {
@ -288,36 +290,49 @@ export class Publisher extends StreamManager {
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the track was successfully replaced and rejected with an Error object in other case
*/
replaceTrack(track: MediaStreamTrack): Promise<any> {
return new Promise((resolve, reject) => {
const senders: RTCRtpSender[] = this.stream.getRTCPeerConnection().getSenders();
let sender: RTCRtpSender | undefined;
const replaceMediaStreamTrack = () => {
const mediaStream: MediaStream = this.stream.displayMyRemote() ? this.stream.localMediaStreamWhenSubscribedToRemote : this.stream.getMediaStream();
let removedTrack: MediaStreamTrack;
if (track.kind === 'video') {
sender = senders.find(s => !!s.track && s.track.kind === 'video');
if (!sender) {
reject(new Error('There\'s no replaceable track for that kind of MediaStreamTrack in this Publisher object'))
}
} else if (track.kind === 'audio') {
sender = senders.find(s => !!s.track && s.track.kind === 'audio');
if (!sender) {
reject(new Error('There\'s no replaceable track for that kind of MediaStreamTrack in this Publisher object'))
}
removedTrack = mediaStream.getVideoTracks()[0];
} else {
reject(new Error('Unknown track kind ' + track.kind));
removedTrack = mediaStream.getAudioTracks()[0];
}
(<any>sender).replaceTrack(track).then(() => {
let removedTrack: MediaStreamTrack;
mediaStream.removeTrack(removedTrack);
removedTrack.stop();
mediaStream.addTrack(track);
}
return new Promise((resolve, reject) => {
if (this.stream.isLocalStreamPublished) {
// Only if the Publisher has been published is necessary to call native Web API RTCRtpSender.replaceTrack
const senders: RTCRtpSender[] = this.stream.getRTCPeerConnection().getSenders();
let sender: RTCRtpSender | undefined;
if (track.kind === 'video') {
removedTrack = this.stream.getMediaStream().getVideoTracks()[0];
sender = senders.find(s => !!s.track && s.track.kind === 'video');
if (!sender) {
reject(new Error('There\'s no replaceable track for that kind of MediaStreamTrack in this Publisher object'))
}
} else if (track.kind === 'audio') {
sender = senders.find(s => !!s.track && s.track.kind === 'audio');
if (!sender) {
reject(new Error('There\'s no replaceable track for that kind of MediaStreamTrack in this Publisher object'))
}
} else {
removedTrack = this.stream.getMediaStream().getAudioTracks()[0];
reject(new Error('Unknown track kind ' + track.kind));
}
this.stream.getMediaStream().removeTrack(removedTrack);
removedTrack.stop();
this.stream.getMediaStream().addTrack(track);
(<any>sender).replaceTrack(track).then(() => {
replaceMediaStreamTrack();
resolve();
}).catch(error => {
reject(error);
});
} else {
// Publisher not published. Simply modify local MediaStream tracks
replaceMediaStreamTrack();
resolve();
}).catch(error => {
reject(error);
});
}
});
}
@ -669,4 +684,4 @@ export class Publisher extends StreamManager {
}
}
}
}

View File

@ -200,20 +200,20 @@ export class Session implements EventDispatcher {
*
* The [[Session]] object of the local participant will dispatch a `sessionDisconnected` event.
* This event will automatically unsubscribe the leaving participant from every Subscriber object of the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
* and also deletes any HTML video element associated to each Subscriber (only those [created by OpenVidu Browser](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* and also deletes any HTML video element associated to each Subscriber (only those [created by OpenVidu Browser](/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, each Subscriber object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `sessionDisconnected` to avoid this behavior and take care of disposing and cleaning all the Subscriber objects yourself.
* See [[SessionDisconnectedEvent]] and [[VideoElementEvent]] to learn more to learn more.
*
* The [[Publisher]] object of the local participant will dispatch a `streamDestroyed` event if there is a [[Publisher]] object publishing to the session.
* This event will automatically stop all media tracks and delete any HTML video element associated to it (only those [created by OpenVidu Browser](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* This event will automatically stop all media tracks and delete any HTML video element associated to it (only those [created by OpenVidu Browser](/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, the Publisher object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `streamDestroyed` if you want to clean the Publisher object on your own or re-publish it in a different Session (to do so it is a mandatory requirement to call `Session.unpublish()`
* or/and `Session.disconnect()` in the previous session). See [[StreamEvent]] and [[VideoElementEvent]] to learn more.
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamDestroyed` event if the disconnected participant was publishing.
* This event will automatically unsubscribe the Subscriber object from the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
* and also deletes any HTML video element associated to that Subscriber (only those [created by OpenVidu Browser](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* and also deletes any HTML video element associated to that Subscriber (only those [created by OpenVidu Browser](/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, the Subscriber object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `streamDestroyed` to avoid this default behavior and take care of disposing and cleaning the Subscriber object yourself.
* See [[StreamEvent]] and [[VideoElementEvent]] to learn more.
@ -235,13 +235,13 @@ export class Session implements EventDispatcher {
* #### Events dispatched
*
* The [[Subscriber]] object will dispatch a `videoElementCreated` event once the HTML video element has been added to DOM (only if you
* [let OpenVidu take care of the video players](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)). See [[VideoElementEvent]] to learn more.
* [let OpenVidu take care of the video players](/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)). See [[VideoElementEvent]] to learn more.
*
* The [[Subscriber]] object will dispatch a `streamPlaying` event once the remote stream starts playing. See [[StreamManagerEvent]] to learn more.
*
* @param stream Stream object to subscribe to
* @param targetElement HTML DOM element (or its `id` attribute) in which the video element of the Subscriber will be inserted (see [[SubscriberProperties.insertMode]]). If *null* or *undefined* no default video will be created for this Subscriber.
* You can always call method [[Subscriber.addVideoElement]] or [[Subscriber.createVideoElement]] to manage the video elements on your own (see [Manage video players](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos) section)
* You can always call method [[Subscriber.addVideoElement]] or [[Subscriber.createVideoElement]] to manage the video elements on your own (see [Manage video players](/en/stable/cheatsheet/manage-videos) section)
* @param completionHandler `error` parameter is null if `subscribe` succeeds, and is defined if it fails.
*/
subscribe(stream: Stream, targetElement: string | HTMLElement, param3?: ((error: Error | undefined) => void) | SubscriberProperties, param4?: ((error: Error | undefined) => void)): Subscriber {
@ -324,7 +324,7 @@ export class Session implements EventDispatcher {
* #### Events dispatched
*
* The [[Subscriber]] object will dispatch a `videoElementDestroyed` event for each video associated to it that was removed from DOM.
* Only videos [created by OpenVidu Browser](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)) will be automatically removed
* Only videos [created by OpenVidu Browser](/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)) will be automatically removed
*
* See [[VideoElementEvent]] to learn more
*/
@ -406,13 +406,13 @@ export class Session implements EventDispatcher {
*
* The [[Publisher]] object of the local participant will dispatch a `streamDestroyed` event.
* This event will automatically stop all media tracks and delete any HTML video element associated to this Publisher
* (only those videos [created by OpenVidu Browser](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* (only those videos [created by OpenVidu Browser](/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, the Publisher object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `streamDestroyed` if you want to clean the Publisher object on your own or re-publish it in a different Session.
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamDestroyed` event.
* This event will automatically unsubscribe the Subscriber object from the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks) and
* delete any HTML video element associated to it (only those [created by OpenVidu Browser](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* delete any HTML video element associated to it (only those [created by OpenVidu Browser](/en/stable/cheatsheet/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, the Subscriber object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `streamDestroyed` to avoid this default behavior and take care of disposing and cleaning the Subscriber object on your own.
*
@ -941,7 +941,6 @@ export class Session implements EventDispatcher {
candidate: msg.candidate,
component: msg.component,
foundation: msg.foundation,
ip: msg.ip,
port: msg.port,
priority: msg.priority,
protocol: msg.protocol,

View File

@ -195,6 +195,10 @@ export class Stream implements EventDispatcher {
* @hidden
*/
harkOptions;
/**
* @hidden
*/
localMediaStreamWhenSubscribedToRemote: MediaStream;
/**
@ -495,6 +499,16 @@ export class Stream implements EventDispatcher {
});
delete this.mediaStream;
}
// If subscribeToRemote local MediaStream must be stopped
if (this.localMediaStreamWhenSubscribedToRemote) {
this.localMediaStreamWhenSubscribedToRemote.getAudioTracks().forEach((track) => {
track.stop();
});
this.localMediaStreamWhenSubscribedToRemote.getVideoTracks().forEach((track) => {
track.stop();
});
delete this.localMediaStreamWhenSubscribedToRemote;
}
if (!!this.speechEvent) {
if (!!this.speechEvent.stop) {
this.speechEvent.stop();
@ -863,6 +877,7 @@ export class Stream implements EventDispatcher {
this.isLocalStreamPublished = true;
this.publishedOnce = true;
if (this.displayMyRemote()) {
this.localMediaStreamWhenSubscribedToRemote = this.mediaStream;
this.remotePeerSuccessfullyEstablished();
}
if (reconnect) {

View File

@ -234,7 +234,7 @@ export class StreamManager implements EventDispatcher {
/**
* Makes `video` element parameter display this [[stream]]. This is useful when you are
* [managing the video elements on your own](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos/#you-take-care-of-the-video-players)
* [managing the video elements on your own](/en/stable/cheatsheet/manage-videos/#you-take-care-of-the-video-players)
*
* Calling this method with a video already added to other Publisher/Subscriber will cause the video element to be
* disassociated from that previous Publisher/Subscriber and to be associated to this one.
@ -351,7 +351,7 @@ export class StreamManager implements EventDispatcher {
}
/**
* Updates the current configuration for the [[PublisherSpeakingEvent]] feature and the [StreamManagerEvent.streamAudioVolumeChange](/api/openvidu-browser/classes/streammanagerevent.html) feature for this specific
* Updates the current configuration for the [[PublisherSpeakingEvent]] feature and the [StreamManagerEvent.streamAudioVolumeChange](/en/stable/api/openvidu-browser/classes/streammanagerevent.html) feature for this specific
* StreamManager audio stream, overriding the global options set with [[OpenVidu.setAdvancedConfiguration]]. This way you can customize the audio events options
* for each specific StreamManager and change them dynamically.
*

View File

@ -45,7 +45,7 @@ export class RecordingEvent extends Event {
* For 'recordingStopped' event:
* - "recordingStoppedByServer": the recording has been gracefully stopped by the application
* - "sessionClosedByServer": the Session has been closed by the application
* - "automaticStop": see [Automatic stop of recordings](https://docs.openvidu.io/en/stable/advanced-features/recording/#automatic-stop-of-recordings)
* - "automaticStop": see [Automatic stop of recordings](/en/stable/advanced-features/recording/#automatic-stop-of-recordings)
* - "mediaServerDisconnect": OpenVidu Media Node has crashed or lost its connection. A new Media Node instance is active and the recording has been stopped (no media streams are available in the new Media Node)
*
* For 'recordingStarted' empty string

View File

@ -22,7 +22,7 @@ import { StreamManager } from '../../OpenVidu/StreamManager';
/**
* Defines the following events:
* - `videoElementCreated`: dispatched by [[Publisher]] and [[Subscriber]] whenever a new HTML video element has been inserted into DOM by OpenVidu Browser library. See
* [Manage video players](https://docs.openvidu.io/en/stable/cheatsheet/manage-videos) section.
* [Manage video players](/en/stable/cheatsheet/manage-videos) section.
* - `videoElementDestroyed`: dispatched by [[Publisher]] and [[Subscriber]] whenever an HTML video element has been removed from DOM by OpenVidu Browser library.
*/
export class VideoElementEvent extends Event {

View File

@ -33,7 +33,7 @@ export interface OpenViduAdvancedConfiguration {
screenShareChromeExtension?: string;
/**
* Custom configuration for the [[PublisherSpeakingEvent]] feature and the [StreamManagerEvent.streamAudioVolumeChange](/api/openvidu-browser/classes/streammanagerevent.html) feature. It is an object which includes the following optional properties:
* Custom configuration for the [[PublisherSpeakingEvent]] feature and the [StreamManagerEvent.streamAudioVolumeChange](/en/stable/api/openvidu-browser/classes/streammanagerevent.html) feature. It is an object which includes the following optional properties:
* - `interval`: (number) how frequently the analyser polls the audio stream to check if speaking has started/stopped or audio volume has changed. Default **100** (ms)
* - `threshold`: (number) the volume at which _publisherStartSpeaking_ and _publisherStopSpeaking_ events will be fired. Default **-50** (dB)
*

View File

@ -11,6 +11,6 @@ openvidu-java-client
- **Docs**: [openvidu-java-client API](https://docs.openvidu.io/en/stable/reference-docs/openvidu-java-client/)
- **Release**: [OpenVidu Artifacts](https://docs.openvidu.io/en/stable/reference-docs/openvidu-artifacts/)
- **Release**: [OpenVidu Artifacts](https://docs.openvidu.io/en/stable/releases/)
[OpenViduLogo]: https://secure.gravatar.com/avatar/5daba1d43042f2e4e85849733c8e5702?s=120

View File

@ -1,8 +1,20 @@
#!/bin/sh
#!/bin/bash
if [[ -z "$BASEHREF_VERSION" ]]; then
echo "Example of use: \"BASEHREF_VERSION=2.12.0 ${0}\"" 1>&2
exit 1
fi
# Replace version from "stable" to the specified one in all Javadoc links
grep -rl '/en/stable/' ./src | xargs sed -i -e 's|/en/stable/|/en/'${BASEHREF_VERSION}'/|g'
# Generate JavaDoc
mvn javadoc:javadoc
rm -rf ../../openvidu.io/api/openvidu-java-client/*
cp -R ./target/site/apidocs/. ../../openvidu.io-docs/docs/api/openvidu-java-client
# Return links to "stable" version
grep -rl '/en/'${BASEHREF_VERSION}'/' ./src | xargs sed -i -e 's|/en/'${BASEHREF_VERSION}'/|/en/stable/|g'
# Add favicon to index.html
sed -i -e 's/<head>/<head><link rel=\"shortcut icon\" href=\"\/img\/favicon.ico\" type=\"image\/x-icon\">/g' ../../openvidu.io/api/openvidu-java-client/index.html
sed -i -e 's/<head>/<head><link rel=\"shortcut icon\" href=\"\/img\/favicon.ico\" type=\"image\/x-icon\">/g' ../../openvidu.io-docs/docs/api/openvidu-java-client/index.html

View File

@ -85,10 +85,10 @@ public class Connection {
}
/**
* <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block;
* background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding:
* 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px;
* line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
* <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display:
* inline-block; background-color: rgb(0, 136, 170); color: white; font-weight:
* bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size:
* 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
*
* Returns the geo location of the connection, with the following format:
* <code>"CITY, COUNTRY"</code> (<code>"unknown"</code> if it wasn't possible to
@ -117,9 +117,9 @@ public class Connection {
/**
* Returns the data associated to the connection on the client-side. This value
* is set with second parameter of method <a href=
* "https://openvidu.io/api/openvidu-browser/classes/session.html#connect"
* target="_blank">Session.connect</a> in OpenVidu Browser
* is set with second parameter of method
* <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/session.html#connect" target
* ="_blank">Session.connect</a> in OpenVidu Browser
*/
public String getClientData() {
return clientData;

View File

@ -107,8 +107,8 @@ public class KurentoOptions {
/**
* Defines the maximum number of Kbps that the client owning the token will be
* able to receive from Kurento Media Server. 0 means unconstrained. Giving a
* value to this property will override the global configuration set in <a href=
* "https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server"
* value to this property will override the global configuration set in <a
* href="https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server"
* target="_blank">OpenVidu Server configuration</a> (parameter
* <code>openvidu.streams.video.max-recv-bandwidth</code>) for every incoming
* stream of the user owning the token. <br>
@ -166,8 +166,8 @@ public class KurentoOptions {
/**
* Defines the names of the filters the user owning the token will be able to
* apply. See
* <a href="https://docs.openvidu.io/en/stable/advanced-features/filters/" target=
* "_blank">Voice and video filters</a>
* <a href="https://docs.openvidu.io/en/stable/advanced-features/filters/" target= "_blank">Voice and
* video filters</a>
*/
public String[] getAllowedFilters() {
return allowedFilters;

View File

@ -25,7 +25,7 @@ import com.google.gson.JsonObject;
*
* <br>
* This is a backend representation of a published media stream (see
* <a href="/api/openvidu-browser/classes/stream.html" target="_blank"> OpenVidu
* <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target="_blank"> OpenVidu
* Browser Stream class</a>).
*/
public class Publisher {
@ -65,10 +65,10 @@ public class Publisher {
/**
* Returns the unique identifier of the
* <a href="/api/openvidu-browser/classes/stream.html" target=
* <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target=
* "_blank">Stream</a> associated to this Publisher. Each Publisher is paired
* with only one Stream, so you can identify each Publisher by its
* <a href="/api/openvidu-browser/classes/stream.html#streamid" target=
* <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html#streamid" target=
* "_blank"><code>Stream.streamId</code></a>
*/
public String getStreamId() {
@ -84,7 +84,7 @@ public class Publisher {
}
/**
* See properties of <a href="/api/openvidu-browser/classes/stream.html" target=
* See properties of <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target=
* "_blank">Stream</a> object in OpenVidu Browser library to find out more
*/
public boolean hasVideo() {
@ -92,7 +92,7 @@ public class Publisher {
}
/**
* See properties of <a href="/api/openvidu-browser/classes/stream.html" target=
* See properties of <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target=
* "_blank">Stream</a> object in OpenVidu Browser library to find out more
*/
public boolean hasAudio() {
@ -100,7 +100,7 @@ public class Publisher {
}
/**
* See properties of <a href="/api/openvidu-browser/classes/stream.html" target=
* See properties of <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target=
* "_blank">Stream</a> object in OpenVidu Browser library to find out more
*/
public Boolean isAudioActive() {
@ -108,7 +108,7 @@ public class Publisher {
}
/**
* See properties of <a href="/api/openvidu-browser/classes/stream.html" target=
* See properties of <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target=
* "_blank">Stream</a> object in OpenVidu Browser library to find out more
*/
public Boolean isVideoActive() {
@ -116,7 +116,7 @@ public class Publisher {
}
/**
* See properties of <a href="/api/openvidu-browser/classes/stream.html" target=
* See properties of <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target=
* "_blank">Stream</a> object in OpenVidu Browser library to find out more
*/
public Integer getFrameRate() {
@ -124,7 +124,7 @@ public class Publisher {
}
/**
* See properties of <a href="/api/openvidu-browser/classes/stream.html" target=
* See properties of <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target=
* "_blank">Stream</a> object in OpenVidu Browser library to find out more
*/
public String getTypeOfVideo() {
@ -132,7 +132,7 @@ public class Publisher {
}
/**
* See properties of <a href="/api/openvidu-browser/classes/stream.html" target=
* See properties of <a href="https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/stream.html" target=
* "_blank">Stream</a> object in OpenVidu Browser library to find out more
*/
public String getVideoDimensions() {

View File

@ -195,8 +195,8 @@ public class Recording {
/**
* URL of the recording. You can access the file from there. It is
* <code>null</code> until recording reaches "ready" or "failed" status. If
* <a href="https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/"
* target="_blank">OpenVidu Server configuration</a> property
* <a href="https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/" target=
* "_blank">OpenVidu Server configuration</a> property
* <code>openvidu.recording.public-access</code> is false, this path will be
* secured with OpenVidu credentials
*/

View File

@ -46,8 +46,8 @@ public enum RecordingLayout {
HORIZONTAL_PRESENTATION,
/**
* Use your own custom recording layout. See <a href=
* "https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* Use your own custom recording layout. See
* <a href="https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* target="_blank">Custom recording layouts</a> to learn more
*/
CUSTOM

View File

@ -102,8 +102,7 @@ public class RecordingProperties {
* {@link io.openvidu.java.client.RecordingProperties.Builder#outputMode(Recording.OutputMode)}
* has been called with value
* {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED}.<br>
* See <a href=
* "https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* See <a href="https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* target="_blank">Custom recording layouts</a> to learn more
*/
public RecordingProperties.Builder customLayout(String path) {
@ -197,8 +196,7 @@ public class RecordingProperties {
* If {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} is
* set to {@link io.openvidu.java.client.RecordingLayout#CUSTOM}, this property
* defines the relative path to the specific custom layout you want to use.<br>
* See <a href=
* "https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* See <a href="https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* target="_blank">Custom recording layouts</a> to learn more
*/
public String customLayout() {

View File

@ -11,6 +11,6 @@ openvidu-node-client
- **Docs**: [openvidu-node-client API](https://docs.openvidu.io/en/stable/reference-docs/openvidu-node-client/)
- **Release**: [OpenVidu Artifacts](https://docs.openvidu.io/en/stable/reference-docs/openvidu-artifacts/)
- **Release**: [OpenVidu Artifacts](https://docs.openvidu.io/en/stable/releases/)
[OpenViduLogo]: https://secure.gravatar.com/avatar/5daba1d43042f2e4e85849733c8e5702?s=120

View File

@ -12,6 +12,10 @@ module.exports = {
externalPattern: "node_modules",
excludeExternals: true,
excludePrivate: true,
excludeNotExported: true,
theme: "default",
readme: "none"
readme: "none",
includeVersion: true,
listInvalidSymbolLinks: true,
out: "./docs"
}

View File

@ -0,0 +1,19 @@
#!/bin/bash
if [[ -z "$BASEHREF_VERSION" ]]; then
echo "Example of use: \"BASEHREF_VERSION=2.12.0 ${0}\"" 1>&2
exit 1
fi
# Replace version from "stable" to the specified one in all TypeDoc links
grep -rl '/en/stable/' src | xargs sed -i -e 's|/en/stable/|/en/'${BASEHREF_VERSION}'/|g'
# Generate TypeDoc
./node_modules/typedoc/bin/typedoc --options ./config/typedoc.js ./src
# Return links to "stable" version
grep -rl '/en/'${BASEHREF_VERSION}'/' src | xargs sed -i -e 's|/en/'${BASEHREF_VERSION}'/|/en/stable/|g'
# Clean previous docs from openvidu.io-docs repo and copy new ones
rm -rf ../../openvidu.io-docs/docs/api/openvidu-node-client/*
cp -R ./docs/. ../../openvidu.io-docs/docs/api/openvidu-node-client

View File

@ -5,35 +5,35 @@
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
"integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
"integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
"dev": true,
"requires": {
"@babel/highlight": "^7.0.0"
"@babel/highlight": "^7.8.3"
}
},
"@babel/helper-validator-identifier": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz",
"integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==",
"dev": true
},
"@babel/highlight": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
"integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz",
"integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==",
"dev": true,
"requires": {
"@babel/helper-validator-identifier": "^7.9.0",
"chalk": "^2.0.0",
"esutils": "^2.0.2",
"js-tokens": "^4.0.0"
}
},
"@types/minimatch": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
"dev": true
},
"@types/node": {
"version": "12.12.14",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.14.tgz",
"integrity": "sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==",
"version": "13.11.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.11.0.tgz",
"integrity": "sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==",
"dev": true
},
"abbrev": {
@ -79,9 +79,9 @@
}
},
"arg": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.2.tgz",
"integrity": "sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg==",
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
"dev": true
},
"argparse": {
@ -168,21 +168,11 @@
"dev": true
},
"axios": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
}
},
"backbone": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/backbone/-/backbone-1.4.0.tgz",
"integrity": "sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ==",
"dev": true,
"requires": {
"underscore": ">=1.8.3"
"follow-redirects": "1.5.10"
}
},
"balanced-match": {
@ -319,9 +309,9 @@
}
},
"buffer": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz",
"integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==",
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.5.0.tgz",
"integrity": "sha512-9FTEDjLjwoAkEwyMGDjYJQN2gfRgOKBKRfiglhvibGbpeeU/pQn1bJxQqm32OD/AIeEuHxU9roxXxg34Byp/Ww==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
@ -703,12 +693,6 @@
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
},
"eventemitter2": {
"version": "0.4.14",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz",
@ -1024,9 +1008,9 @@
"dev": true
},
"fsevents": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz",
"integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==",
"version": "1.2.12",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.12.tgz",
"integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==",
"dev": true,
"optional": true,
"requires": {
@ -1080,7 +1064,7 @@
}
},
"chownr": {
"version": "1.1.3",
"version": "1.1.4",
"bundled": true,
"dev": true,
"optional": true
@ -1252,7 +1236,7 @@
}
},
"minimist": {
"version": "0.0.8",
"version": "1.2.5",
"bundled": true,
"dev": true,
"optional": true
@ -1277,12 +1261,12 @@
}
},
"mkdirp": {
"version": "0.5.1",
"version": "0.5.3",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
"minimist": "^1.2.5"
}
},
"ms": {
@ -1292,7 +1276,7 @@
"optional": true
},
"needle": {
"version": "2.4.0",
"version": "2.3.3",
"bundled": true,
"dev": true,
"optional": true,
@ -1321,7 +1305,7 @@
}
},
"nopt": {
"version": "4.0.1",
"version": "4.0.3",
"bundled": true,
"dev": true,
"optional": true,
@ -1346,13 +1330,14 @@
"optional": true
},
"npm-packlist": {
"version": "1.4.7",
"version": "1.4.8",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ignore-walk": "^3.0.1",
"npm-bundled": "^1.0.1"
"npm-bundled": "^1.0.1",
"npm-normalize-package-bin": "^1.0.1"
}
},
"npmlog": {
@ -1432,18 +1417,10 @@
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"bundled": true,
"dev": true,
"optional": true
}
}
},
"readable-stream": {
"version": "2.3.6",
"version": "2.3.7",
"bundled": true,
"dev": true,
"optional": true,
@ -1657,13 +1634,13 @@
}
},
"globule": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.0.tgz",
"integrity": "sha512-YlD4kdMqRCQHrhVdonet4TdRtv1/sZKepvoxNT4Nrhrp5HI8XFfc8kFlGlBn2myBo80aGp8Eft259mbcUJhgSg==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
"integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==",
"dev": true,
"requires": {
"glob": "~7.1.1",
"lodash": "~4.17.10",
"lodash": "~4.17.12",
"minimatch": "~3.0.2"
},
"dependencies": {
@ -1690,9 +1667,9 @@
"dev": true
},
"grunt": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.4.tgz",
"integrity": "sha512-PYsMOrOC+MsdGEkFVwMaMyc6Ob7pKmq+deg1Sjr+vvMWp35sztfwKE7qoN51V+UEtHsyNuMcGdgMLFkBHvMxHQ==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.1.0.tgz",
"integrity": "sha512-+NGod0grmviZ7Nzdi9am7vuRS/h76PcWDsV635mEXF0PEQMUV6Kb+OjTdsVxbi0PZmfQOjCMKb3w8CVZcqsn1g==",
"dev": true,
"requires": {
"coffeescript": "~1.10.0",
@ -1706,9 +1683,9 @@
"grunt-legacy-log": "~2.0.0",
"grunt-legacy-util": "~1.1.1",
"iconv-lite": "~0.4.13",
"js-yaml": "~3.13.0",
"js-yaml": "~3.13.1",
"minimatch": "~3.0.2",
"mkdirp": "~0.5.1",
"mkdirp": "~1.0.3",
"nopt": "~3.0.6",
"path-is-absolute": "~1.0.0",
"rimraf": "~2.6.2"
@ -1748,9 +1725,9 @@
},
"dependencies": {
"nopt": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz",
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",
"integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",
"dev": true,
"requires": {
"abbrev": "1",
@ -2014,15 +1991,16 @@
}
},
"handlebars": {
"version": "4.5.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
"integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
"version": "4.7.6",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz",
"integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==",
"dev": true,
"requires": {
"minimist": "^1.2.5",
"neo-async": "^2.6.0",
"optimist": "^0.6.1",
"source-map": "^0.6.1",
"uglify-js": "^3.1.4"
"uglify-js": "^3.1.4",
"wordwrap": "^1.0.0"
},
"dependencies": {
"source-map": {
@ -2069,12 +2047,6 @@
"kind-of": "^4.0.0"
},
"dependencies": {
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"kind-of": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
@ -2087,13 +2059,10 @@
}
},
"highlight.js": {
"version": "9.17.1",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.17.1.tgz",
"integrity": "sha512-TA2/doAur5Ol8+iM3Ov7qy3jYcr/QiJ2eDTdRF4dfbjG7AaaB99J5G+zSl11ljbl6cIcahgPY6SKb3sC3EJ0fw==",
"dev": true,
"requires": {
"handlebars": "^4.5.3"
}
"version": "9.18.1",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.1.tgz",
"integrity": "sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg==",
"dev": true
},
"homedir-polyfill": {
"version": "1.0.3",
@ -2111,9 +2080,9 @@
"dev": true
},
"hosted-git-info": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
"integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
"dev": true
},
"http-parser-js": {
@ -2192,12 +2161,6 @@
"kind-of": "^3.0.2"
},
"dependencies": {
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -2225,9 +2188,10 @@
}
},
"is-buffer": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"is-data-descriptor": {
"version": "0.1.4",
@ -2238,12 +2202,6 @@
"kind-of": "^3.0.2"
},
"dependencies": {
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -2287,13 +2245,10 @@
"dev": true
},
"is-finite": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz",
"integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=",
"dev": true,
"requires": {
"number-is-nan": "^1.0.0"
}
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz",
"integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==",
"dev": true
},
"is-glob": {
"version": "3.1.0",
@ -2313,12 +2268,6 @@
"kind-of": "^3.0.2"
},
"dependencies": {
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -2387,12 +2336,6 @@
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
"dev": true
},
"jquery": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==",
"dev": true
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -2425,9 +2368,9 @@
}
},
"kind-of": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
"dev": true
},
"liftoff": {
@ -2508,9 +2451,9 @@
"dev": true
},
"make-error": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz",
"integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==",
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
"dev": true
},
"make-iterator": {
@ -2637,9 +2580,9 @@
}
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
},
"mixin-deep": {
@ -2664,21 +2607,10 @@
}
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
"minimist": "0.0.8"
},
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
}
}
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true
},
"ms": {
"version": "2.0.0",
@ -2782,12 +2714,6 @@
"is-descriptor": "^0.1.0"
}
},
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -2848,24 +2774,6 @@
"wrappy": "1"
}
},
"optimist": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
"integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
"dev": true,
"requires": {
"minimist": "~0.0.1",
"wordwrap": "~0.0.2"
},
"dependencies": {
"minimist": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
"dev": true
}
}
},
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
@ -3041,9 +2949,9 @@
"dev": true
},
"qs": {
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.1.tgz",
"integrity": "sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==",
"version": "6.9.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.3.tgz",
"integrity": "sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw==",
"dev": true
},
"raw-body": {
@ -3078,9 +2986,9 @@
}
},
"readable-stream": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
@ -3177,9 +3085,9 @@
}
},
"resolve": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz",
"integrity": "sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==",
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
"integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@ -3306,9 +3214,9 @@
}
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"dev": true
},
"snapdragon": {
@ -3416,12 +3324,6 @@
"kind-of": "^3.2.0"
},
"dependencies": {
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -3615,12 +3517,6 @@
"kind-of": "^3.0.2"
},
"dependencies": {
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -3661,36 +3557,36 @@
"dev": true
},
"ts-node": {
"version": "8.5.4",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.5.4.tgz",
"integrity": "sha512-izbVCRV68EasEPQ8MSIGBNK9dc/4sYJJKYA+IarMQct1RtEot6Xp0bXuClsbUSnKpg50ho+aOAx8en5c+y4OFw==",
"version": "8.8.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz",
"integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==",
"dev": true,
"requires": {
"arg": "^4.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"source-map-support": "^0.5.6",
"yn": "^3.0.0"
"yn": "3.1.1"
},
"dependencies": {
"diff": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
"integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==",
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
}
}
},
"tslib": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
"integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==",
"dev": true
},
"tslint": {
"version": "5.20.1",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz",
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.1.tgz",
"integrity": "sha512-kd6AQ/IgPRpLn6g5TozqzPdGNZ0q0jtXW4//hRcj10qLYBaa3mTUU2y2MCG+RXZm8Zx+KZi0eA+YCrMyNlF4UA==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@ -3701,17 +3597,17 @@
"glob": "^7.1.1",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"mkdirp": "^0.5.3",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tslib": "^1.10.0",
"tsutils": "^2.29.0"
},
"dependencies": {
"diff": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
"integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==",
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
},
"glob": {
@ -3727,6 +3623,15 @@
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
}
}
},
@ -3740,46 +3645,41 @@
}
},
"typedoc": {
"version": "0.15.6",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.15.6.tgz",
"integrity": "sha512-TC3j7HXFfyq0/NyUL9oLgEXhgO4U8Kd7iyRgagkG3XxehgTjn6w20uJ/Hif1KPB/65VQZ8uMYYyxFXNj9um5Ow==",
"version": "0.17.3",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.17.3.tgz",
"integrity": "sha512-sCKyLeXMUYHyul0kd/jSGSGY+o7lfLvbNlnp8kAamQSLPp/f4EOOR50JGjwfYEQkEeETWMXILdU4UUXS42MmSQ==",
"dev": true,
"requires": {
"@types/minimatch": "3.0.3",
"fs-extra": "^8.1.0",
"handlebars": "^4.5.3",
"highlight.js": "^9.17.1",
"handlebars": "^4.7.3",
"highlight.js": "^9.18.1",
"lodash": "^4.17.15",
"marked": "^0.8.0",
"marked": "0.8.0",
"minimatch": "^3.0.0",
"progress": "^2.0.3",
"shelljs": "^0.8.3",
"typedoc-default-themes": "^0.6.3",
"typescript": "3.7.x"
"typedoc-default-themes": "^0.9.0"
}
},
"typedoc-default-themes": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.6.3.tgz",
"integrity": "sha512-rouf0TcIA4M2nOQFfC7Zp4NEwoYiEX4vX/ZtudJWU9IHA29MPC+PPgSXYLPESkUo7FuB//GxigO3mk9Qe1xp3Q==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.9.0.tgz",
"integrity": "sha512-ExfIAg3EjZvWnnDsv2wQcZ9I8Lnln643LsfV05BrRGcIMSYPuavils96j4yGXiBYUzldIYw3xmZ7rsdqWfDunQ==",
"dev": true,
"requires": {
"backbone": "^1.4.0",
"jquery": "^3.4.1",
"lunr": "^2.3.8",
"underscore": "^1.9.1"
"lunr": "^2.3.8"
}
},
"typescript": {
"version": "3.7.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz",
"integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==",
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
"dev": true
},
"uglify-js": {
"version": "3.7.3",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.3.tgz",
"integrity": "sha512-7tINm46/3puUA4hCkKYo4Xdts+JDaVC9ZPRcG8Xw9R4nhO/gZgUM3TENq8IF4Vatk8qCig4MzP/c8G4u2BkVQg==",
"version": "3.8.1",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.1.tgz",
"integrity": "sha512-W7KxyzeaQmZvUFbGj4+YFshhVrMBGSg2IbcYAjGWGvx8DHvJMclbTDMpffdxFUGPBHjIytk7KJUR/KUXstUGDw==",
"dev": true,
"requires": {
"commander": "~2.20.3",
@ -3800,12 +3700,6 @@
"integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=",
"dev": true
},
"underscore": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz",
"integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==",
"dev": true
},
"underscore.string": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz",
@ -3950,9 +3844,9 @@
}
},
"wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
"dev": true
},
"wrappy": {

View File

@ -1,13 +1,13 @@
{
"author": "OpenVidu",
"dependencies": {
"axios": "0.19.0",
"buffer": "5.4.3"
"axios": "0.19.2",
"buffer": "5.5.0"
},
"description": "OpenVidu Node Client",
"devDependencies": {
"@types/node": "12.12.14",
"grunt": "1.0.4",
"@types/node": "13.11.0",
"grunt": "1.1.0",
"grunt-cli": "1.3.2",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-sass": "1.0.0",
@ -16,10 +16,10 @@
"grunt-postcss": "0.9.0",
"grunt-string-replace": "1.3.1",
"grunt-ts": "6.0.0-beta.22",
"ts-node": "8.5.4",
"tslint": "5.20.1",
"typedoc": "0.15.6",
"typescript": "3.7.4"
"ts-node": "8.8.2",
"tslint": "6.1.1",
"typedoc": "0.17.3",
"typescript": "3.8.3"
},
"license": "Apache-2.0",
"main": "lib/index.js",
@ -30,7 +30,7 @@
},
"scripts": {
"build": "./node_modules/typescript/bin/tsc",
"docs": "./node_modules/typedoc/bin/typedoc --options ./config/typedoc.js --out ./docs ./src && rm -rf ../../openvidu.io-docs/docs/api/openvidu-node-client/* && cp -R ./docs/. ../../openvidu.io-docs/docs/api/openvidu-node-client"
"docs": "./generate-docs.sh"
},
"typings": "lib/index.d.ts",
"version": "2.12.0"

View File

@ -61,7 +61,7 @@ export class Connection {
/**
* Data associated to the connection on the client-side. This value is set with second parameter of method
* [Session.connect](/api/openvidu-browser/classes/session.html#connect) in OpenVidu Browser
* [Session.connect](/en/stable/api/openvidu-browser/classes/session.html#connect) in OpenVidu Browser
*/
clientData: string;

View File

@ -19,14 +19,14 @@
/**
* See [[Connection.publishers]]
*
* This is a backend representation of a published media stream (see [OpenVidu Browser Stream class](/api/openvidu-browser/classes/stream.html))
* This is a backend representation of a published media stream (see [OpenVidu Browser Stream class](/en/stable/api/openvidu-browser/classes/stream.html))
*/
export class Publisher {
/**
* Unique identifier of the [Stream](/api/openvidu-browser/classes/stream.html) associated to this Publisher.
* Unique identifier of the [Stream](/en/stable/api/openvidu-browser/classes/stream.html) associated to this Publisher.
* Each Publisher is paired with only one Stream, so you can identify each Publisher by its
* [`Stream.streamId`](/api/openvidu-browser/classes/stream.html#streamid)
* [`Stream.streamId`](/en/stable/api/openvidu-browser/classes/stream.html#streamid)
*/
streamId: string;
@ -36,37 +36,37 @@ export class Publisher {
createdAt: number;
/**
* See properties of [Stream](/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
* See properties of [Stream](/en/stable/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
*/
hasAudio: boolean;
/**
* See properties of [Stream](/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
* See properties of [Stream](/en/stable/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
*/
hasVideo: boolean;
/**
* See properties of [Stream](/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
* See properties of [Stream](/en/stable/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
*/
audioActive: boolean;
/**
* See properties of [Stream](/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
* See properties of [Stream](/en/stable/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
*/
videoActive: boolean;
/**
* See properties of [Stream](/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
* See properties of [Stream](/en/stable/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
*/
frameRate: number;
/**
* See properties of [Stream](/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
* See properties of [Stream](/en/stable/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
*/
typeOfVideo: string;
/**
* See properties of [Stream](/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
* See properties of [Stream](/en/stable/api/openvidu-browser/classes/stream.html) object in OpenVidu Browser library to find out more
*/
videoDimensions: string;

View File

@ -41,7 +41,7 @@ export enum RecordingLayout {
HORIZONTAL_PRESENTATION = 'VERTICAL_PRESENTATION',
/**
* Use your own custom recording layout. See [Custom recording layouts](https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts) to learn more
* Use your own custom recording layout. See [Custom recording layouts](/en/stable/advanced-features/recording#custom-recording-layouts) to learn more
*/
CUSTOM = 'CUSTOM'
}

View File

@ -44,7 +44,7 @@ export interface RecordingProperties {
/**
* The relative path to the specific custom layout you want to use.<br>
* Will only have effect if [[RecordingProperties.outputMode]] is `COMPOSED` and [[RecordingProperties.recordingLayout]] is `CUSTOM`<br>
* See [Custom recording layouts](https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts) to learn more
* See [Custom recording layouts](/en/stable/advanced-features/recording#custom-recording-layouts) to learn more
*/
customLayout?: string;

View File

@ -41,20 +41,20 @@ export interface TokenOptions {
* Some advanced properties setting the configuration that the WebRTC streams of the user owning the token will have in Kurento Media Server.
* You can adjust:
* - `videoMaxRecvBandwidth`: maximum number of Kbps that the client owning the token will be able to receive from Kurento Media Server. 0 means unconstrained. Giving a value to this property will override
* the global configuration set in [OpenVidu Server configuration](https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server)
* the global configuration set in [OpenVidu Server configuration](/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server)
* (parameter `openvidu.streams.video.max-recv-bandwidth`) for every incoming stream of the user owning the token.
* _**WARNING**: the lower value set to this property limits every other bandwidth of the WebRTC pipeline this server-to-client stream belongs to. This includes the user publishing the stream and every other user subscribed to the stream_
* - `videoMinRecvBandwidth`: minimum number of Kbps that the client owning the token will try to receive from Kurento Media Server. 0 means unconstrained. Giving a value to this property will override
* the global configuration set in [OpenVidu Server configuration](https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server)
* the global configuration set in [OpenVidu Server configuration](/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server)
* (parameter `openvidu.streams.video.min-recv-bandwidth`) for every incoming stream of the user owning the token
* - `videoMaxSendBandwidth`: maximum number of Kbps that the client owning the token will be able to send to Kurento Media Server. 0 means unconstrained. Giving a value to this property will override
* the global configuration set in [OpenVidu Server configuration](https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server)
* the global configuration set in [OpenVidu Server configuration](/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server)
* (parameter `openvidu.streams.video.max-send-bandwidth`) for every outgoing stream of the user owning the token.
* _**WARNING**: this value limits every other bandwidth of the WebRTC pipeline this client-to-server stream belongs to. This includes every other user subscribed to the stream_
* - `videoMinSendBandwidth`: minimum number of Kbps that the client owning the token will try to send to Kurento Media Server. 0 means unconstrained. Giving a value to this property will override
* the global configuration set in [OpenVidu Server configuration](https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server)
* the global configuration set in [OpenVidu Server configuration](/en/stable/reference-docs/openvidu-server-params/#configuration-parameters-for-openvidu-server)
* (parameter `openvidu.streams.video.min-send-bandwidth`) for every outgoing stream of the user owning the token
* - `allowedFilters`: names of the filters the user owning the token will be able to apply. See [Voice and video filters](https://docs.openvidu.io/en/stable/advanced-features/filters/)
* - `allowedFilters`: names of the filters the user owning the token will be able to apply. See [Voice and video filters](/en/stable/advanced-features/filters/)
*/
kurentoOptions?: {
videoMaxRecvBandwidth?: number,

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -105,6 +107,13 @@
<artifactId>maven-enforcer-plugin</artifactId>
<version>${version.enforcer.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
</plugin>
</plugins>
</build>
</profile>
@ -315,26 +324,23 @@
<!-- Test dependencies -->
<dependency>
<groupId>io.openvidu</groupId>
<artifactId>openvidu-test</artifactId>
<version>${version.openvidu.test}</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${version.spring-boot}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${version.powermock}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>

View File

@ -48,7 +48,7 @@ public class CDREventEnd extends CDREvent {
json.addProperty("duration", this.duration);
}
if (this.reason != null) {
json.addProperty("reason", this.reason != null ? reason.name() : "");
json.addProperty("reason", reason.name());
}
return json;
}

View File

@ -25,6 +25,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import org.kurento.client.GenericMediaEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import io.openvidu.java.client.Recording.Status;
@ -91,6 +93,8 @@ import io.openvidu.server.webhook.CDRLoggerWebhook;
*/
public class CallDetailRecord {
private static final Logger log = LoggerFactory.getLogger(CallDetailRecord.class);
@Autowired
private SessionManager sessionManager;
@ -193,6 +197,8 @@ public class CallDetailRecord {
.get(participantPublicId).addSubscriberClosed(streamId, eventSubscriberEnd);
}
}
} else {
log.error("No subscriptions map in CDR for session participant {}", participantPublicId);
}
}

View File

@ -157,6 +157,11 @@ public class OpenviduConfig {
private String certificateType;
protected int openviduSessionsGarbageInterval;
protected int openviduSessionsGarbageThreshold;
// Derived properties
public static String finalUrl;
@ -267,6 +272,14 @@ public class OpenviduConfig {
return webhookEventsList;
}
public int getSessionGarbageInterval() {
return openviduSessionsGarbageInterval;
}
public int getSessionGarbageThreshold() {
return openviduSessionsGarbageThreshold;
}
// Derived properties methods
public String getSpringProfile() {

View File

@ -19,13 +19,18 @@ package io.openvidu.server.core;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.apache.commons.lang3.RandomStringUtils;
@ -82,8 +87,8 @@ public abstract class SessionManager {
public FormatChecker formatChecker = new FormatChecker();
protected ConcurrentMap<String, Session> sessions = new ConcurrentHashMap<>();
protected ConcurrentMap<String, Session> sessionsNotActive = new ConcurrentHashMap<>();
final protected ConcurrentMap<String, Session> sessions = new ConcurrentHashMap<>();
final protected ConcurrentMap<String, Session> sessionsNotActive = new ConcurrentHashMap<>();
protected ConcurrentMap<String, ConcurrentHashMap<String, Participant>> sessionidParticipantpublicidParticipant = new ConcurrentHashMap<>();
protected ConcurrentMap<String, ConcurrentHashMap<String, FinalUser>> sessionidFinalUsers = new ConcurrentHashMap<>();
protected ConcurrentMap<String, ConcurrentLinkedQueue<CDREventRecording>> sessionidAccumulatedRecordings = new ConcurrentHashMap<>();
@ -281,7 +286,10 @@ public abstract class SessionManager {
public Session storeSessionNotActive(Session sessionNotActive) {
final String sessionId = sessionNotActive.getSessionId();
this.sessionsNotActive.put(sessionId, sessionNotActive);
if (this.sessionsNotActive.putIfAbsent(sessionId, sessionNotActive) != null) {
log.warn("Concurrent initialization of session {}", sessionId);
return this.sessionsNotActive.get(sessionId);
}
this.initializeCollections(sessionId);
return sessionNotActive;
}
@ -417,6 +425,58 @@ public abstract class SessionManager {
}
}
@PostConstruct
private void startSessionGarbageCollector() {
if (openviduConfig.getSessionGarbageInterval() == 0) {
log.info(
"Garbage collector for non active sessions is disabled (property 'openvidu.sessions.garbage.interval' is 0)");
return;
}
TimerTask task = new TimerTask() {
@Override
public void run() {
// Remove all non active sessions created more than the specified time
log.info("Running non active sessions garbage collector...");
final long currentMillis = System.currentTimeMillis();
// Loop through all non active sessions. Safely remove them and clean all of
// their data if their threshold has elapsed
for (Iterator<Entry<String, Session>> iter = sessionsNotActive.entrySet().iterator(); iter.hasNext();) {
final Session sessionNotActive = iter.next().getValue();
final String sessionId = sessionNotActive.getSessionId();
long sessionExistsSince = currentMillis - sessionNotActive.getStartTime();
if (sessionExistsSince > (openviduConfig.getSessionGarbageThreshold() * 1000)) {
try {
sessionNotActive.closingLock.writeLock().lock();
if (sessions.containsKey(sessionId)) {
// The session passed to active during lock wait
continue;
}
iter.remove();
cleanCollections(sessionId);
log.info("Non active session {} cleaned up by garbage collector", sessionId);
} finally {
sessionNotActive.closingLock.writeLock().unlock();
}
}
}
// Warn about possible ghost sessions
for (Iterator<Entry<String, Session>> iter = sessions.entrySet().iterator(); iter.hasNext();) {
final Session sessionActive = iter.next().getValue();
if (sessionActive.getParticipants().size() == 0) {
log.warn("Possible ghost session {}", sessionActive.getSessionId());
}
}
}
};
new Timer().scheduleAtFixedRate(task, openviduConfig.getSessionGarbageInterval() * 1000,
openviduConfig.getSessionGarbageInterval() * 1000);
log.info(
"Garbage collector for non active sessions initialized. Running every {} seconds and cleaning up non active Sessions more than {} seconds old",
openviduConfig.getSessionGarbageInterval(), openviduConfig.getSessionGarbageThreshold());
}
/**
* Closes an existing session by releasing all resources that were allocated for
* it. Once closed, the session can be reopened (will be empty and it will use
@ -480,7 +540,12 @@ public abstract class SessionManager {
final String mediaNodeId = session.getMediaNodeId();
if (session.close(reason)) {
sessionEventsHandler.onSessionClosed(session.getSessionId(), reason);
try {
sessionEventsHandler.onSessionClosed(session.getSessionId(), reason);
} catch (Exception e) {
log.error("Error recording 'sessionDestroyed' event for session {}: {} - {}", session.getSessionId(),
e.getClass().getName(), e.getMessage());
}
}
this.cleanCollections(session.getSessionId());

View File

@ -520,9 +520,9 @@ public class KurentoParticipant extends Participant {
private JsonObject sharedJson(Function<MediaEndpoint, JsonObject> toJsonFunction) {
JsonObject json = super.toJson();
JsonArray publisherEnpoints = new JsonArray();
JsonArray publisherEndpoints = new JsonArray();
if (this.streaming && this.publisher.getEndpoint() != null) {
publisherEnpoints.add(toJsonFunction.apply(this.publisher));
publisherEndpoints.add(toJsonFunction.apply(this.publisher));
}
JsonArray subscriberEndpoints = new JsonArray();
for (MediaEndpoint sub : this.subscribers.values()) {
@ -530,7 +530,7 @@ public class KurentoParticipant extends Participant {
subscriberEndpoints.add(toJsonFunction.apply(sub));
}
}
json.add("publishers", publisherEnpoints);
json.add("publishers", publisherEndpoints);
json.add("subscribers", subscriberEndpoints);
return json;
}

View File

@ -46,7 +46,7 @@ import io.openvidu.server.kurento.kms.Kms;
*/
public class KurentoSession extends Session {
private final static Logger log = LoggerFactory.getLogger(Session.class);
private final static Logger log = LoggerFactory.getLogger(KurentoSession.class);
public static final int ASYNC_LATCH_TIMEOUT = 30;
private MediaPipeline pipeline;

View File

@ -26,6 +26,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -81,7 +82,10 @@ public class KurentoSessionManager extends SessionManager {
@Autowired
private KurentoParticipantEndpointConfig kurentoEndpointConfig;
private final int MS_MAX_LOCK_WAIT = 15;
@Override
/* Protected by Session.closingLock.readLock */
public synchronized void joinRoom(Participant participant, String sessionId, Integer transactionId) {
Set<Participant> existingParticipants = null;
boolean lockAcquired = false;
@ -102,21 +106,36 @@ public class KurentoSessionManager extends SessionManager {
openviduConfig, recordingManager);
}
lockAcquired = true;
KmsManager.selectAndRemoveKmsLock.lock();
Kms lessLoadedKms = null;
try {
lessLoadedKms = this.kmsManager.getLessLoadedAndRunningKms();
} catch (NoSuchElementException e) {
// Restore session not active
this.cleanCollections(sessionId);
this.storeSessionNotActive(sessionNotActive);
throw new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE,
"There is no available Media Node where to initialize session '" + sessionId + "'");
if (KmsManager.selectAndRemoveKmsLock.tryLock(MS_MAX_LOCK_WAIT, TimeUnit.SECONDS)) {
lockAcquired = true;
Kms lessLoadedKms = null;
try {
lessLoadedKms = this.kmsManager.getLessLoadedConnectedAndRunningKms();
} catch (NoSuchElementException e) {
// Restore session not active
this.cleanCollections(sessionId);
this.storeSessionNotActive(sessionNotActive);
throw new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE,
"There is no available Media Node where to initialize session '" + sessionId + "'");
}
log.info("KMS less loaded is {} with a load of {}", lessLoadedKms.getUri(),
lessLoadedKms.getLoad());
kSession = createSession(sessionNotActive, lessLoadedKms);
} else {
String error = "Timeout of " + MS_MAX_LOCK_WAIT + " seconds waiting to acquire lock";
log.error(error);
sessionEventsHandler.onParticipantJoined(participant, sessionId, null, transactionId,
new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE, error));
return;
}
} catch (InterruptedException e) {
String error = "'" + participant.getParticipantPublicId() + "' is trying to join session '"
+ sessionId + "' but was interrupted while waiting to acquire lock: " + e.getMessage();
log.error(error);
throw new OpenViduException(Code.ROOM_CLOSED_ERROR_CODE, error);
}
log.info("KMS less loaded is {} with a load of {}", lessLoadedKms.getUri(), lessLoadedKms.getLoad());
kSession = createSession(sessionNotActive, lessLoadedKms);
}
if (kSession.isClosed()) {
@ -145,7 +164,9 @@ public class KurentoSessionManager extends SessionManager {
@Override
public synchronized boolean leaveRoom(Participant participant, Integer transactionId, EndReason reason,
boolean closeWebSocket) {
log.debug("Request [LEAVE_ROOM] ({})", participant.getParticipantPublicId());
log.info("Request [LEAVE_ROOM] for participant {} of session {} with reason {}",
participant.getParticipantPublicId(), participant.getSessionId(),
reason != null ? reason.name() : "NULL");
boolean sessionClosedByLastParticipant = false;
@ -171,15 +192,18 @@ public class KurentoSessionManager extends SessionManager {
this.coturnCredentialsService.deleteUser(p.getToken().getTurnCredentials().getUsername());
}
boolean stillParticipant = false;
for (Session s : sessions.values()) {
if (s.getParticipantByPrivateId(p.getParticipantPrivateId()) != null) {
stillParticipant = true;
break;
// TODO: why is this necessary??
if (insecureUsers.containsKey(p.getParticipantPrivateId())) {
boolean stillParticipant = false;
for (Session s : sessions.values()) {
if (!s.isClosed() && (s.getParticipantByPrivateId(p.getParticipantPrivateId()) != null)) {
stillParticipant = true;
break;
}
}
if (!stillParticipant) {
insecureUsers.remove(p.getParticipantPrivateId());
}
}
if (!stillParticipant) {
insecureUsers.remove(p.getParticipantPrivateId());
}
}
@ -866,6 +890,7 @@ public class KurentoSessionManager extends SessionManager {
}
@Override
/* Protected by Session.closingLock.readLock */
public Participant publishIpcam(Session session, MediaOptions mediaOptions, String serverMetadata)
throws Exception {
final String sessionId = session.getSessionId();

View File

@ -23,6 +23,7 @@ import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import org.kurento.client.BaseRtpEndpoint;
import org.kurento.client.Continuation;
@ -92,7 +93,10 @@ public abstract class MediaEndpoint {
public String selectedLocalIceCandidate;
public String selectedRemoteIceCandidate;
public Queue<KmsEvent> kmsEvents = new ConcurrentLinkedQueue<>();
public Future<?> kmsWebrtcStatsThread;
public Runnable kmsWebrtcStatsRunnable;
public AtomicInteger statsNotFoundErrors = new AtomicInteger(0);
/**
* Constructor to set the owner, the endpoint's name and the media pipeline.

View File

@ -23,7 +23,10 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
@ -43,8 +46,14 @@ import io.openvidu.server.utils.MediaNodeStatusManager;
public abstract class KmsManager {
protected static final Logger log = LoggerFactory.getLogger(KmsManager.class);
public static final Lock selectAndRemoveKmsLock = new ReentrantLock(true);
private Map<String, Lock> kmsReconnectionLocks = new ConcurrentHashMap<>();
private final int DISCONNECTED_INTERVAL_SECONDS = 12;
public class KmsLoad implements Comparable<KmsLoad> {
private Kms kms;
@ -81,8 +90,6 @@ public abstract class KmsManager {
}
}
protected static final Logger log = LoggerFactory.getLogger(KmsManager.class);
@Autowired
protected OpenviduConfig openviduConfig;
@ -102,9 +109,9 @@ public abstract class KmsManager {
return this.kmss.remove(kmsId);
}
public synchronized Kms getLessLoadedAndRunningKms() throws NoSuchElementException {
List<KmsLoad> kmsLoads = getKmsLoads().stream()
.filter(kmsLoad -> mediaNodeStatusManager.isRunning(kmsLoad.kms.getId())).collect(Collectors.toList());
public synchronized Kms getLessLoadedConnectedAndRunningKms() throws NoSuchElementException {
List<KmsLoad> kmsLoads = getKmsLoads().stream().filter(kmsLoad -> kmsLoad.kms.isKurentoClientConnected()
&& mediaNodeStatusManager.isRunning(kmsLoad.kms.getId())).collect(Collectors.toList());
return Collections.min(kmsLoads).kms;
}
@ -146,47 +153,123 @@ public abstract class KmsManager {
@Override
public void reconnected(boolean sameServer) {
final Kms kms = kmss.get(kmsId);
kms.setKurentoClientConnected(true);
kms.setTimeOfKurentoClientConnection(System.currentTimeMillis());
if (!sameServer) {
// Different KMS. Reset sessions status (no Publisher or SUbscriber endpoints)
log.warn("Kurento Client reconnected to a different KMS instance, with uri {}", kms.getUri());
log.warn("Updating all webrtc endpoints for active sessions");
final long timeOfKurentoDisconnection = kms.getTimeOfKurentoClientDisconnection();
kms.getKurentoSessions().forEach(kSession -> {
kSession.restartStatusInKurento(timeOfKurentoDisconnection);
});
} else {
// Same KMS. We may infer that openvidu-server/KMS connection has been lost, but
// not the clients/KMS connections
log.warn("Kurento Client reconnected to same KMS {} with uri {}", kmsId, kms.getUri());
log.info("Kurento Client \"reconnected\" event for KMS {} (sameServer: {}) [{}]", kms.getUri(),
sameServer, kms.getKurentoClient().toString());
kmsReconnectionLocks.putIfAbsent(kms.getId(), new ReentrantLock());
boolean lockAcquired = false;
try {
if (kmsReconnectionLocks.get(kms.getId()).tryLock(5, TimeUnit.SECONDS)) {
lockAcquired = true;
if (kms.isKurentoClientConnected()) {
// Timer task of disconnected event successfully executed
log.warn(
"Timer task already executed for reconnected Kurento Client [{}] to KMS with uri {}. Skipping event listener execution",
kms.getKurentoClient().toString(), kms.getUri());
return;
}
kms.setKurentoClientConnected(true);
kms.setTimeOfKurentoClientConnection(System.currentTimeMillis());
if (!sameServer) {
// Different KMS. Reset sessions status (no Publisher or SUbscriber endpoints)
log.warn("Kurento Client reconnected to a different KMS instance, with uri {}",
kms.getUri());
log.warn("Updating all webrtc endpoints for active sessions");
final long timeOfKurentoDisconnection = kms.getTimeOfKurentoClientDisconnection();
kms.getKurentoSessions().forEach(kSession -> {
kSession.restartStatusInKurento(timeOfKurentoDisconnection);
});
} else {
// Same KMS. We may infer that openvidu-server/KMS connection has been lost, but
// not the clients/KMS connections
log.warn("Kurento Client reconnected to same KMS {} with uri {}", kmsId, kms.getUri());
}
kms.setTimeOfKurentoClientDisconnection(0);
}
} catch (InterruptedException e) {
log.error("InterruptedException when waiting for lock on reconnected event of KMS with uri {}",
kms.getUri());
} finally {
if (lockAcquired) {
kmsReconnectionLocks.get(kms.getId()).unlock();
}
}
kms.setTimeOfKurentoClientDisconnection(0);
}
@Override
public void disconnected() {
final Kms kms = kmss.get(kmsId);
log.info("Kurento Client \"disconnected\" event for KMS {} [{}]", kms.getUri(),
kms.getKurentoClient().toString());
kms.setKurentoClientConnected(false);
kms.setTimeOfKurentoClientDisconnection(System.currentTimeMillis());
log.warn("Kurento Client disconnected from KMS {} with uri {}", kmsId, kms.getUri());
// TODO: this is a fix for the lack of reconnected event
kmsReconnectionLocks.putIfAbsent(kms.getId(), new ReentrantLock());
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
boolean lockAcquired = false;
try {
if (kmsReconnectionLocks.get(kms.getId()).tryLock(5, TimeUnit.SECONDS)) {
lockAcquired = true;
if (kms.isKurentoClientConnected()) {
// reconnected listener already executed
log.warn(
"Timer of KMS with uri {} and KurentoClient [{}] cancelled (reconnected event received during interval wait)",
kms.getUri(), kms.getKurentoClient().toString());
timer.cancel();
return;
}
kms.getKurentoClient().getServerManager().getInfo();
log.warn("According to Timer KMS with uri {} and KurentoClient [{}] is now reconnected",
kms.getUri(), kms.getKurentoClient().toString());
timer.cancel();
kms.setKurentoClientConnected(true);
kms.setTimeOfKurentoClientConnection(System.currentTimeMillis());
// Here we cannot differentiate between new or old KMS process
final long timeOfKurentoDisconnection = kms.getTimeOfKurentoClientDisconnection();
kms.getKurentoSessions().forEach(kSession -> {
kSession.restartStatusInKurento(timeOfKurentoDisconnection);
});
kms.setTimeOfKurentoClientDisconnection(0);
}
} catch (Exception e) {
log.error(
"According to Timer KMS with uri {} and KurentoClient [{}] is not reconnected yet. Exception {}",
kms.getUri(), kms.getKurentoClient().toString(), e.getClass().getName());
} finally {
if (lockAcquired) {
kmsReconnectionLocks.get(kms.getId()).unlock();
}
}
}
}, DISCONNECTED_INTERVAL_SECONDS * 1000, DISCONNECTED_INTERVAL_SECONDS * 1000);
}
@Override
public void connectionFailed() {
final Kms kms = kmss.get(kmsId);
log.error("Kurento Client \"connectionFailed\" event for KMS {} [{}]", kms.getUri(),
kms.getKurentoClient().toString());
kms.setKurentoClientConnected(false);
log.warn("Kurento Client failed connecting to KMS {} with uri {}", kmsId, kms.getUri());
}
@Override
public void connected() {
final Kms kms = kmss.get(kmsId);
// TODO: This should be done here instead of after KurentoClient.create method returns
log.info("Kurento Client \"connected\" event for KMS {} [{}]", kms.getUri(),
kms.getKurentoClient().toString());
// TODO: This should be done here, not after KurentoClient#create method returns
// kms.setKurentoClientConnected(true);
// kms.setTimeOfKurentoClientConnection(System.currentTimeMillis());
log.info("Kurento Client is now connected to KMS {} with uri {}", kmsId, kms.getUri());
}
};
}

View File

@ -629,7 +629,7 @@ public class RecordingManager {
log.warn("No KMSs were defined in kms.uris array. Recording path check aborted");
} else {
MediaPipeline pipeline = this.kmsManager.getLessLoadedAndRunningKms().getKurentoClient()
MediaPipeline pipeline = this.kmsManager.getLessLoadedConnectedAndRunningKms().getKurentoClient()
.createMediaPipeline();
RecorderEndpoint recorder = new RecorderEndpoint.Builder(pipeline, "file://" + testFilePath).build();

View File

@ -500,7 +500,7 @@ public class SessionRestController {
if (session != null) {
if (!(MediaMode.ROUTED.equals(session.getSessionProperties().mediaMode()))
|| this.recordingManager.sessionIsBeingRecorded(session.getSessionId())) {
// Session is not in ROUTED MediMode or it is already being recorded
// Session is not in ROUTED MediaMode or it is already being recorded
return new ResponseEntity<>(HttpStatus.CONFLICT);
} else {
// Session is not active (no connected participants)

View File

@ -257,11 +257,11 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
// While closing a session users can't join
if (session.closingLock.readLock().tryLock()) {
if (session.isClosed()) {
throw new OpenViduException(Code.ROOM_CLOSED_ERROR_CODE,
"Unable to join the session. Session " + sessionId + " is closed");
}
try {
if (session.isClosed()) {
throw new OpenViduException(Code.ROOM_CLOSED_ERROR_CODE,
"Unable to join the session. Session " + sessionId + " is closed");
}
Participant participant;
if (generateRecorderParticipant) {
participant = sessionManager.newRecorderParticipant(sessionId, participantPrivatetId,

View File

@ -43,7 +43,7 @@ public class RpcNotificationService {
RpcConnection connection = new RpcConnection(t.getSession());
RpcConnection oldConnection = rpcConnections.putIfAbsent(participantPrivateId, connection);
if (oldConnection != null) {
log.warn("Concurrent initialization of rpcSession #{}", participantPrivateId);
log.warn("Concurrent initialization of rpcSession {}", participantPrivateId);
connection = oldConnection;
}
return connection;

View File

@ -125,6 +125,18 @@
"description": "Minimum video bandwidth sent from OpenVidu Server to clients, in kbps. 0 means unconstrained",
"defaultValue": 300
},
{
"name": "openvidu.sessions.garbage.interval",
"type": "java.lang.Integer",
"description": "How often the garbage collector of non active sessions runs. This helps cleaning up sessions that have been initialized through REST API (and maybe tokens have been created for them) but have had no users connected. Default to 900s (15 mins). 0 to disable non active sessions garbage collector",
"defaultValue": 900
},
{
"name": "openvidu.sessions.garbage.threshold",
"type": "java.lang.Integer",
"description": "Minimum time in seconds that a non active session must have been in existence for the garbage collector of non active sessions to remove it. Default to 3600s (1 hour). If non active sessions garbage collector is disabled (property 'openvidu.sessions.garbage.interval' to 0) this property is ignored",
"defaultValue": 3600
},
{
"name": "coturn.ip",
"type": "java.lang.String",

View File

@ -37,6 +37,9 @@ openvidu.streams.video.min-recv-bandwidth=300
openvidu.streams.video.max-send-bandwidth=1000
openvidu.streams.video.min-send-bandwidth=300
openvidu.sessions.garbage.interval=900
openvidu.sessions.garbage.threshold=3600
coturn.redis.ip=127.0.0.1
coturn.redis.dbname=0
coturn.redis.password=turn

View File

@ -0,0 +1,127 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package io.openvidu.server.test.integration;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.junit.Assert;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.web.WebAppConfiguration;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import io.openvidu.java.client.OpenViduRole;
import io.openvidu.server.core.Participant;
import io.openvidu.server.core.SessionManager;
import io.openvidu.server.core.Token;
import io.openvidu.server.kurento.kms.KmsManager;
import io.openvidu.server.rest.SessionRestController;
import io.openvidu.server.test.integration.config.IntegrationTestConfiguration;
/**
* @author Pablo Fuente (pablofuenteperez@gmail.com)
*/
@SpringBootTest(properties = { "openvidu.sessions.garbage.interval=1", "openvidu.sessions.garbage.threshold=1" })
@TestPropertySource(locations = "classpath:integration-test.properties")
@ContextConfiguration(classes = { IntegrationTestConfiguration.class })
@WebAppConfiguration
public class SessionGarbageCollectorIntegrationTest {
private static final Logger log = LoggerFactory.getLogger(SessionGarbageCollectorIntegrationTest.class);
@SpyBean
private KmsManager kmsManager;
@Autowired
private SessionManager sessionManager;
@Autowired
private SessionRestController sessionRestController;
@Test
@DisplayName("Sessions not active garbage collector")
void garbageCollectorOfSessionsNotActiveTest() throws Exception {
log.info("Sessions not active garbage collector");
JsonObject jsonResponse;
getSessionId();
jsonResponse = listSessions();
Assert.assertEquals("Wrong number of sessions", 1, jsonResponse.get("numberOfElements").getAsInt());
Thread.sleep(2000);
jsonResponse = listSessions();
Assert.assertEquals("Wrong number of sessions", 0, jsonResponse.get("numberOfElements").getAsInt());
getSessionId();
getSessionId();
String sessionId = getSessionId();
jsonResponse = listSessions();
Assert.assertEquals("Wrong number of sessions", 3, jsonResponse.get("numberOfElements").getAsInt());
String token = getToken(sessionId);
joinParticipant(sessionId, token);
Thread.sleep(2000);
jsonResponse = listSessions();
Assert.assertEquals("Wrong number of sessions", 1, jsonResponse.get("numberOfElements").getAsInt());
}
private String getSessionId() {
String stringResponse = (String) sessionRestController.getSessionId(new HashMap<>()).getBody();
return new Gson().fromJson(stringResponse, JsonObject.class).get("id").getAsString();
}
private String getToken(String sessionId) {
Map<String, String> map = new HashMap<>();
map.put("session", sessionId);
String stringResponse = (String) sessionRestController.newToken(map).getBody();
return new Gson().fromJson(stringResponse, JsonObject.class).get("token").getAsString();
}
private JsonObject listSessions() {
String stringResponse = (String) sessionRestController.listSessions(false).getBody();
return new Gson().fromJson(stringResponse, JsonObject.class);
}
private void joinParticipant(String sessionId, String token) {
Token t = new Token(token, OpenViduRole.PUBLISHER, "SERVER_METADATA", null, null);
String uuid = UUID.randomUUID().toString();
String participantPrivateId = "PARTICIPANT_PRIVATE_ID_" + uuid;
String finalUserId = "FINAL_USER_ID_" + uuid;
Participant participant = sessionManager.newParticipant(sessionId, participantPrivateId, t, "CLIENT_METADATA",
null, "Chrome", finalUserId);
sessionManager.joinRoom(participant, sessionId, null);
}
}

View File

@ -0,0 +1,65 @@
package io.openvidu.server.test.integration.config;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.kurento.client.Continuation;
import org.kurento.client.KurentoClient;
import org.kurento.client.MediaPipeline;
import org.kurento.client.ServerManager;
import org.mockito.Mockito;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import io.openvidu.server.kurento.kms.FixedOneKmsManager;
import io.openvidu.server.kurento.kms.Kms;
import io.openvidu.server.kurento.kms.KmsManager;
import io.openvidu.server.kurento.kms.KmsProperties;
/**
* KmsManager bean mock
*
* @author Pablo Fuente (pablofuenteperez@gmail.com)
*/
@TestConfiguration
public class IntegrationTestConfiguration {
@Bean
public KmsManager kmsManager() throws Exception {
final KmsManager spy = Mockito.spy(new FixedOneKmsManager());
doAnswer(invocation -> {
List<Kms> successfullyConnectedKmss = new ArrayList<>();
List<KmsProperties> kmsProperties = invocation.getArgument(0);
for (KmsProperties kmsProp : kmsProperties) {
Kms kms = new Kms(kmsProp, spy.getLoadManager());
KurentoClient kClient = mock(KurentoClient.class);
doAnswer(i -> {
Thread.sleep((long) (Math.random() * 1000));
((Continuation<MediaPipeline>) i.getArgument(0)).onSuccess(mock(MediaPipeline.class));
return null;
}).when(kClient).createMediaPipeline((Continuation<MediaPipeline>) any());
ServerManager serverManagerMock = mock(ServerManager.class);
when(serverManagerMock.getCpuCount()).thenReturn(new Random().nextInt(32) + 1);
when(kClient.getServerManager()).thenReturn(serverManagerMock);
kms.setKurentoClient(kClient);
kms.setKurentoClientConnected(true);
kms.setTimeOfKurentoClientConnection(System.currentTimeMillis());
spy.addKms(kms);
successfullyConnectedKmss.add(kms);
}
return successfullyConnectedKmss;
}).when(spy).initializeKurentoClients(any(List.class), any(Boolean.class), any(Boolean.class));
return spy;
}
}

View File

@ -0,0 +1,45 @@
server.address=0.0.0.0
server.ssl.enabled=true
server.port=4443
server.ssl.key-store=classpath:openvidu-selfsigned.jks
server.ssl.key-store-password=openvidu
server.ssl.key-store-type=JKS
server.ssl.key-alias=openvidu-selfsigned
logging.level.root=info
spring.main.allow-bean-definition-overriding=true
kms.uris=["ws://localhost:8888/kurento"]
openvidu.publicurl=local
openvidu.secret=MY_SECRET
openvidu.cdr=false
openvidu.cdr.path=log
openvidu.webhook=false
openvidu.webhook.endpoint=
openvidu.webhook.headers=[]
openvidu.webhook.events=["sessionCreated","sessionDestroyed","participantJoined","participantLeft","webrtcConnectionCreated","webrtcConnectionDestroyed","recordingStatusChanged","filterEventDispatched","mediaNodeStatusChanged"]
openvidu.recording=false
openvidu.recording.version=2.9.0
openvidu.recording.path=/opt/openvidu/recordings
openvidu.recording.public-access=false
openvidu.recording.notification=publisher_moderator
openvidu.recording.custom-layout=/opt/openvidu/custom-layout
openvidu.recording.autostop-timeout=120
openvidu.recording.composed-url=
openvidu.streams.video.max-recv-bandwidth=1000
openvidu.streams.video.min-recv-bandwidth=300
openvidu.streams.video.max-send-bandwidth=1000
openvidu.streams.video.min-send-bandwidth=300
openvidu.sessions.garbage.interval=900
openvidu.sessions.garbage.threshold=3600
coturn.redis.ip=127.0.0.1
coturn.redis.dbname=0
coturn.redis.password=turn
coturn.redis.connect-timeout=30

View File

@ -52,6 +52,9 @@ node('container') {
stage('OpenVidu TestApp build') {
sh 'cd openvidu/openvidu-testapp && npm install --unsafe-perm && npm link openvidu-browser && npm link openvidu-node-client && export NG_CLI_ANALYTICS=ci && ./node_modules/@angular/cli/bin/ng build --prod'
}
stage('OpenVidu Server integration tests') {
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=*IntegrationTest test'
}
stage('OpenVidu Server build') {
sh 'cd openvidu/openvidu-server/src/dashboard && npm install --unsafe-perm && npm link openvidu-browser && export NG_CLI_ANALYTICS=ci && ./node_modules/@angular/cli/bin/ng build --prod --output-path ../main/resources/static'
sh 'cd openvidu/openvidu-server && mvn --batch-mode clean compile package'

View File

@ -2667,7 +2667,7 @@ public class OpenViduTestAppE2eTest {
user.getWaiter().until(ExpectedConditions.alertIsPresent());
Alert alert = user.getDriver().switchTo().alert();
final String alertMessage = "Exception connecting to WebSocket server ws://localhost:8888/kurento";
final String alertMessage = "Error connecting to the session: There is no available Media Node where to initialize session 'TestSession'. Code: 204";
Assert.assertTrue("Alert message wrong. Expected to contain: \"" + alertMessage + "\". Actual message: \""
+ alert.getText() + "\"", alert.getText().contains(alertMessage));
alert.accept();

View File

@ -1,2 +0,0 @@
/target/
.factorypath

View File

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,13 +0,0 @@
(C) Copyright 2016 Kurento (http://kurento.org)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,11 +0,0 @@
[![License badge](https://img.shields.io/badge/license-Apache2-orange.svg)](http://www.apache.org/licenses/LICENSE-2.0)
[![Documentation Status](https://readthedocs.org/projects/openviduio-docs/badge/?version=stable)](https://docs.openvidu.io/en/stable/?badge=stable)
[![Docker badge](https://img.shields.io/docker/pulls/fiware/orion.svg)](https://hub.docker.com/r/openvidu/)
[![Support badge](https://img.shields.io/badge/support-sof-yellowgreen.svg)](https://groups.google.com/forum/#!forum/openvidu)
[![][OpenViduLogo]](https://openvidu.io)
openvidu-test
===
[OpenViduLogo]: https://secure.gravatar.com/avatar/5daba1d43042f2e4e85849733c8e5702?s=120

View File

@ -1,94 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.openvidu</groupId>
<artifactId>openvidu-parent</artifactId>
<version>2.0.0</version>
</parent>
<artifactId>openvidu-test</artifactId>
<packaging>jar</packaging>
<name>OpenVidu Test</name>
<version>1.1.0</version>
<description>
OpenVidu Tests Framework
This project contains the test framework for the openvidu projects
</description>
<url>https://github.com/OpenVidu/openvidu</url>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<organization>
<name>OpenVidu</name>
<url>https://github.com/OpenVidu/openvidu</url>
</organization>
<scm>
<url>${openvidu.scm.url}</url>
<connection>scm:git:${openvidu.scm.connection}</connection>
<developerConnection>scm:git:${openvidu.scm.connection}</developerConnection>
<tag>develop</tag>
</scm>
<developers>
<developer>
<id>openvidu.io</id>
<name>-openvidu.io Community</name>
<organization>OpenVidu</organization>
<organizationUrl>https://openvidu.io</organizationUrl>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.openvidu</groupId>
<artifactId>openvidu-client</artifactId>
<version>${version.openvidu.client}</version>
</dependency>
<dependency>
<groupId>org.kurento</groupId>
<artifactId>kurento-commons</artifactId>
<version>${version.kurento}</version>
</dependency>
<dependency>
<groupId>org.kurento</groupId>
<artifactId>kurento-test</artifactId>
<version>${version.kurento}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</exclusion>
<!-- <exclusion>
<groupId>org.kurento</groupId>
<artifactId>kurento-repository-internal</artifactId>
</exclusion>-->
</exclusions>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>-->
</dependencies>
</project>

View File

@ -1,635 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test;
import static io.openvidu.test.config.RoomTestConfiguration.ROOM_APP_CLASSNAME_DEFAULT;
import static io.openvidu.test.config.RoomTestConfiguration.ROOM_APP_CLASSNAME_PROP;
import static org.junit.Assert.fail;
import static org.kurento.commons.PropertiesManager.getProperty;
import static org.kurento.test.config.TestConfiguration.SELENIUM_SCOPE_PROPERTY;
import static org.kurento.test.config.TestConfiguration.TEST_URL_TIMEOUT_DEFAULT;
import static org.kurento.test.config.TestConfiguration.TEST_URL_TIMEOUT_PROPERTY;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.kurento.commons.PropertiesManager;
import org.kurento.jsonrpc.JsonUtils;
import org.kurento.test.base.BrowserTest;
import org.kurento.test.browser.Browser;
import org.kurento.test.browser.BrowserType;
import org.kurento.test.browser.WebPage;
import org.kurento.test.browser.WebPageType;
import org.kurento.test.config.BrowserScope;
import org.kurento.test.config.TestScenario;
import org.kurento.test.services.KmsService;
import org.kurento.test.services.Service;
import org.kurento.test.services.TestService;
import org.kurento.test.services.WebServerService;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.Point;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.google.gson.JsonArray;
/**
* Base for Kurento Room tests with browsers.
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
public abstract class OpenViduClientBrowserTest<W extends WebPage> extends BrowserTest<W> {
public interface UserLifecycle {
public void run(int numUser, int iteration) throws Exception;
}
public interface Task {
public void exec(int numTask) throws Exception;
}
static class KmsUriSetterService extends TestService {
private KmsService kms;
public KmsUriSetterService(KmsService kms) {
this.kms = kms;
}
@Override
public TestServiceScope getScope() {
return kms.getScope();
}
@Override
public void start() {
super.start();
String uri = kms.getWsUri();
System.setProperty("kms.uris", "[\"" + uri + "\"]");
System.setProperty("kms.uri", uri);
log.debug("Set system properties 'kms.uri' to {} & 'kms.uris' to [{}] ", uri, uri);
}
}
public static long TASKS_TIMEOUT_IN_MINUTES = 15 * 60;
public static int POLLING_LATENCY = 100;
public static int WEB_TEST_MAX_WIDTH = 1200;
public static int WEB_TEST_LEFT_BAR_WIDTH = 60;
public static int WEB_TEST_TOP_BAR_WIDTH = 30;
public static int WEB_TEST_BROWSER_WIDTH = 500;
public static int WEB_TEST_BROWSER_HEIGHT = 400;
public static String ROOM_PREFIX = "room";
public static String USER_BROWSER_PREFIX = "browser";
public static String USER_FAKE_PREFIX = "user";
public static @Service(1) KmsService kms = new KmsService();
public static @Service(2) KmsUriSetterService kmsUriSetter = new KmsUriSetterService(kms);
public static BrowserScope testScope = BrowserScope.LOCAL;
public static Class<?> webServerClass;
static {
loadWebServerClass();
if (webServerClass == null) {
Assert.fail("Unable to load any of the provided classnames for the web server test service");
}
String scopeProp = PropertiesManager.getProperty(SELENIUM_SCOPE_PROPERTY);
if (scopeProp != null) {
testScope = BrowserScope.valueOf(scopeProp.toUpperCase());
}
}
public static @Service(99) WebServerService webServer = new WebServerService(webServerClass);
public static int testTimeout;
public static SecureRandom random = new SecureRandom();
public WebPageType webPageType = WebPageType.ROOM;
public int PLAY_TIME = 5; // seconds
public int ITERATIONS = 2;
public Object browsersLock = new Object();
public String roomName = ROOM_PREFIX;
public Map<String, Exception> execExceptions = new HashMap<String, Exception>();
public boolean failed = false;
public OpenViduClientBrowserTest() {
setDeleteLogsIfSuccess(false); // always keep the logs
}
@BeforeClass
public static void beforeClass() {
testTimeout = getProperty(TEST_URL_TIMEOUT_PROPERTY, TEST_URL_TIMEOUT_DEFAULT);
log.debug("Test timeout: {}", testTimeout);
}
@Override
public void setupBrowserTest() throws InterruptedException {
super.setupBrowserTest();
execExceptions.clear();
if (testScenario != null && testScenario.getBrowserMap() != null
&& testScenario.getBrowserMap().size() > 0) {
int row = 0;
int col = 0;
for (final String browserKey : testScenario.getBrowserMap().keySet()) {
Browser browser = getPage(browserKey).getBrowser();
browser.getWebDriver().manage().window()
.setSize(new Dimension(WEB_TEST_BROWSER_WIDTH, WEB_TEST_BROWSER_HEIGHT));
browser
.getWebDriver()
.manage()
.window()
.setPosition(
new Point(col * WEB_TEST_BROWSER_WIDTH + WEB_TEST_LEFT_BAR_WIDTH, row
* WEB_TEST_BROWSER_HEIGHT + WEB_TEST_TOP_BAR_WIDTH));
col++;
if (col * WEB_TEST_BROWSER_WIDTH + WEB_TEST_LEFT_BAR_WIDTH > WEB_TEST_MAX_WIDTH) {
col = 0;
row++;
}
}
}
}
@Override
public void teardownBrowserTest() {
super.teardownBrowserTest();
failWithExceptions();
}
public static Collection<Object[]> localChromes(String caller, int browsers, WebPageType pageType) {
TestScenario test = new TestScenario();
for (int i = 0; i < browsers; i++) {
Browser browser = new Browser.Builder().webPageType(pageType).browserType(BrowserType.CHROME)
.scope(BrowserScope.LOCAL).build();
test.addBrowser(getBrowserKey(i), browser);
}
log.debug("{}: Web browsers: {}, webPageType: {}, test scope: {}, Browsers map keySet: {}",
caller, browsers, pageType, testScope.toString(), test.getBrowserMap().keySet());
return Arrays.asList(new Object[][] { { test } });
}
public static void loadWebServerClass() {
try {
List<String> auxList = JsonUtils.toStringList(PropertiesManager.getPropertyJson(
ROOM_APP_CLASSNAME_PROP, ROOM_APP_CLASSNAME_DEFAULT, JsonArray.class));
for (String aux : auxList) {
log.info("Loading class '{}' as the test's web server service", aux);
try {
webServerClass = Class.forName(aux);
break;
} catch (Exception e) {
log.warn("Couldn't load web server class '{}': {}", aux, e.getMessage());
log.debug("Couldn't load web server class '{}'", aux, e);
}
}
} catch (Exception e) {
log.error("Incorrect value for property '{}'", ROOM_APP_CLASSNAME_PROP, e);
}
}
public static void sleep(long seconds) {
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
log.warn("Interrupted while sleeping {}seconds", seconds, e);
}
}
public static String getBrowserKey(int index) {
return USER_BROWSER_PREFIX + index;
}
public static String getBrowserStreamName(int index) {
return getBrowserKey(index) + "_webcam";
}
public static String getBrowserVideoStreamName(int index) {
return "video-" + getBrowserStreamName(index);
}
public static String getBrowserNativeStreamName(int index) {
return "native-" + getBrowserVideoStreamName(index);
}
public static String getFakeKey(int index) {
return USER_FAKE_PREFIX + index;
}
public static String getFakeStreamName(int index) {
return getFakeKey(index) + "_webcam";
}
public static String getFakeStreamName(String userName) {
return userName + "_webcam";
}
public static String getFakeVideoStreamName(int index) {
return "video-" + getFakeStreamName(index);
}
public static String getFakeNativeStreamName(int index) {
return "native-" + getFakeVideoStreamName(index);
}
public static CountDownLatch[] createCdl(int numLatches, int numUsers) {
final CountDownLatch[] cdl = new CountDownLatch[numLatches];
for (int i = 0; i < numLatches; i++) {
cdl[i] = new CountDownLatch(numUsers);
}
return cdl;
}
public void iterParallelUsers(int numUsers, int iterations, final UserLifecycle user)
throws InterruptedException, ExecutionException, TimeoutException {
int totalExecutions = iterations * numUsers;
ExecutorService threadPool = Executors.newFixedThreadPool(totalExecutions);
ExecutorCompletionService<Void> exec = new ExecutorCompletionService<>(threadPool);
List<Future<Void>> futures = new ArrayList<>();
try {
for (int j = 0; j < iterations; j++) {
final int it = j;
log.info("it#{}: Starting execution of {} users", it, numUsers);
for (int i = 0; i < numUsers; i++) {
final int numUser = i;
final Browser browser = getPage(getBrowserKey(i)).getBrowser();
futures.add(exec.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
Thread.currentThread().setName("it" + it + "|browser" + numUser);
if (it > 0) {
log.debug("Page reloaded");
browser.reload();
}
user.run(numUser, it);
return null;
}
}));
}
for (int i = 0; i < numUsers; i++) {
try {
exec.take().get();
} catch (ExecutionException e) {
log.error("Execution exception", e);
throw e;
}
}
log.info("it#{}: Finished execution of {} users", it, numUsers);
}
} finally {
threadPool.shutdownNow();
}
}
public void parallelTasks(int numThreads, final String thPrefix, String taskName, final Task task) {
ExecutorService threadPool = Executors.newFixedThreadPool(numThreads);
ExecutorCompletionService<Void> exec = new ExecutorCompletionService<>(threadPool);
try {
for (int i = 0; i < numThreads; i++) {
final int numTask = i;
exec.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
String thname = Thread.currentThread().getName();
Thread.currentThread().setName(thPrefix + numTask);
task.exec(numTask);
Thread.currentThread().setName(thname);
return null;
}
});
}
for (int i = 0; i < numThreads; i++) {
String thTask = taskName + "-" + thPrefix + i;
try {
log.debug("Waiting for the {} execution to complete ({}/{})", thTask, i + 1, numThreads);
exec.take().get();
log.debug("Job {} completed ({}/{})", thTask, i + 1, numThreads);
} catch (ExecutionException e) {
log.debug("Execution exception of {} ({}/{})", thTask, i + 1, numThreads, e);
execExceptions.put(taskName + "-" + thPrefix + i, e);
} catch (InterruptedException e) {
log.error("Interrupted while waiting for execution of task{}", i, e);
}
}
} finally {
threadPool.shutdown();
try {
threadPool.awaitTermination(TASKS_TIMEOUT_IN_MINUTES, TimeUnit.MINUTES);
} catch (InterruptedException e) {
log.warn("Tasks were executed more than {} minutes. Stopping it", TASKS_TIMEOUT_IN_MINUTES);
threadPool.shutdownNow();
}
}
}
public void joinToRoom(int pageIndex, String userName, String roomName) {
Browser userBrowser = getPage(getBrowserKey(pageIndex)).getBrowser();
WebElement nameInput = findElement(userName, userBrowser, "name");
nameInput.clear();
nameInput.sendKeys(userName);
WebElement roomInput = findElement(userName, userBrowser, "roomName");
roomInput.clear();
roomInput.sendKeys(roomName);
findElement(userName, userBrowser, "joinBtn").submit();
log.debug("Clicked on 'joinBtn' in {}", userName);
}
public void exitFromRoom(int pageIndex, String userName) {
Browser userBrowser = getPage(getBrowserKey(pageIndex)).getBrowser();
try {
Actions actions = new Actions(userBrowser.getWebDriver());
actions.click(findElement(userName, userBrowser, "buttonLeaveRoom")).perform();
log.debug("'buttonLeaveRoom' clicked on in {}", userName);
} catch (ElementNotVisibleException e) {
log.warn("Button 'buttonLeaveRoom' is not visible. Session can't be closed");
}
}
public void unsubscribe(int pageIndex, int unsubscribeFromIndex) {
String clickableVideoTagId = getBrowserVideoStreamName(unsubscribeFromIndex);
selectVideoTag(pageIndex, clickableVideoTagId);
WebDriver userWebDriver = getPage(getBrowserKey(pageIndex)).getBrowser().getWebDriver();
try {
userWebDriver.findElement(By.id("buttonDisconnect")).click();
} catch (ElementNotVisibleException e) {
String msg = "Button 'buttonDisconnect' is not visible. Can't unsubscribe from media.";
log.warn(msg);
fail(msg);
}
}
public void selectVideoTag(int pageIndex, String targetVideoTagId) {
WebDriver userWebDriver = getPage(getBrowserKey(pageIndex)).getBrowser().getWebDriver();
try {
WebElement element = userWebDriver.findElement(By.id(targetVideoTagId));
Actions actions = new Actions(userWebDriver);
actions.moveToElement(element).click().perform();
} catch (ElementNotVisibleException e) {
String msg = "Video tag '" + targetVideoTagId + "' is not visible, thus not selectable.";
log.warn(msg);
fail(msg);
}
}
protected void unpublish(int pageIndex) {
WebDriver userWebDriver = getPage(getBrowserKey(pageIndex)).getBrowser().getWebDriver();
try {
userWebDriver.findElement(By.id("buttonDisconnect")).click();
} catch (ElementNotVisibleException e) {
log.warn("Button 'buttonDisconnect' is not visible. Can't unpublish media.");
}
}
public WebElement findElement(String label, Browser browser, String id) {
try {
return new WebDriverWait(browser.getWebDriver(), testTimeout, POLLING_LATENCY)
.until(ExpectedConditions.presenceOfElementLocated(By.id(id)));
} catch (TimeoutException e) {
log.warn("Timeout when waiting for element {} to exist in browser {}", id, label);
int originalTimeout = 60;
try {
originalTimeout = browser.getTimeout();
log.debug("Original browser timeout (s): {}, set to 10", originalTimeout);
browser.setTimeout(10);
browser.changeTimeout(10);
WebElement elem = browser.getWebDriver().findElement(By.id(id));
log.info("Additional findElement call was able to locate {} in browser {}", id, label);
return elem;
} catch (NoSuchElementException e1) {
log.debug("Additional findElement call couldn't locate {} in browser {} ({})", id, label,
e1.getMessage());
throw new NoSuchElementException("Element with id='" + id + "' not found after "
+ testTimeout + " seconds in browser " + label);
} finally {
browser.setTimeout(originalTimeout);
browser.changeTimeout(originalTimeout);
}
}
}
public void waitWhileElement(String label, Browser browser, String id) throws TimeoutException {
int originalTimeout = 60;
try {
originalTimeout = browser.getTimeout();
log.debug("Original browser timeout (s): {}, set to 1", originalTimeout);
browser.setTimeout(1);
browser.changeTimeout(1);
new WebDriverWait(browser.getWebDriver(), testTimeout, POLLING_LATENCY)
.until(ExpectedConditions.invisibilityOfElementLocated(By.id(id)));
} catch (org.openqa.selenium.TimeoutException e) {
log.warn("Timeout when waiting for element {} to disappear in browser {}", id, label, e);
throw new TimeoutException("Element with id='" + id + "' is present in page after "
+ testTimeout + " seconds");
} finally {
browser.setTimeout(originalTimeout);
browser.changeTimeout(originalTimeout);
}
}
/**
* Wait for stream of another browser user.
*
* @param index
* own user index
* @param label
* browser name (user name)
* @param targetIndex
* the target user index
*/
public void waitForStream(int index, String label, int targetIndex) {
waitForStream(index, label, getBrowserNativeStreamName(targetIndex));
}
/**
* Wait for stream of a fake user.
*
* @param index
* own user index
* @param label
* browser name (user name)
* @param targetIndex
* the target user index
*/
public void waitForStreamFake(int index, String label, int targetIndex) {
waitForStream(index, label, getFakeNativeStreamName(targetIndex));
}
/**
* Wait for stream of user whose video tag has already been generated.
*
* @param index
* own user index
* @param label
* browser name (user name)
* @param targetVideoTagId
* expected video tag id
*/
public void waitForStream(int index, String label, String targetVideoTagId) {
String hostKey = getBrowserKey(index);
Browser browser = getPage(hostKey).getBrowser();
int i = 0;
for (; i < testTimeout; i++) {
WebElement video = findElement(label, browser, targetVideoTagId);
String srcAtt = video.getAttribute("src");
if (srcAtt != null && srcAtt.startsWith("blob")) {
break;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
if (i == testTimeout) {
Assert.fail("Video tag '" + targetVideoTagId + "' is not playing media after " + testTimeout
+ " seconds in '" + hostKey + "'");
}
}
public void verify(boolean[] activeBrowserUsers) {
verify(activeBrowserUsers, null);
}
public void verify(boolean[] activeBrowserUsers, Map<String, Boolean> activeFakeUsers) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < activeBrowserUsers.length; i++) {
if (activeBrowserUsers[i]) {
sb.append(USER_BROWSER_PREFIX + i + ": active, ");
} else {
sb.append(USER_BROWSER_PREFIX + i + ": not, ");
}
}
log.debug("Checking Browser users (active or not): [{}]", sb);
if (activeFakeUsers != null && !activeFakeUsers.isEmpty()) {
log.debug("Checking Fake users (active or not): {}", activeFakeUsers);
}
long startTime = System.nanoTime();
for (int i = 0; i < activeBrowserUsers.length; i++) {
if (activeBrowserUsers[i]) {
Browser browser = getPage(getBrowserKey(i)).getBrowser();
String browserLabel = getBrowserStreamName(i);
String browserUsername = USER_BROWSER_PREFIX + i;
for (int j = 0; j < activeBrowserUsers.length; j++) {
String videoElementId = "video-" + getBrowserStreamName(j);
verifyVideoInBrowser(browser, browserLabel, browserUsername, videoElementId,
activeBrowserUsers[j]);
}
if (activeFakeUsers != null) {
for (Entry<String, Boolean> fakeEntry : activeFakeUsers.entrySet()) {
String videoElementId = "video-" + getFakeStreamName(fakeEntry.getKey());
verifyVideoInBrowser(browser, browserLabel, browserUsername, videoElementId,
fakeEntry.getValue());
}
}
}
}
long endTime = System.nanoTime();
double duration = ((double) endTime - startTime) / 1_000_000;
log.debug("Checked active users: [{}] {} - in {} millis", sb, activeFakeUsers != null
&& !activeFakeUsers.isEmpty() ? "& " + activeFakeUsers : "", duration);
}
public void verifyVideoInBrowser(Browser browser, String browserLabel, String chromeName,
String videoElementId, boolean isActive) {
if (isActive) {
log.debug("Verifing element {} exists in browser of {}", videoElementId, chromeName);
try {
WebElement video = findElement(browserLabel, browser, videoElementId);
if (video == null) {
fail("Video element " + videoElementId + " was not found in browser of " + chromeName);
}
} catch (NoSuchElementException e) {
fail(e.getMessage());
}
log.debug("OK - element {} found in browser of {}", videoElementId, chromeName);
} else {
log.debug("Verifing element {} is missing from browser of {}", videoElementId, chromeName);
try {
waitWhileElement(browserLabel, browser, videoElementId);
} catch (TimeoutException e) {
fail(e.getMessage());
}
log.debug("OK - element {} is missing from browser of {}", videoElementId, chromeName);
}
}
public void failWithExceptions() {
if (!failed && !execExceptions.isEmpty()) {
failed = true;
StringBuffer sb = new StringBuffer();
log.warn("\n+-------------------------------------------------------+\n"
+ "| Failing because of the following test errors: |\n"
+ "+-------------------------------------------------------+");
for (String exKey : execExceptions.keySet()) {
Exception e = execExceptions.get(exKey);
log.warn("Error on '{}'", exKey, e);
sb.append(exKey).append(" - ").append(e.getMessage()).append("\n");
}
sb.append("Check logs for more details");
log.warn("\n+-------------------------------------------------------+\n"
+ "| End of errors list |\n"
+ "+-------------------------------------------------------+");
Assert.fail(sb.toString());
}
}
}

View File

@ -1,350 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test;
import static org.kurento.commons.PropertiesManager.getProperty;
import static org.kurento.test.config.TestConfiguration.TEST_HOST_PROPERTY;
import static org.kurento.test.config.TestConfiguration.TEST_PORT_PROPERTY;
import static org.kurento.test.config.TestConfiguration.TEST_PROTOCOL_DEFAULT;
import static org.kurento.test.config.TestConfiguration.TEST_PROTOCOL_PROPERTY;
import static org.kurento.test.config.TestConfiguration.TEST_PUBLIC_IP_DEFAULT;
import static org.kurento.test.config.TestConfiguration.TEST_PUBLIC_IP_PROPERTY;
import static org.kurento.test.config.TestConfiguration.TEST_PUBLIC_PORT_PROPERTY;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.kurento.client.KurentoClient;
import org.kurento.commons.PropertiesManager;
import org.kurento.commons.exception.KurentoException;
import org.kurento.test.base.KurentoTest;
import org.kurento.test.browser.WebPage;
import org.kurento.test.config.BrowserScope;
import org.kurento.test.config.Protocol;
import org.kurento.test.docker.Docker;
import org.kurento.test.services.FakeKmsService;
import org.kurento.test.services.KmsService;
import org.kurento.test.services.Service;
import org.kurento.test.services.WebServerService;
import org.kurento.test.utils.Shell;
import io.openvidu.test.fake.util.FakeSession;
/**
* Base for Kurento Room tests with browsers and fake clients.
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
public abstract class RoomClientFakeTest<W extends WebPage> extends OpenViduClientBrowserTest<W> {
public static @Service(3) KmsService fakeKms = new FakeKmsService();
public static String testFiles = KurentoTest.getTestFilesDiskPath();
// overwritten if running in Docker
public static String serverAddress = PropertiesManager.getProperty(TEST_HOST_PROPERTY,
getProperty(TEST_PUBLIC_IP_PROPERTY, TEST_PUBLIC_IP_DEFAULT));
public static int serverPort = getProperty(TEST_PORT_PROPERTY,
getProperty(TEST_PUBLIC_PORT_PROPERTY, WebServerService.getAppHttpsPort()));
public static Protocol protocol = Protocol.valueOf(getProperty(TEST_PROTOCOL_PROPERTY,
TEST_PROTOCOL_DEFAULT).toUpperCase());
// might get overwritten by custom room apps
public static String appWsPath = "/openvidu";
public long JOIN_ROOM_TOTAL_TIMEOUT_IN_SECONDS = 30;
public long ACTIVE_LIVE_TOTAL_TIMEOUT_IN_SECONDS = 180;
public long ROOM_ACTIVITY_IN_SECONDS = 30;
public long LEAVE_ROOM_TOTAL_TIMEOUT_IN_SECONDS = 10;
public URI appWsUrl;
public URI appBaseUrl;
public URI appUrl;
public ConcurrentMap<String, FakeSession> sessions = new ConcurrentHashMap<String, FakeSession>();
public KurentoClient fakeKurentoClient;
public RoomClientFakeTest() {
super();
}
@Override
public void setupBrowserTest() throws InterruptedException {
super.setupBrowserTest();
calculateUrl();
String wsProtocol = "ws";
if (protocol.equals(Protocol.HTTPS)) {
wsProtocol = "wss";
}
String hostName = appUrl.getHost();
try {
appWsUrl = new URI(wsProtocol, null, hostName, serverPort, appWsPath, null, null);
} catch (URISyntaxException e) {
throw new KurentoException("Exception generating WS URI from " + wsProtocol + ", " + hostName
+ ", server port " + serverPort + " and WS path " + appWsPath);
}
log.debug("Protocol: {}, Hostname: {}, Port: {}, Path: {}", wsProtocol, hostName, serverPort,
appWsPath);
fakeKurentoClient = fakeKms.getKurentoClient();
Assert.assertNotNull("Fake Kurento Client is null", fakeKurentoClient);
}
@Override
public void teardownBrowserTest() {
for (FakeSession s : sessions.values()) {
try {
s.close();
} catch (IOException e) {
log.warn("Error closing session", e);
}
}
fakeKms.closeKurentoClient();
super.teardownBrowserTest();
}
public void calculateUrl() {
if (appUrl == null) {
String hostName = serverAddress;
if (BrowserScope.DOCKER.equals(testScope)) {
Docker docker = Docker.getSingleton();
if (docker.isRunningInContainer()) {
hostName = docker.getContainerIpAddress();
} else {
hostName = docker.getHostIpForContainers();
}
}
log.debug("Protocol: {}, Hostname: {}, Port: {}, Web page type: {}", protocol, hostName,
serverPort, webPageType);
try {
appUrl = new URI(protocol.toString(), null, hostName, serverPort, webPageType.toString(),
null, null);
} catch (URISyntaxException e) {
throw new KurentoException("Exception generating URI from " + protocol + ", " + hostName
+ ", server port " + serverPort + " and webpage type " + webPageType);
}
try {
appBaseUrl = new URI(protocol.toString(), null, hostName, serverPort, null, null, null);
} catch (URISyntaxException e) {
throw new KurentoException("Exception generating URI from " + protocol + ", " + hostName
+ ", server port " + serverPort);
}
}
}
public FakeSession getSession(String room) {
return sessions.get(room);
}
public FakeSession createSession(String room) {
if (sessions.containsKey(room)) {
return sessions.get(room);
}
FakeSession s = new FakeSession(appWsUrl.toString(), room, fakeKurentoClient);
FakeSession old = sessions.putIfAbsent(room, s);
if (old != null) {
return old;
}
return s;
}
public void closeSession(String room) {
FakeSession session = sessions.get(room);
if (session != null) {
try {
session.close();
} catch (IOException e) {
log.warn("Error closing session", e);
}
}
}
public FakeSession removeSession(String room) {
return sessions.remove(room);
}
public CountDownLatch parallelJoinFakeUsers(final List<String> relativePaths, final String room,
final KurentoClient kurento) {
if (relativePaths == null || relativePaths.isEmpty()) {
execExceptions.put("parallelJoinFakeUsers-" + room, new Exception(
"Null or empty play paths list"));
return null;
}
int userThreads = relativePaths.size();
log.info("Joining room '{}': {} fake users with relative play paths:\n{}", room, userThreads,
relativePaths);
final CountDownLatch joinLatch = new CountDownLatch(userThreads);
parallelTasks(userThreads, USER_FAKE_PREFIX, "parallelJoinFakeUsers-" + room, new Task() {
@Override
public void exec(int numTask) throws Exception {
try {
String userName = getFakeKey(numTask);
FakeSession s = createSession(room);
String fullPlayPath = getPlaySourcePath(userName, relativePaths.get(numTask));
if (kurento == null) {
s.newParticipant(userName, fullPlayPath, true, true);
} else {
s.newParticipant(userName, fullPlayPath, true, true, kurento);
}
} finally {
joinLatch.countDown();
}
}
});
return joinLatch;
}
protected CountDownLatch parallelLeaveFakeUsers(final String room, int userThreads) {
final CountDownLatch leaveLatch = new CountDownLatch(userThreads);
parallelTasks(userThreads, USER_FAKE_PREFIX, "parallelLeaveFakeUsers-" + room, new Task() {
@Override
public void exec(int numTask) throws Exception {
try {
getSession(room).getParticipant(getFakeKey(numTask)).leaveRoom();
} finally {
leaveLatch.countDown();
}
}
});
return leaveLatch;
}
protected CountDownLatch parallelWaitActiveLive(final String room, int userThreads) {
final CountDownLatch waitForLatch = new CountDownLatch(userThreads);
parallelTasks(userThreads, USER_FAKE_PREFIX, "parallelWaitForActiveLive-" + room, new Task() {
@Override
public void exec(int numTask) throws Exception {
getSession(room).getParticipant(getFakeKey(numTask)).waitForActiveLive(waitForLatch);
}
});
return waitForLatch;
}
public void await(CountDownLatch waitLatch, long actionTimeoutInSeconds, String action,
int userThreads) {
failWithExceptions();
try {
if (!waitLatch.await(actionTimeoutInSeconds, TimeUnit.SECONDS)) {
execExceptions.put(action, new Exception("Timeout waiting for '" + action + "' of "
+ userThreads + " tasks (max " + actionTimeoutInSeconds + "s)"));
} else {
log.debug("Finished waiting for {}", action);
}
} catch (InterruptedException e) {
log.warn("Interrupted when waiting for {} of {} tasks (max {}s)", action, userThreads,
actionTimeoutInSeconds, e);
}
}
public void idlePeriod() {
idlePeriod("ACTIVE_LIVE", "LEAVE_ROOM", roomName);
}
public void idlePeriod(String room) {
idlePeriod("ACTIVE_LIVE", "LEAVE_ROOM", room);
}
public void idlePeriod(String previousAction, String nextAction, String room) {
failWithExceptions();
log.info("\n-----------------\n" + "Wait for {} concluded in '{}'" + "\n-----------------\n"
+ "Waiting {} seconds", previousAction, room, ROOM_ACTIVITY_IN_SECONDS);
sleep(ROOM_ACTIVITY_IN_SECONDS);
log.info("\n-----------------\n" + "{} in '{}'" + "\n-----------------\n", nextAction, room);
}
public static String getPlaySourcePath(String userName, String relativePath) throws Exception {
return getPlaySourcePath(userName, relativePath, testFiles);
}
public static String getPlaySourcePath(String userName, String relativePath, String basePath)
throws Exception {
if (relativePath == null) {
throw new Exception("Null play path for user " + userName);
}
if (!basePath.startsWith("http://") && !basePath.startsWith("https://")
&& !basePath.startsWith("file://")) {
basePath = "file://" + basePath;
}
URI playerUri = null;
try {
playerUri = new URI(basePath + relativePath);
} catch (URISyntaxException e) {
throw new Exception("Unable to construct player URI for user " + userName
+ " from base path " + basePath + " and file " + relativePath);
}
String fullPlayPath = playerUri.toString();
log.debug("Fake user '{}': using play URI {}", userName, fullPlayPath);
return fullPlayPath;
}
// use fake.kms.ws.uri instead
@Deprecated
public static String getFreePort(String wsUri) {
if (BrowserScope.DOCKER.equals(testScope)) {
log.info("Test is dockerized, returning the same WS for the KMS: {}", wsUri);
return wsUri;
}
URI url;
try {
url = new URI(wsUri);
} catch (URISyntaxException e) {
log.warn("WebSocket URI {} is malformed: " + e.getMessage(), wsUri);
throw new KurentoException("WebSocket URI " + wsUri + " is malformed");
}
int c = 0;
do {
try {
c++;
int newPort = url.getPort() + c * c * c;
url = new URI(url.getScheme(), null, url.getHost(), newPort, url.getPath(), null, null);
String updatedWsUri = url.toString();
log.debug("try#{} Is port available for running (fake) KMS using this URI? {}", c,
updatedWsUri);
String result = Shell.runAndWait("/bin/bash", "-c",
"nc -z " + url.getHost() + " " + url.getPort() + "; echo $?");
if (result.trim().equals("0")) {
log.warn("Port " + url.getPort()
+ " is used. Maybe another KMS instance is running in this port");
} else {
log.debug("URI is available: {}", updatedWsUri);
return updatedWsUri;
}
} catch (URISyntaxException e) {
log.warn("WebSocket URI {} is malformed: " + e.getMessage(), wsUri);
}
} while (c < 3);
log.warn("Giving up, will return the original URI: {}", wsUri);
return wsUri;
}
}

View File

@ -1,30 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test;
import org.junit.experimental.categories.Category;
import org.kurento.commons.testing.SystemFunctionalTests;
import org.kurento.test.browser.WebPage;
/**
* Functional Kurento Room tests (using browser clients).
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
@Category(SystemFunctionalTests.class)
public class RoomFunctionalBrowserTest<W extends WebPage> extends OpenViduClientBrowserTest<W> {
}

View File

@ -1,30 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test;
import org.junit.experimental.categories.Category;
import org.kurento.commons.testing.SystemFunctionalTests;
import org.kurento.test.browser.WebPage;
/**
* Functional Kurento Room tests (using browser and fake clients).
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
@Category(SystemFunctionalTests.class)
public class RoomFunctionalFakeTest<W extends WebPage> extends RoomClientFakeTest<W> {
}

View File

@ -1,76 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room demo integration test (basic version).
*
* @author Micael Gallego (micael.gallego@gmail.com)
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 5.0.0
*/
public class AddRemoveUsers extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 2;
@Test
public void test() throws Exception {
final boolean[] activeUsers = new boolean[NUM_USERS];
final CountDownLatch[] joinCdl = createCdl(ITERATIONS, NUM_USERS);
final CountDownLatch[] leaveCdl = createCdl(ITERATIONS, NUM_USERS);
iterParallelUsers(NUM_USERS, ITERATIONS, new UserLifecycle() {
@Override
public void run(int numUser, int iteration) throws Exception {
String userName = getBrowserKey(numUser);
log.info("User '{}' is joining room '{}'", userName, roomName);
synchronized (browsersLock) {
joinToRoom(numUser, userName, roomName);
activeUsers[numUser] = true;
verify(activeUsers);
joinCdl[iteration].countDown();
}
log.info("User '{}' joined room '{}'", userName, roomName);
joinCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
sleep(PLAY_TIME);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
synchronized (browsersLock) {
exitFromRoom(numUser, userName);
activeUsers[numUser] = false;
verify(activeUsers);
leaveCdl[iteration].countDown();
}
log.info("User '{}' exited from room '{}'", userName, roomName);
leaveCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
}
});
}
}

View File

@ -1,55 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room integration test (basic version).
*
* @author Micael Gallego (micael.gallego@gmail.com)
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 5.0.0
*/
public class AddRemoveUsersNoSinkVerify extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 4;
@Test
public void test() throws Exception {
iterParallelUsers(NUM_USERS, ITERATIONS, new UserLifecycle() {
@Override
public void run(int numUser, int iteration) throws Exception {
String userName = getBrowserKey(numUser);
log.info("User '{}' is joining room '{}'", userName, roomName);
joinToRoom(numUser, userName, roomName);
log.info("User '{}' joined room '{}'", userName, roomName);
sleep(PLAY_TIME);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
exitFromRoom(numUser, userName);
log.info("User '{}' exited from room '{}'", userName, roomName);
}
});
}
}

View File

@ -1,97 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room demo integration test (basic version).
*
* @author Micael Gallego (micael.gallego@gmail.com)
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 5.0.0
*/
public class NUsersEqualLifetime extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 4;
@Test
public void test() throws Exception {
ITERATIONS = 1;
final boolean[] activeUsers = new boolean[NUM_USERS];
final CountDownLatch[] joinCdl = createCdl(ITERATIONS, NUM_USERS);
final CountDownLatch[] publishCdl = createCdl(ITERATIONS, NUM_USERS * NUM_USERS);
final CountDownLatch[] leaveCdl = createCdl(ITERATIONS, NUM_USERS);
iterParallelUsers(NUM_USERS, ITERATIONS, new UserLifecycle() {
@Override
public void run(final int numUser, final int iteration) throws Exception {
final String userName = getBrowserKey(numUser);
log.info("User '{}' is joining room '{}'", userName, roomName);
synchronized (browsersLock) {
joinToRoom(numUser, userName, roomName);
activeUsers[numUser] = true;
verify(activeUsers);
joinCdl[iteration].countDown();
}
log.info("User '{}' joined room '{}'", userName, roomName);
joinCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
final long start = System.currentTimeMillis();
parallelTasks(NUM_USERS, USER_BROWSER_PREFIX, "parallelWaitForStream", new Task() {
@Override
public void exec(int numTask) throws Exception {
String videoUserName = getBrowserKey(numTask);
synchronized (browsersLock) {
waitForStream(numUser, userName, numTask);
}
long duration = System.currentTimeMillis() - start;
log.info("Video received in browser of user '{}' for user '{}' in {} millis", userName,
videoUserName, duration);
publishCdl[iteration].countDown();
}
});
publishCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
sleep(PLAY_TIME);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
synchronized (browsersLock) {
exitFromRoom(numUser, userName);
activeUsers[numUser] = false;
verify(activeUsers);
leaveCdl[iteration].countDown();
}
log.info("User '{}' exited from room '{}'", userName, roomName);
leaveCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
}
});
}
}

View File

@ -1,78 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room demo integration test (basic version).
*
* @author Micael Gallego (micael.gallego@gmail.com)
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 5.0.0
*/
public class OneUserQuickReentry extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 1;
@Test
public void test() throws Exception {
ITERATIONS = 5;
final boolean[] activeUsers = new boolean[NUM_USERS];
final CountDownLatch[] joinCdl = createCdl(ITERATIONS, NUM_USERS);
final CountDownLatch[] leaveCdl = createCdl(ITERATIONS, NUM_USERS);
iterParallelUsers(NUM_USERS, ITERATIONS, new UserLifecycle() {
@Override
public void run(int numUser, int iteration) throws Exception {
String userName = getBrowserKey(numUser);
log.info("User '{}' is joining room '{}'", userName, roomName);
synchronized (browsersLock) {
joinToRoom(numUser, userName, roomName);
activeUsers[numUser] = true;
verify(activeUsers);
joinCdl[iteration].countDown();
}
log.info("User '{}' joined room '{}'", userName, roomName);
joinCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
sleep(0);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
synchronized (browsersLock) {
exitFromRoom(numUser, userName);
activeUsers[numUser] = false;
verify(activeUsers);
leaveCdl[iteration].countDown();
}
log.info("User '{}' exited from room '{}'", userName, roomName);
leaveCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
}
});
}
}

View File

@ -1,78 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room demo integration test (basic version).
*
* @author Micael Gallego (micael.gallego@gmail.com)
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 5.0.0
*/
public class SeqAddRemoveUser extends RoomFunctionalBrowserTest<WebPage> {
private static final int WAIT_TIME = 1;
public static final int NUM_USERS = 2;
@Test
public void test() throws Exception {
boolean[] activeUsers = new boolean[NUM_USERS];
for (int cycle = 0; cycle < ITERATIONS; cycle++) {
for (int i = 0; i < NUM_USERS; i++) {
String userName = getBrowserKey(i);
log.info("User '{}' joining room '{}'", userName, roomName);
joinToRoom(i, userName, roomName);
activeUsers[i] = true;
sleep(WAIT_TIME);
verify(activeUsers);
log.info("User '{}' joined to room '{}'", userName, roomName);
}
for (int i = 0; i < NUM_USERS; i++) {
for (int j = 0; j < NUM_USERS; j++) {
waitForStream(i, getBrowserKey(i), j);
log.debug("Received media from '{}' in browser of '{}'", getBrowserKey(j),
getBrowserKey(i));
}
}
// Guard time to see application in action
sleep(PLAY_TIME);
// Stop application by caller
for (int i = 0; i < NUM_USERS; i++) {
String userName = getBrowserKey(i);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
exitFromRoom(i, userName);
activeUsers[i] = false;
sleep(WAIT_TIME);
verify(activeUsers);
log.info("User '{}' exited from room '{}'", userName, roomName);
}
}
}
}

View File

@ -1,65 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room demo integration test (basic version).
*
* @author Micael Gallego (micael.gallego@gmail.com)
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 5.0.0
*/
public class SeqNUsersEqualLifetime extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 4;
@Test
public void test() throws Exception {
for (int i = 0; i < NUM_USERS; i++) {
String userName = getBrowserKey(i);
joinToRoom(i, userName, roomName);
log.info("User '{}' joined to room '{}'", userName, roomName);
}
// FIXME it fails sporadically (could be the TrickleICE mechanism)
for (int i = 0; i < NUM_USERS; i++) {
String userName = getBrowserKey(i);
for (int j = 0; j < NUM_USERS; j++) {
if (i != j) {
waitForStream(i, userName, j);
log.debug("Received media from '{}' in '{}'", getBrowserKey(j), userName);
}
}
}
// Guard time to see application in action
sleep(PLAY_TIME);
for (int i = 0; i < NUM_USERS; i++) {
String userName = getBrowserKey(i);
exitFromRoom(i, userName);
log.info("User '{}' exited from room '{}'", userName, roomName);
}
}
}

View File

@ -1,66 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room demo integration test (basic version).
*
* @author Micael Gallego (micael.gallego@gmail.com)
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 5.0.0
*/
public class TwoUsersEqualLifetime extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 2;
@Test
public void test() throws Exception {
String user0Name = getBrowserKey(0);
String user1Name = getBrowserKey(1);
joinToRoom(0, user0Name, roomName);
log.info("User '{}' joined to room '{}'", user0Name, roomName);
joinToRoom(1, user1Name, roomName);
log.info("User '{}' joined to room '{}'", user1Name, roomName);
// FIXME it fails sporadically (could be the TrickleICE mechanism)
waitForStream(0, user0Name, 0);
log.debug("Received media from '{}' in '{}'", user0Name, user0Name);
waitForStream(0, user0Name, 1);
log.debug("Received media from '{}' in '{}'", user1Name, user0Name);
waitForStream(1, user1Name, 0);
log.debug("Received media from '{}' in '{}'", user0Name, user1Name);
waitForStream(1, user1Name, 1);
log.debug("Received media from '{}' in '{}'", user1Name, user1Name);
// Guard time to see application in action
sleep(PLAY_TIME);
// Stop application by caller
exitFromRoom(0, user0Name);
exitFromRoom(1, user1Name);
}
}

View File

@ -1,120 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room browser test. Designed for the demo app.
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.0.0
*/
public class UnpublishMedia extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 3;
@Test
public void test() throws Exception {
ITERATIONS = 3;
final boolean[] activeUsers = new boolean[NUM_USERS];
final CountDownLatch[] joinCdl = createCdl(ITERATIONS, NUM_USERS);
final CountDownLatch[] publishCdl = createCdl(ITERATIONS, NUM_USERS * NUM_USERS);
final CountDownLatch[] unpublishCdl = createCdl(ITERATIONS, 1);
final CountDownLatch[] verifyCdl = createCdl(ITERATIONS, NUM_USERS);
final CountDownLatch[] leaveCdl = createCdl(ITERATIONS, NUM_USERS);
final int[] unpublisherIndex = new int[ITERATIONS];
for (int i = 0; i < unpublisherIndex.length; i++) {
unpublisherIndex[i] = random.nextInt(NUM_USERS);
}
iterParallelUsers(NUM_USERS, ITERATIONS, new UserLifecycle() {
@Override
public void run(final int numUser, final int iteration) throws Exception {
final String userName = getBrowserKey(numUser);
log.info("User '{}' is joining room '{}'", userName, roomName);
synchronized (browsersLock) {
joinToRoom(numUser, userName, roomName);
activeUsers[numUser] = true;
verify(activeUsers);
joinCdl[iteration].countDown();
}
log.info("User '{}' joined room '{}'", userName, roomName);
joinCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
final long start = System.currentTimeMillis();
parallelTasks(NUM_USERS, USER_BROWSER_PREFIX, "parallelWaitForStream", new Task() {
@Override
public void exec(int numTask) throws Exception {
String videoUserName = getBrowserKey(numTask);
synchronized (browsersLock) {
waitForStream(numUser, userName, numTask);
}
long duration = System.currentTimeMillis() - start;
log.info("Video received in browser of user '{}' for user '{}' in {} millis", userName,
videoUserName, duration);
publishCdl[iteration].countDown();
}
});
publishCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
synchronized (browsersLock) {
if (numUser == unpublisherIndex[iteration]) {
log.info("User '{}' unpublishing media in room '{}'", userName, roomName);
unpublish(numUser);
log.info("User '{}' unpublished media in room '{}'", userName, roomName);
activeUsers[numUser] = false;
unpublishCdl[iteration].countDown();
}
}
unpublishCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
synchronized (browsersLock) {
verify(activeUsers);
verifyCdl[iteration].countDown();
}
log.info("{} - Verified that '{}' unpublished media in room '{}'", userName,
getBrowserKey(unpublisherIndex[iteration]), roomName);
verifyCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
sleep(PLAY_TIME);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
synchronized (browsersLock) {
exitFromRoom(numUser, userName);
activeUsers[numUser] = false;
verify(activeUsers);
leaveCdl[iteration].countDown();
}
log.info("User '{}' exited from room '{}'", userName, roomName);
leaveCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
}
});
}
}

View File

@ -1,129 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Room browser test. Designed for the demo app.
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.0.0
*/
public class UnsubscribeFromMedia extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 3;
@Test
public void test() throws Exception {
final boolean[] activeUsers = new boolean[NUM_USERS];
final CountDownLatch[] joinCdl = createCdl(ITERATIONS, NUM_USERS);
final CountDownLatch[] publishCdl = createCdl(ITERATIONS, NUM_USERS * NUM_USERS);
final CountDownLatch[] unsubscribeCdl = createCdl(ITERATIONS, NUM_USERS);
final CountDownLatch[] verifyCdl = createCdl(ITERATIONS, NUM_USERS);
final CountDownLatch[] leaveCdl = createCdl(ITERATIONS, NUM_USERS);
final int[] unsubscribeFromIndex = new int[ITERATIONS];
for (int i = 0; i < unsubscribeFromIndex.length; i++) {
unsubscribeFromIndex[i] = random.nextInt(NUM_USERS);
}
iterParallelUsers(NUM_USERS, ITERATIONS, new UserLifecycle() {
@Override
public void run(final int numUser, final int iteration) throws Exception {
final String userName = getBrowserKey(numUser);
log.info("User '{}' is joining room '{}'", userName, roomName);
synchronized (browsersLock) {
joinToRoom(numUser, userName, roomName);
activeUsers[numUser] = true;
verify(activeUsers);
joinCdl[iteration].countDown();
}
log.info("User '{}' joined room '{}'", userName, roomName);
joinCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
final long start = System.currentTimeMillis();
parallelTasks(NUM_USERS, USER_BROWSER_PREFIX, "parallelWaitForStream", new Task() {
@Override
public void exec(int numTask) throws Exception {
String videoUserName = getBrowserKey(numTask);
synchronized (browsersLock) {
waitForStream(numUser, userName, numTask);
}
long duration = System.currentTimeMillis() - start;
log.info("Video received in browser of user '{}' for user '{}' in {} millis", userName,
videoUserName, duration);
publishCdl[iteration].countDown();
}
});
publishCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
if (execExceptions != null && !execExceptions.isEmpty()) {
return;
}
String userUnsubscribe = getBrowserKey(unsubscribeFromIndex[iteration]);
if (numUser != unsubscribeFromIndex[iteration]) {
log.info("User '{}' unsubscribing from '{}' (vTag={}) in room '{}'", userName,
userUnsubscribe, getBrowserNativeStreamName(unsubscribeFromIndex[iteration]),
roomName);
synchronized (browsersLock) {
unsubscribe(numUser, unsubscribeFromIndex[iteration]);
}
log.info("User '{}' unsubscribed from '{}' in room '{}'", userName, userUnsubscribe,
roomName);
} else {
activeUsers[numUser] = false;
}
unsubscribeCdl[iteration].countDown();
unsubscribeCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
if (numUser != unsubscribeFromIndex[iteration]) {
synchronized (browsersLock) {
verify(activeUsers);
}
log.info("{} - Verified that I've unsubscribed from '{}' media in room '{}'", userName,
userUnsubscribe, roomName);
}
verifyCdl[iteration].countDown();
verifyCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
synchronized (browsersLock) {
exitFromRoom(numUser, userName);
activeUsers[numUser] = false;
verify(activeUsers);
leaveCdl[iteration].countDown();
}
log.info("User '{}' exited from room '{}'", userName, roomName);
leaveCdl[iteration].await(PLAY_TIME * 5000L, TimeUnit.MILLISECONDS);
}
});
}
}

View File

@ -1,58 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.browser;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalBrowserTest;
/**
* Web app availability basic test.
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
public class WebAppAvailability extends RoomFunctionalBrowserTest<WebPage> {
public static final int NUM_USERS = 1;
@Test
public void test() throws Exception {
boolean[] activeUsers = new boolean[NUM_USERS];
int numUser = 0;
String userName = getBrowserKey(numUser);
log.info("User '{}' is joining room '{}'", userName, roomName);
joinToRoom(numUser, userName, roomName);
activeUsers[numUser] = true;
verify(activeUsers);
log.info("User '{}' joined room '{}'", userName, roomName);
long start = System.currentTimeMillis();
waitForStream(numUser, userName, numUser);
long duration = System.currentTimeMillis() - start;
log.info("Video received in browser of user '{}' for user '{}' in {} millis", userName,
userName, duration);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
exitFromRoom(numUser, userName);
activeUsers[numUser] = false;
verify(activeUsers);
log.info("User '{}' exited from room '{}'", userName, roomName);
}
}

View File

@ -1,45 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.config;
import static org.kurento.test.config.TestConfiguration.KMS_WS_URI_DEFAULT;
import static org.kurento.test.config.TestConfiguration.KMS_WS_URI_PROP;
/**
* Kurento Room test properties.
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
public class RoomTestConfiguration {
public static final String ROOM_APP_CLASSNAME_PROP = "room.app.classnames";
public static final String ROOM_APP_CLASSNAME_DEFAULT = "[org.kurento.room.basic.KurentoRoomBasicApp,"
+ "org.kurento.room.demo.KurentoRoomDemoApp]";
public static final String EXTRA_KMS_WS_URI_PROP = KMS_WS_URI_PROP + ".extra";
public static final String EXTRA_KMS_WS_URI_DEFAULT = KMS_WS_URI_DEFAULT;
public static final String ROOM_PREFIX = "room";
public static final String USER_BROWSER_PREFIX = "browser";
public static final String USER_FAKE_PREFIX = "user";
public static final String DEFAULT_ROOM = ROOM_PREFIX;
public final static int DEFAULT_ROOM_INOUT_AWAIT_TIME_IN_SECONDS = 60;
public final static int DEFAULT_ACTIVE_LIVE_TOTAL_TIMEOUT_IN_SECONDS = 60;
public final static int DEFAULT_PLAY_TIME_IN_SECONDS = 30;
public static final int TASKS_TIMEOUT_IN_MINUTES = 15;
}

View File

@ -1,149 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.fake;
import static io.openvidu.test.config.RoomTestConfiguration.EXTRA_KMS_WS_URI_DEFAULT;
import static io.openvidu.test.config.RoomTestConfiguration.EXTRA_KMS_WS_URI_PROP;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import org.junit.Test;
import org.kurento.client.KurentoClient;
import org.kurento.client.KurentoConnectionListener;
import org.kurento.commons.PropertiesManager;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalFakeTest;
import io.openvidu.test.config.RoomTestConfiguration;
/**
* Tests multiple fake WebRTC users concurrently joining the same room. Some of them are built on a
* pipeline from an extra KMS instance. (the config key for the WS URI of this instance is
* {@link RoomTestConfiguration#EXTRA_KMS_WS_URI_PROP}, with the default value
* {@link RoomTestConfiguration#EXTRA_KMS_WS_URI_DEFAULT})
*
* @see RoomTestConfiguration#EXTRA_KMS_WS_URI_PROP
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
public class ExtraKmsFakeUsers extends RoomFunctionalFakeTest<WebPage> {
public final static int NUM_USERS = 0;
public static String[] relativeUris = { "/video/filter/fiwarecut.webm",
"/video/filter/fiwarecut_30.webm", "/video/filter/street.webm" };
public static String[] extraRelativeUris = { "/video/filter/plates.webm" };
public String testExtraFakeKmsWsUri;
public KurentoClient testExtraFakeKurento;
@Override
public void setupBrowserTest() throws InterruptedException {
testExtraFakeKmsWsUri = PropertiesManager
.getProperty(EXTRA_KMS_WS_URI_PROP, fakeKms.getWsUri());
if (testExtraFakeKmsWsUri == null) {
testExtraFakeKmsWsUri = EXTRA_KMS_WS_URI_DEFAULT;
log.debug(
"Extra Fake KMS URI: {} (default value, as '{}' was not specified nor the Fake KMS had one)",
testExtraFakeKmsWsUri, EXTRA_KMS_WS_URI_PROP);
} else {
log.debug("Extra Fake KMS URI: {}", testExtraFakeKmsWsUri);
}
super.setupBrowserTest();
}
@Override
public void teardownBrowserTest() {
super.teardownBrowserTest();
if (testExtraFakeKurento != null) {
testExtraFakeKurento.destroy();
testExtraFakeKurento = null;
}
}
protected synchronized KurentoClient getTestExtraFakeKurento() {
if (testExtraFakeKurento == null) {
testExtraFakeKurento = KurentoClient.create(testExtraFakeKmsWsUri,
new KurentoConnectionListener() {
@Override
public void connected() {
}
@Override
public void connectionFailed() {
}
@Override
public void disconnected() {
testExtraFakeKurento = null;
}
@Override
public void reconnected(boolean sameServer) {
}
});
}
return testExtraFakeKurento;
}
@Test
public void test() {
int fakeUsers = relativeUris.length;
CountDownLatch joinLatch = parallelJoinFakeUsers(Arrays.asList(relativeUris), roomName,
fakeKurentoClient);
await(joinLatch, JOIN_ROOM_TOTAL_TIMEOUT_IN_SECONDS, "joinRoom", fakeUsers);
log.info("\n-----------------\n" + "Join concluded in room '{}'" + "\n-----------------\n",
roomName);
String aux = USER_FAKE_PREFIX;
USER_FAKE_PREFIX = USER_FAKE_PREFIX + "extra";
int extraFakeUsers = extraRelativeUris.length;
joinLatch = parallelJoinFakeUsers(Arrays.asList(extraRelativeUris), roomName,
getTestExtraFakeKurento());
USER_FAKE_PREFIX = aux;
CountDownLatch waitForLatch = parallelWaitActiveLive(roomName, fakeUsers);
await(waitForLatch, ACTIVE_LIVE_TOTAL_TIMEOUT_IN_SECONDS, "waitForActiveLive", fakeUsers);
USER_FAKE_PREFIX = USER_FAKE_PREFIX + "extra";
waitForLatch = parallelWaitActiveLive(roomName, extraFakeUsers);
await(waitForLatch, ACTIVE_LIVE_TOTAL_TIMEOUT_IN_SECONDS, "waitForActiveLiveExtra",
extraFakeUsers);
idlePeriod();
USER_FAKE_PREFIX = aux;
CountDownLatch leaveLatch = parallelLeaveFakeUsers(roomName, fakeUsers);
await(leaveLatch, LEAVE_ROOM_TOTAL_TIMEOUT_IN_SECONDS, "leaveRoom", fakeUsers);
USER_FAKE_PREFIX = USER_FAKE_PREFIX + "extra";
leaveLatch = parallelLeaveFakeUsers(roomName, extraFakeUsers);
await(leaveLatch, LEAVE_ROOM_TOTAL_TIMEOUT_IN_SECONDS, "leaveRoomExtra", extraFakeUsers);
log.info("\n-----------------\n" + "Leave concluded in room '{}'" + "\n-----------------\n",
roomName);
}
}

View File

@ -1,116 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.fake;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalFakeTest;
/**
* Tests multiple fake WebRTC and Selenium (Chrome) users sequentially joining the same room.
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
public class MixedUsers extends RoomFunctionalFakeTest<WebPage> {
public static String[] relativeUris = { "/video/filter/fiwarecut.webm",
"/video/filter/fiwarecut_30.webm" };
public final static int CHROME_SPINNER_USERS = 1;
@Test
public void test() {
int fakeUsers = relativeUris.length;
CountDownLatch joinLatch = parallelJoinFakeUsers(Arrays.asList(relativeUris), roomName,
fakeKurentoClient);
// fail if necessary before continuing
failWithExceptions();
boolean[] activeBrowserUsers = new boolean[CHROME_SPINNER_USERS];
int numUser = 0;
String userName = getBrowserKey(numUser);
log.info("User '{}' is joining room '{}'", userName, roomName);
joinToRoom(numUser, userName, roomName);
activeBrowserUsers[numUser] = true;
verify(activeBrowserUsers); // only browser users
log.info("User '{}' joined room '{}'", userName, roomName);
await(joinLatch, JOIN_ROOM_TOTAL_TIMEOUT_IN_SECONDS, "joinRoom", fakeUsers);
log.info("\n-----------------\n" + "Join concluded in room '{}'" + "\n-----------------\n",
roomName);
CountDownLatch waitForLatch = parallelWaitActiveLive(roomName, fakeUsers);
await(waitForLatch, ACTIVE_LIVE_TOTAL_TIMEOUT_IN_SECONDS, "waitForActiveLive", fakeUsers);
// verify from the browser
Map<String, Boolean> activeFakeWrUsers = new HashMap<String, Boolean>();
for (int i = 0; i < fakeUsers; i++) {
activeFakeWrUsers.put(getFakeKey(i), true);
}
verify(activeBrowserUsers, activeFakeWrUsers);
// let's check that video streams are being received in the browser
long start = System.currentTimeMillis();
waitForStream(numUser, userName, numUser);
long duration = System.currentTimeMillis() - start;
log.info("Video received in browser of user '{}' for user '{}' in {} millis", userName,
userName, duration);
for (int i = 0; i < fakeUsers; i++) {
start = System.currentTimeMillis();
waitForStream(numUser, userName, getFakeNativeStreamName(i));
duration = System.currentTimeMillis() - start;
log.info("Video received in browser of user '{}' for user '{}' in {} millis", userName,
getFakeKey(i), duration);
}
long aux = ROOM_ACTIVITY_IN_SECONDS;
ROOM_ACTIVITY_IN_SECONDS = 20;
idlePeriod();
int targetIndex = random.nextInt(fakeUsers);
log.debug("Selecting video of user {}", getFakeKey(targetIndex));
selectVideoTag(numUser, getFakeVideoStreamName(targetIndex));
ROOM_ACTIVITY_IN_SECONDS = aux;
idlePeriod();
CountDownLatch leaveLatch = parallelLeaveFakeUsers(roomName, fakeUsers);
await(leaveLatch, LEAVE_ROOM_TOTAL_TIMEOUT_IN_SECONDS, "leaveRoom", fakeUsers);
for (int i = 0; i < fakeUsers; i++) {
activeFakeWrUsers.put(getFakeKey(i), false);
}
verify(activeBrowserUsers, activeFakeWrUsers);
log.info("User '{}' is exiting from room '{}'", userName, roomName);
exitFromRoom(numUser, userName);
activeBrowserUsers[numUser] = false;
verify(activeBrowserUsers);
log.info("User '{}' exited from room '{}'", userName, roomName);
log.info("\n-----------------\n" + "Leave concluded in room '{}'" + "\n-----------------\n",
roomName);
}
}

View File

@ -1,65 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.fake;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import org.junit.Test;
import org.kurento.test.browser.WebPage;
import io.openvidu.test.RoomFunctionalFakeTest;
/**
* Tests several fake WebRTC users' concurrently joining the same room.
*
* @author Radu Tom Vlad (rvlad@naevatec.com)
* @since 6.2.1
*/
public abstract class ParallelNFakeUsers extends RoomFunctionalFakeTest<WebPage> {
public final static int NUM_USERS = 0;
public static String[] relativeUris = { "/video/filter/fiwarecut.webm",
"/video/filter/fiwarecut_30.webm", "/video/filter/street.webm" };
@Test
public void test() {
int fakeUsers = relativeUris.length;
CountDownLatch joinLatch = parallelJoinFakeUsers(Arrays.asList(relativeUris), roomName,
fakeKurentoClient);
await(joinLatch, JOIN_ROOM_TOTAL_TIMEOUT_IN_SECONDS, "joinRoom", fakeUsers);
log.info("\n-----------------\n" + "Join concluded in room '{}'" + "\n-----------------\n",
roomName);
CountDownLatch waitForLatch = parallelWaitActiveLive(roomName, fakeUsers);
await(waitForLatch, ACTIVE_LIVE_TOTAL_TIMEOUT_IN_SECONDS, "waitForActiveLive", fakeUsers);
idlePeriod();
CountDownLatch leaveLatch = parallelLeaveFakeUsers(roomName, fakeUsers);
await(leaveLatch, LEAVE_ROOM_TOTAL_TIMEOUT_IN_SECONDS, "leaveRoom", fakeUsers);
log.info("\n-----------------\n" + "Leave concluded in room '{}'" + "\n-----------------\n",
roomName);
}
}

View File

@ -1,57 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.fake.util;
public class AudioVideoFile {
private String audio;
private String video;
public AudioVideoFile(String audio, String video) {
super();
this.audio = audio;
this.video = video;
}
public String getAudio() {
return audio;
}
public void setAudio(String audio) {
this.audio = audio;
}
public String getVideo() {
return video;
}
public void setVideo(String video) {
this.video = video;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("[");
if (audio != null) {
builder.append("audio=").append(audio).append(", ");
}
if (video != null) {
builder.append("video=").append(video);
}
builder.append("]");
return builder.toString();
}
}

View File

@ -1,498 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.fake.util;
import java.io.Closeable;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.kurento.client.EndOfStreamEvent;
import org.kurento.client.ErrorEvent;
import org.kurento.client.EventListener;
import org.kurento.client.IceCandidate;
import org.kurento.client.MediaPipeline;
import org.kurento.client.MediaState;
import org.kurento.client.MediaStateChangedEvent;
import org.kurento.client.OnIceCandidateEvent;
import org.kurento.client.PlayerEndpoint;
import org.kurento.client.WebRtcEndpoint;
import io.openvidu.client.OpenViduClient;
import io.openvidu.client.internal.IceCandidateInfo;
import io.openvidu.client.internal.Notification;
import io.openvidu.client.internal.ParticipantLeftInfo;
import io.openvidu.client.internal.ParticipantPublishedInfo;
import io.openvidu.client.internal.ParticipantUnpublishedInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author <a href="mailto:rvlad@naevatec.com">Radu Tom Vlad</a>
*
*/
public class FakeParticipant implements Closeable {
private static final long WAIT_ACTIVE_LIVE_BY_PEER_TIMEOUT = 10; // seconds
private static Logger log = LoggerFactory.getLogger(FakeParticipant.class);
private OpenViduClient jsonRpcClient;
private MediaPipeline pipeline;
private WebRtcEndpoint webRtc;
private CountDownLatch ownLatch = new CountDownLatch(1);
private PlayerEndpoint player;
private String name;
private String room;
private String playerUri;
private boolean autoMedia = false;
private boolean loopMedia = false;
private Map<String, String> peerStreams = new ConcurrentSkipListMap<String, String>();
private Map<String, WebRtcEndpoint> peerEndpoints = new ConcurrentSkipListMap<String, WebRtcEndpoint>();
private Map<String, CountDownLatch> peerLatches = new ConcurrentSkipListMap<String, CountDownLatch>();
private Thread notifThread;
public FakeParticipant(String serviceUrl, String name, String room, String playerUri,
MediaPipeline pipeline, boolean autoMedia, boolean loopMedia) {
this.name = name;
this.room = room;
this.playerUri = playerUri;
this.autoMedia = autoMedia;
this.loopMedia = loopMedia;
this.pipeline = pipeline;
this.jsonRpcClient = new OpenViduClient(serviceUrl);
this.notifThread = new Thread(name + "-notif") {
@Override
public void run() {
try {
internalGetNotification();
} catch (InterruptedException e) {
log.debug("Interrupted while running notification polling");
return;
}
}
};
this.notifThread.start();
}
private void internalGetNotification() throws InterruptedException {
log.info("Starting receiving notifications by polling blocking queue");
while (true) {
try {
Notification notif = jsonRpcClient.getServerNotification();
if (notif == null) {
return;
}
log.debug("Polled notif {}", notif);
switch (notif.getMethod()) {
case ICECANDIDATE_METHOD:
onIceCandidate(notif);
break;
case MEDIAERROR_METHOD:
// TODO
break;
case PARTICIPANTEVICTED_METHOD:
// TODO
break;
case PARTICIPANTJOINED_METHOD:
// TODO
break;
case PARTICIPANTLEFT_METHOD:
onParticipantLeft(notif);
break;
case PARTICIPANTPUBLISHED_METHOD:
onParticipantPublished(notif);
break;
case PARTICIPANTSENDMESSAGE_METHOD:
break;
case PARTICIPANTUNPUBLISHED_METHOD:
onParticipantUnpublish(notif);
break;
case ROOMCLOSED_METHOD:
// TODO
break;
default:
break;
}
} catch (Exception e) {
log.warn("Encountered a problem when reading " + "the notifications queue", e);
}
}
}
private void onParticipantUnpublish(Notification notif) {
ParticipantUnpublishedInfo info = (ParticipantUnpublishedInfo) notif;
log.debug("Notif details {}: {}", info.getClass().getSimpleName(), info);
releaseRemote(info.getName());
}
private void onParticipantLeft(Notification notif) {
ParticipantLeftInfo info = (ParticipantLeftInfo) notif;
log.debug("Notif details {}: {}", info.getClass().getSimpleName(), info);
releaseRemote(info.getName());
}
private void releaseRemote(String remote) {
WebRtcEndpoint peer = peerEndpoints.get(remote);
if (peer != null) {
peer.release();
}
peerEndpoints.remove(remote);
}
private void onParticipantPublished(Notification notif) {
ParticipantPublishedInfo info = (ParticipantPublishedInfo) notif;
log.debug("Notif details {}: {}", info.getClass().getSimpleName(), info);
String remote = info.getId();
addPeerStream(remote, info.getStreams());
if (autoMedia) {
if (peerEndpoints.containsKey(remote)) {
log.info("(autosubscribe on) Already subscribed to {}. No actions required.", remote);
return;
}
subscribe(remote);
}
}
private void onIceCandidate(Notification notif) {
IceCandidateInfo info = (IceCandidateInfo) notif;
log.debug("Notif details {}: {}", info.getClass().getSimpleName(), info);
String epname = info.getEndpointName();
if (name.equals(epname)) {
if (webRtc != null) {
webRtc.addIceCandidate(toKurentoIceCandidate(info.getIceCandidate()));
}
} else {
WebRtcEndpoint peer = peerEndpoints.get(epname);
if (peer != null) {
peer.addIceCandidate(toKurentoIceCandidate(info.getIceCandidate()));
}
}
}
private IceCandidate toKurentoIceCandidate(
io.openvidu.client.internal.IceCandidate iceCandidate) {
return new IceCandidate(iceCandidate.getCandidate(), iceCandidate.getSdpMid(),
iceCandidate.getSdpMLineIndex());
}
public void joinRoom() {
try {
addPeers(jsonRpcClient.joinRoom(room, name));
log.info("Joined room {}: {} peers", room, peerStreams);
if (autoMedia) {
log.debug("Automedia on, publishing and subscribing to as many as {} publishers",
peerStreams.size());
publish();
if (!peerStreams.isEmpty()) {
for (Entry<String, String> e : peerStreams.entrySet()) {
String stream = e.getValue();
String remote = e.getKey();
if (stream != null) {
subscribe(remote);
}
}
log.debug("Finished subscribing to existing publishers");
}
}
} catch (IOException e) {
log.warn("Unable to join room '{}'", room, e);
Assert.fail("Unable to join: " + e.getMessage());
}
}
public void leaveRoom() {
try {
jsonRpcClient.leaveRoom();
log.info("Left room '{}'", room);
} catch (IOException e) {
log.warn("Unable to leave room '{}'", room, e);
Assert.fail("Unable to leave room: " + e.getMessage());
}
}
public void publish() {
try {
String sdpOffer = createWebRtcForParticipant();
String sdpAnswer = jsonRpcClient.publishVideo(sdpOffer, false);
this.webRtc.processAnswer(sdpAnswer);
this.webRtc.gatherCandidates();
player.play();
log.debug("Published media in room '{}'", room);
log.trace("Published media in room '{}'- SDP OFFER:\n{}\nSDP ANSWER:\n{}", room, sdpOffer,
sdpAnswer);
} catch (IOException | URISyntaxException e) {
log.warn("Unable to publish in room '{}'", room, e);
Assert.fail("Unable to publish: " + e.getMessage());
}
}
public void unpublish() {
try {
jsonRpcClient.unpublishVideo();
log.debug("Unpublished media");
} catch (IOException e) {
log.warn("Unable to unpublish in room '{}'", room, e);
Assert.fail("Unable to unpublish: " + e.getMessage());
} finally {
if (player != null) {
player.stop();
player.release();
}
if (webRtc != null) {
webRtc.release();
}
ownLatch = null;
}
}
public synchronized void subscribe(String remoteName) {
try {
if (peerEndpoints.containsKey(remoteName)) {
log.warn("Already subscribed to {}", remoteName);
return;
}
String sdpOffer = createWebRtcForPeer(remoteName);
String sdpAnswer = jsonRpcClient.receiveVideoFrom(peerStreams.get(remoteName), sdpOffer);
WebRtcEndpoint peer = peerEndpoints.get(remoteName);
if (peer == null) {
throw new Exception("Receiving endpoint not found for peer " + remoteName);
}
peer.processAnswer(sdpAnswer);
peer.gatherCandidates();
log.debug("Subscribed to '{}' in room '{}'", peerStreams.get(remoteName), room);
log.trace("Subscribed to '{}' in room '{}' - SDP OFFER:\n{}\nSDP ANSWER:\n{}",
peerStreams.get(remoteName), room, sdpOffer, sdpAnswer);
} catch (Exception e) {
log.warn("Unable to subscribe in room '{}' to '{}'", room, remoteName, e);
Assert.fail("Unable to subscribe: " + e.getMessage());
}
}
public synchronized void unsubscribe(String remoteName) {
WebRtcEndpoint peer = null;
try {
peer = peerEndpoints.get(remoteName);
if (peer == null) {
log.warn("No local peer found for remote {}", remoteName);
}
jsonRpcClient.unsubscribeFromVideo(peerStreams.get(remoteName));
log.debug("Unsubscribed from {}", peerStreams.get(remoteName));
} catch (IOException e) {
log.warn("Unable to unsubscribe in room '{}' from '{}'", room, remoteName, e);
Assert.fail("Unable to unsubscribe: " + e.getMessage());
} finally {
if (peer != null) {
peer.release();
}
peerEndpoints.remove(remoteName);
peerLatches.remove(remoteName);
}
}
public Set<String> getPeers() {
return peerStreams.keySet();
}
private String createWebRtcForParticipant() throws URISyntaxException {
webRtc = new WebRtcEndpoint.Builder(pipeline).build();
ownLatch = new CountDownLatch(1);
webRtc.addOnIceCandidateListener(new EventListener<OnIceCandidateEvent>() {
@Override
public void onEvent(OnIceCandidateEvent event) {
try {
log.debug("New ICE candidate: {}, {}, {}", event.getCandidate().getCandidate(),
event.getCandidate().getSdpMid(), event.getCandidate().getSdpMLineIndex());
jsonRpcClient.onIceCandidate(name, event.getCandidate().getCandidate(),
event.getCandidate().getSdpMid(), event.getCandidate().getSdpMLineIndex());
} catch (Exception e) {
log.warn("Exception sending iceCanditate. Exception {}:{}", e.getClass().getName(),
e.getMessage());
}
}
});
webRtc.addMediaStateChangedListener(new EventListener<MediaStateChangedEvent>() {
@Override
public void onEvent(MediaStateChangedEvent event) {
log.info("Media state changed: {}", event.getNewState());
if (event.getNewState() == MediaState.CONNECTED) {
ownLatch.countDown();
}
}
});
player = new PlayerEndpoint.Builder(pipeline, playerUri).build();
player.addErrorListener(new EventListener<ErrorEvent>() {
@Override
public void onEvent(ErrorEvent event) {
log.warn("ErrorEvent for player of '{}': {}", name, event.getDescription());
}
});
player.addEndOfStreamListener(new EventListener<EndOfStreamEvent>() {
@Override
public void onEvent(EndOfStreamEvent event) {
if (loopMedia) {
log.debug("Replaying {}", playerUri);
player.play();
} else {
log.debug("Finished playing from {}", playerUri);
}
}
});
player.connect(webRtc);
log.debug("Playing media from {}", playerUri);
return webRtc.generateOffer();
}
private String createWebRtcForPeer(final String remoteName) throws Exception {
if (peerEndpoints.containsKey(remoteName)) {
throw new Exception("Already subscribed to " + remoteName);
}
WebRtcEndpoint peer = new WebRtcEndpoint.Builder(pipeline).build();
final CountDownLatch peerLatch = new CountDownLatch(1);
peer.addOnIceCandidateListener(new EventListener<OnIceCandidateEvent>() {
@Override
public void onEvent(OnIceCandidateEvent event) {
try {
jsonRpcClient.onIceCandidate(remoteName, event.getCandidate().getCandidate(),
event.getCandidate().getSdpMid(), event.getCandidate().getSdpMLineIndex());
} catch (Exception e) {
log.warn("Exception sending iceCanditate. Exception {}:{}", e.getClass().getName(),
e.getMessage());
}
}
});
peer.addMediaStateChangedListener(new EventListener<MediaStateChangedEvent>() {
@Override
public void onEvent(MediaStateChangedEvent event) {
log.info("{}: Media state changed for remote {}: {}", name, remoteName,
event.getNewState());
if (event.getNewState() == MediaState.CONNECTED) {
peerLatch.countDown();
}
}
});
peerEndpoints.put(remoteName, peer);
peerLatches.put(remoteName, peerLatch);
return peer.generateOffer();
}
@Override
public void close() {
log.debug("Closing {}", name);
try {
if (jsonRpcClient != null) {
jsonRpcClient.close();
}
} catch (Exception e) {
log.error("Exception closing jsonRpcClient", e);
}
notifThread.interrupt();
}
public void waitForActiveLive(CountDownLatch waitForLatch) {
try {
boolean allPeersConnected = true;
for (WebRtcEndpoint peer : peerEndpoints.values()) {
if (peer.getMediaState() != MediaState.CONNECTED) {
allPeersConnected = false;
}
}
boolean ownConnected = webRtc.getMediaState() == MediaState.CONNECTED;
if (ownConnected && allPeersConnected) {
return;
}
long remaining = WAIT_ACTIVE_LIVE_BY_PEER_TIMEOUT * (peerEndpoints.size() + 1);
log.debug("{}: Start waiting for ACTIVE_LIVE in session '{}' - max {}s", name, room,
remaining);
remaining = remaining * 1000L;
if (!ownConnected) {
remaining = waitForLatch(remaining, ownLatch, name);
}
if (!allPeersConnected) {
for (Entry<String, WebRtcEndpoint> e : peerEndpoints.entrySet()) {
String remoteName = e.getKey();
if (e.getValue().getMediaState() != MediaState.CONNECTED) {
remaining = waitForLatch(remaining, peerLatches.get(remoteName), remoteName);
}
}
}
} catch (Exception e) {
log.warn("{}: WaitForActiveLive error", name, e);
throw e;
} finally {
waitForLatch.countDown();
}
}
private long waitForLatch(long remaining, CountDownLatch latch, String epname) {
long start = System.currentTimeMillis();
try {
if (!latch.await(remaining, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("Timeout waiting for ACTIVE_LIVE in participant '" + name
+ "' of session '" + room + "' for endpoint '" + epname + "'");
}
remaining -= System.currentTimeMillis() - start;
log.trace("ACTIVE_LIVE - remaining {} ms", remaining);
} catch (InterruptedException e) {
log.warn("InterruptedException when waiting for ACTIVE_LIVE in participant '{}' "
+ "of session '{}' for endpoint '{}'", name, room, epname);
}
return remaining;
}
private void addPeers(Map<String, List<String>> newPeers) {
for (String name : newPeers.keySet()) {
addPeerStream(name, newPeers.get(name));
}
}
private synchronized void addPeerStream(String name, List<String> streams) {
if (streams == null || streams.isEmpty()) {
log.warn("Wrong streams info for {}: {}", name, streams);
return;
}
if (this.peerStreams.containsKey(name)) {
log.warn("Overriding peer {}: {} - new: {}", name, this.peerStreams.get(name), streams);
}
this.peerStreams.put(name, name + "_" + streams.get(0));
log.debug("Added first remote stream for {}: {}", name, this.peerStreams.get(name));
}
}

View File

@ -1,102 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.fake.util;
import java.io.Closeable;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import org.kurento.client.KurentoClient;
import org.kurento.client.MediaPipeline;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Stores the fake WebRTC participants for a session (room). Each participant will have assigned a
* shared {@link MediaPipeline} which it can use to create media elements and interact with the
* session. More than one pipelines are allowed for each session.
*
* @author <a href="mailto:rvlad@naevatec.com">Radu Tom Vlad</a>
*/
public class FakeSession implements Closeable {
private static Logger log = LoggerFactory.getLogger(FakeSession.class);
private String serviceUrl;
private String room;
private KurentoClient defaultKurento;
private Map<KurentoClient, TestPipeline> pipelines = new ConcurrentHashMap<KurentoClient, TestPipeline>();
private Map<String, FakeParticipant> participants = new HashMap<String, FakeParticipant>();
public FakeSession(String serviceUrl, String room, KurentoClient kurento) {
this.serviceUrl = serviceUrl;
this.room = room;
this.defaultKurento = kurento;
this.pipelines.put(kurento, new TestPipeline(kurento, room));
}
@Override
public void close() throws IOException {
log.debug("Closing Session '{}'", room);
for (FakeParticipant p : participants.values()) {
p.close();
}
for (TestPipeline pipeline : this.pipelines.values()) {
pipeline.closePipeline();
}
}
public void newParticipant(String name, String playerUri, boolean autoMedia, boolean loopMedia) {
newParticipant(name, playerUri, autoMedia, loopMedia, defaultKurento);
}
public void newParticipant(String name, String playerUri, boolean autoMedia, boolean loopMedia,
KurentoClient kurento) {
TestPipeline pipeline = getOrCreatePipeline(kurento);
pipeline.createPipeline();
FakeParticipant participant = new FakeParticipant(serviceUrl, name, room, playerUri,
pipeline.getPipeline(), autoMedia, loopMedia);
participants.put(name, participant);
participant.joinRoom();
}
public FakeParticipant getParticipant(String name) {
return participants.get(name);
}
public void waitForActiveLive(CountDownLatch waitForLatch) {
for (FakeParticipant p : participants.values()) {
p.waitForActiveLive(waitForLatch);
}
}
private TestPipeline getOrCreatePipeline(KurentoClient kurento) {
TestPipeline pipeline = this.pipelines.get(kurento);
if (pipeline == null) {
String desc = kurento.getServerManager().getId();
pipeline = this.pipelines.putIfAbsent(kurento, new TestPipeline(kurento, room, desc));
if (pipeline != null) {
log.debug("Pipeline already created for room '{}' and kurento '{}'", room, desc);
}
pipeline = this.pipelines.get(kurento);
}
return pipeline;
}
}

View File

@ -1,107 +0,0 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openvidu.test.fake.util;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.kurento.client.ErrorEvent;
import org.kurento.client.EventListener;
import org.kurento.client.KurentoClient;
import org.kurento.client.MediaPipeline;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Wraps a pipeline used to execute fake participants in a test session (room).
*
* @author <a href="mailto:rvlad@naevatec.com">Radu Tom Vlad</a>
*/
public class TestPipeline {
private static Logger log = LoggerFactory.getLogger(TestPipeline.class);
private KurentoClient kurento;
private MediaPipeline pipeline;
private CountDownLatch pipelineLatch = new CountDownLatch(1);
private Object pipelineCreateLock = new Object();
private Object pipelineReleaseLock = new Object();
private volatile boolean pipelineReleased = false;
private String description = "default";
private String room = "room";
public TestPipeline(KurentoClient kurento, String room, String pipeDescription) {
this.kurento = kurento;
if (room != null) {
this.room = room;
}
if (pipeDescription != null) {
this.description = pipeDescription;
}
}
public TestPipeline(KurentoClient kurento, String room) {
this(kurento, room, null);
}
public MediaPipeline getPipeline() {
try {
pipelineLatch.await(60, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return this.pipeline;
}
public void createPipeline() {
synchronized (pipelineCreateLock) {
if (pipeline != null) {
return;
}
log.info("Session '{}': Creating MediaPipeline-{}", room, description);
try {
pipeline = kurento.createMediaPipeline();
pipelineLatch.countDown();
log.debug("Session '{}': Created MediaPipeline-{}", room, description);
} catch (Exception e) {
log.error("Unable to create MediaPipeline-{} for Session '{}'", description, room, e);
pipelineLatch.countDown();
}
if (getPipeline() == null) {
throw new RuntimeException(
"Unable to create MediaPipeline-" + description + " for session '" + room + "'");
}
pipeline.addErrorListener(new EventListener<ErrorEvent>() {
@Override
public void onEvent(ErrorEvent event) {
String desc = event.getType() + ": " + event.getDescription() + "(errCode="
+ event.getErrorCode() + ")";
log.warn("Session '{}': Pipeline error encountered for MediaPipeline-{}: {}", room,
description, desc);
}
});
}
}
public void closePipeline() {
synchronized (pipelineReleaseLock) {
if (pipeline == null || pipelineReleased) {
return;
}
getPipeline().release();
}
}
}

View File

@ -63,7 +63,6 @@
<version.openvidu.java.client>2.12.1</version.openvidu.java.client>
<version.openvidu.client>1.1.0</version.openvidu.client>
<version.openvidu.test>1.1.0</version.openvidu.test>
<version.openvidu.test.browsers>1.1.0</version.openvidu.test.browsers>
<version.enforcer.plugin>3.0.0-M3</version.enforcer.plugin>
@ -219,7 +218,6 @@
<modules>
<module>openvidu-server</module>
<module>openvidu-client</module>
<module>openvidu-test</module>
<module>openvidu-test-e2e</module>
<module>openvidu-test-browsers</module>
<module>openvidu-java-client</module>
@ -288,10 +286,6 @@
<groupId>io.openvidu</groupId>
<artifactId>openvidu-client</artifactId>
</dependency>
<dependency>
<groupId>io.openvidu</groupId>
<artifactId>openvidu-test</artifactId>
</dependency>
<dependency>
<groupId>io.openvidu</groupId>
<artifactId>openvidu-test-e2e</artifactId>