@xylink/xy-rtc-sdk 2.1.2 → 3.8.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.MD +37 -37
  2. package/lib/{src/action → action}/index.d.ts +237 -236
  3. package/lib/{src/enum → enum}/contraints.d.ts +116 -116
  4. package/lib/{src/enum → enum}/errorCode.d.ts +880 -880
  5. package/lib/{src/enum → enum}/index.d.ts +137 -133
  6. package/lib/{src/index.d.ts → index.d.ts} +34 -34
  7. package/lib/{src/main → main}/client.d.ts +878 -808
  8. package/lib/{src/main → main}/deviceManager.d.ts +164 -164
  9. package/lib/{src/main → main}/helper.d.ts +51 -51
  10. package/lib/{src/main → main}/iauth.d.ts +33 -33
  11. package/lib/{src/main → main}/layoutManager.d.ts +214 -214
  12. package/lib/{src/main → main}/peer.d.ts +311 -311
  13. package/lib/{src/main → main}/qualityManager.d.ts +39 -39
  14. package/lib/{src/main → main}/stream.d.ts +263 -243
  15. package/lib/{src/main → main}/videoManager.d.ts +65 -65
  16. package/lib/{src/tools → tools}/audioLevel.d.ts +23 -23
  17. package/lib/{src/tools → tools}/browser.d.ts +55 -55
  18. package/lib/{src/tools → tools}/config.d.ts +12 -12
  19. package/lib/{src/tools → tools}/db.d.ts +85 -85
  20. package/lib/{src/tools → tools}/detect.d.ts +44 -45
  21. package/lib/{src/tools → tools}/emmitter.d.ts +15 -15
  22. package/lib/{src/tools → tools}/enum.d.ts +6 -6
  23. package/lib/{src/tools → tools}/httpClient.d.ts +64 -64
  24. package/lib/{src/tools → tools}/i18n.d.ts +8 -8
  25. package/lib/{src/tools → tools}/index.d.ts +8 -8
  26. package/lib/{src/tools → tools}/logger.d.ts +151 -151
  27. package/lib/{src/tools → tools}/socket.d.ts +53 -53
  28. package/lib/{src/tools → tools}/store.d.ts +15 -15
  29. package/lib/{src/tools → tools}/template.d.ts +14 -14
  30. package/lib/{src/tools → tools}/utils.d.ts +73 -67
  31. package/lib/{src/tools → tools}/verify.d.ts +7 -7
  32. package/lib/{src/type → type}/base.d.ts +71 -71
  33. package/lib/{src/type → type}/client.d.ts +1121 -1106
  34. package/lib/{src/type → type}/device.d.ts +77 -77
  35. package/lib/{src/type → type}/index.d.ts +11 -11
  36. package/lib/{src/type → type}/quality.d.ts +77 -77
  37. package/lib/{src/type → type}/stream.d.ts +426 -426
  38. package/lib/xyrtc.cjs.js +1 -0
  39. package/lib/xyrtc.umd.js +1 -0
  40. package/package.json +119 -130
  41. package/scripts/build_lib.js +16 -0
  42. package/scripts/utils.js +27 -0
  43. package/scripts/webpack.common.js +139 -0
  44. package/scripts/webpack.dev.js +27 -0
  45. package/scripts/webpack.sdk.js +68 -0
  46. package/tsconfig.lib.json +37 -0
  47. package/lib/index.es.js +0 -3
  48. package/lib/index.js +0 -3
package/package.json CHANGED
@@ -1,130 +1,119 @@
1
- {
2
- "name": "@xylink/xy-rtc-sdk",
3
- "version": "2.1.2",
4
- "description": "XYRTC SDK(小鱼易连web音视频 sdk)",
5
- "keywords": [
6
- "webrtc",
7
- "xylink",
8
- "xyrtc",
9
- "xyrtc sdk"
10
- ],
11
- "main": "lib/index.js",
12
- "types": "lib/src/index.d.ts",
13
- "scripts": {
14
- "start": "vite",
15
- "dev": "vite",
16
- "build:demo": "tsc && vite build",
17
- "preview": "vite preview",
18
- "build-watch": "rollup -c -w",
19
- "build": "NODE_ENV=production rollup -c",
20
- "test": "jest",
21
- "version:beta": "npm version prerelease --preid=beta",
22
- "publish:beta": "npm publish --tag beta --access public",
23
- "xytools": "xytools"
24
- },
25
- "author": "jinghui-Luo",
26
- "email": "luojinghui424@gmail.com",
27
- "bugs": {
28
- "url": "https://github.com/xylink-com/xylink-rtc-demo/issues",
29
- "email": "luojinghui424@gmail.com"
30
- },
31
- "devDependencies": {
32
- "@babel/core": "^7.7.4",
33
- "@babel/plugin-proposal-class-properties": "^7.7.4",
34
- "@babel/plugin-syntax-dynamic-import": "^7.7.4",
35
- "@babel/plugin-transform-typescript": "^7.7.4",
36
- "@babel/preset-env": "^7.7.4",
37
- "@babel/preset-react": "^7.6.3",
38
- "@babel/preset-typescript": "^7.7.4",
39
- "@rollup/plugin-node-resolve": "^7.0.0",
40
- "@rollup/plugin-replace": "^2.3.0",
41
- "@types/clone-deep": "^4.0.1",
42
- "@types/crypto-js": "^4.0.1",
43
- "@types/downloadjs": "^1.4.2",
44
- "@types/react": "^17.0.3",
45
- "@types/react-dom": "^17.0.6",
46
- "@types/uuid": "^8.3.0",
47
- "@typescript-eslint/eslint-plugin": "^2.9.0",
48
- "@typescript-eslint/parser": "^2.9.0",
49
- "@vitejs/plugin-react-refresh": "^1.3.2",
50
- "antd": "4.10.1",
51
- "axios": "^0.19.1",
52
- "babel-loader": "^8.0.6",
53
- "babel-plugin-import": "^1.12.2",
54
- "babel-polyfill": "^6.26.0",
55
- "babel-preset-env": "^1.7.0",
56
- "babel-preset-es2015": "^6.24.1",
57
- "babel-preset-react": "^6.24.1",
58
- "babel-preset-react-app": "^9.0.2",
59
- "clone-deep": "^4.0.1",
60
- "core-js": "^3.6.5",
61
- "downloadjs": "^1.4.7",
62
- "eslint": "^6.7.1",
63
- "eslint-config-alloy": "^3.4.0",
64
- "husky": "^4.3.8",
65
- "jest": "^25.1.0",
66
- "jszip": "^3.5.0",
67
- "less": "^3.10.3",
68
- "lint-staged": "^10.5.4",
69
- "prettier": "^1.19.1",
70
- "react": "^16.10.2",
71
- "react-dom": "^16.10.2",
72
- "rollup": "^2.44.0",
73
- "rollup-plugin-babel": "^4.3.3",
74
- "rollup-plugin-cleanup": "^3.2.1",
75
- "rollup-plugin-clear": "^2.0.7",
76
- "rollup-plugin-commonjs": "^10.1.0",
77
- "rollup-plugin-json": "^4.0.0",
78
- "rollup-plugin-sourcemaps": "^0.4.2",
79
- "rollup-plugin-terser": "^5.1.2",
80
- "rollup-plugin-typescript2": "^0.25.2",
81
- "sass": "^1.32.10",
82
- "typescript": "^4.3.2",
83
- "validate-commit-msg": "^2.14.0",
84
- "vconsole": "^3.3.4",
85
- "vite": "^2.6.13",
86
- "vite-plugin-imp": "^2.0.7",
87
- "vite-plugin-importer": "^0.2.1",
88
- "vite-plugin-svgr": "^1.1.0",
89
- "xytools": "1.5.2-beta.4"
90
- },
91
- "dependencies": {
92
- "crypto-browserify": "^3.12.0",
93
- "crypto-js": "^4.1.1",
94
- "dexie": "^2.0.4",
95
- "dexie-export-import": "^1.0.0-rc.1",
96
- "encryptlong": "^3.1.4",
97
- "js-base64": "^3.6.1",
98
- "qs": "^6.9.4",
99
- "uuid": "^7.0.2"
100
- },
101
- "husky": {
102
- "hooks": {
103
- "pre-commit": "lint-staged",
104
- "commit-msg": "validate-commit-msg"
105
- }
106
- },
107
- "config": {
108
- "validate-commit-msg": {
109
- "types": [
110
- "feat",
111
- "fix",
112
- "docs",
113
- "style",
114
- "refactor",
115
- "perf",
116
- "test",
117
- "build",
118
- "ci",
119
- "chore",
120
- "revert",
121
- "merge"
122
- ]
123
- }
124
- },
125
- "lint-staged": {
126
- "{src,demo}/**/*.{js,jsx,json,ts,tsx,scss,sass,css,md}": [
127
- "prettier --write"
128
- ]
129
- }
130
- }
1
+ {
2
+ "name": "@xylink/xy-rtc-sdk",
3
+ "version": "3.8.0-beta.1",
4
+ "description": "XYLink RTC SDK(小鱼易连WebRTC SDK)",
5
+ "keywords": [
6
+ "XYLink RTC SDK",
7
+ "XYLink WebRTC SDK",
8
+ "WebRTC SDK",
9
+ "RTC SDK"
10
+ ],
11
+ "main": "lib/xyrtc.cjs.js",
12
+ "types": "lib/index.d.ts",
13
+ "scripts": {
14
+ "dev": "npm run start",
15
+ "start": "cross-env NODE_ENV=development webpack serve --config ./scripts/webpack.dev.js",
16
+ "build:demo": "cross-env NODE_ENV=production webpack --config ./scripts/webpack.common.js",
17
+ "build:lib": "cross-env NODE_ENV=production webpack --config ./scripts/webpack.sdk.js",
18
+ "build:nodeLib": "node ./scripts/build_lib.js",
19
+ "test": "jest",
20
+ "xytools": "xytools",
21
+ "version:beta": "npm version prerelease --preid=beta",
22
+ "publish:beta": "npm publish --tag beta --access public"
23
+ },
24
+ "author": "jinghui-Luo",
25
+ "email": "luojinghui424@gmail.com",
26
+ "bugs": {
27
+ "url": "https://github.com/xylink-com/xylink-rtc-demo/issues",
28
+ "email": "luojinghui424@gmail.com"
29
+ },
30
+ "devDependencies": {
31
+ "@babel/core": "^7.18.10",
32
+ "@babel/plugin-transform-runtime": "^7.18.10",
33
+ "@babel/preset-env": "^7.18.10",
34
+ "@babel/preset-react": "^7.18.6",
35
+ "@babel/preset-typescript": "^7.7.4",
36
+ "@svgr/webpack": "^6.3.1",
37
+ "@types/clone-deep": "^4.0.1",
38
+ "@types/crypto-js": "^4.0.1",
39
+ "@types/downloadjs": "^1.4.2",
40
+ "@types/react": "^17.0.3",
41
+ "@types/react-dom": "^17.0.6",
42
+ "@types/uuid": "^8.3.0",
43
+ "antd": "4.10.1",
44
+ "axios": "^0.19.1",
45
+ "babel-loader": "^8.2.5",
46
+ "babel-plugin-import": "^1.13.5",
47
+ "clone-deep": "^4.0.1",
48
+ "copy-webpack-plugin": "^11.0.0",
49
+ "core-js": "^3.24.1",
50
+ "cross-env": "^7.0.3",
51
+ "css-loader": "^6.7.1",
52
+ "dexie": "^2.0.4",
53
+ "dexie-export-import": "^1.0.0-rc.1",
54
+ "downloadjs": "^1.4.7",
55
+ "eslint": "^6.7.1",
56
+ "eslint-config-alloy": "^3.4.0",
57
+ "html-webpack-plugin": "^5.5.0",
58
+ "husky": "^4.3.8",
59
+ "jest": "^25.1.0",
60
+ "jszip": "^3.5.0",
61
+ "less": "^4.1.3",
62
+ "less-loader": "^11.0.0",
63
+ "lint-staged": "^10.5.4",
64
+ "mini-css-extract-plugin": "^2.6.1",
65
+ "postcss-loader": "^7.0.1",
66
+ "prettier": "^1.19.1",
67
+ "react": "^16.10.2",
68
+ "react-dom": "^16.10.2",
69
+ "sass": "^1.54.3",
70
+ "sass-loader": "^13.0.2",
71
+ "style-loader": "^3.3.1",
72
+ "terser-webpack-plugin": "^5.3.3",
73
+ "ts-loader": "^9.3.1",
74
+ "typescript": "^4.3.2",
75
+ "validate-commit-msg": "^2.14.0",
76
+ "vconsole": "^3.3.4",
77
+ "webpack": "^5.74.0",
78
+ "webpack-cli": "^4.10.0",
79
+ "webpack-dev-server": "^4.9.3",
80
+ "worker-loader": "^3.0.8",
81
+ "xytools": "^1.5.7"
82
+ },
83
+ "dependencies": {
84
+ "crypto-browserify": "^3.12.0",
85
+ "crypto-js": "^4.1.1",
86
+ "encryptlong": "^3.1.4",
87
+ "js-base64": "^3.6.1",
88
+ "uuid": "^7.0.2"
89
+ },
90
+ "husky": {
91
+ "hooks": {
92
+ "pre-commit": "lint-staged",
93
+ "commit-msg": "validate-commit-msg"
94
+ }
95
+ },
96
+ "config": {
97
+ "validate-commit-msg": {
98
+ "types": [
99
+ "feat",
100
+ "fix",
101
+ "docs",
102
+ "style",
103
+ "refactor",
104
+ "perf",
105
+ "test",
106
+ "build",
107
+ "ci",
108
+ "chore",
109
+ "revert",
110
+ "merge"
111
+ ]
112
+ }
113
+ },
114
+ "lint-staged": {
115
+ "{src,demo}/**/*.{js,jsx,json,ts,tsx,scss,sass,css,md}": [
116
+ "prettier --write"
117
+ ]
118
+ }
119
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * XYLink WebRTC SDK Build Npm Script
3
+ *
4
+ * Created at : 2022-08-12 19:11:52
5
+ * Last modified : 2022-08-16 21:01:37
6
+ */
7
+
8
+ const shell = require('shelljs');
9
+ const path = require('path');
10
+
11
+ const cross = `${path.resolve(__dirname, '../node_modules/cross-env/src/bin/cross-env.js')}`;
12
+ const webpack = `${path.resolve(__dirname, '../node_modules/webpack/bin/webpack.js')}`;
13
+
14
+ shell.exec(`${cross} NODE_ENV=production && ${webpack} --config ./scripts/webpack.sdk.js`, () => {
15
+ console.log('构建包结束');
16
+ });
@@ -0,0 +1,27 @@
1
+ const currentTime = () => {
2
+ const now = new Date();
3
+ const year = now.getFullYear(); //年
4
+ const month = now.getMonth() + 1; //月
5
+ const day = now.getDate(); //日
6
+ const hh = now.getHours(); //时
7
+ const mm = now.getMinutes(); //分
8
+ let clock = year + '-';
9
+
10
+ if (month < 10) clock += '0';
11
+ clock += month + '-';
12
+
13
+ if (day < 10) clock += '0';
14
+ clock += day + ' ';
15
+
16
+ if (hh < 10) clock += '0';
17
+ clock += hh + ':';
18
+
19
+ if (mm < 10) clock += '0';
20
+ clock += mm;
21
+
22
+ return clock;
23
+ };
24
+
25
+ module.exports = {
26
+ currentTime
27
+ };
@@ -0,0 +1,139 @@
1
+ const path = require('path');
2
+ const webpack = require('webpack');
3
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
4
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
+ const CopyPlugin = require('copy-webpack-plugin');
6
+ const { currentTime } = require('./utils');
7
+ const TerserPlugin = require('terser-webpack-plugin');
8
+
9
+ const version = JSON.stringify(`${require('../package.json').version} - build on ${currentTime()}`);
10
+ const isProduction = !!(process.env.NODE_ENV === 'production');
11
+
12
+ const getStyleLoader = (...restLoader) => {
13
+ const loaders = [];
14
+
15
+ if (isProduction) {
16
+ loaders.push(MiniCssExtractPlugin.loader);
17
+ } else {
18
+ loaders.push('style-loader');
19
+ }
20
+
21
+ loaders.push('css-loader');
22
+
23
+ restLoader.forEach((item) => {
24
+ loaders.push(item);
25
+ });
26
+
27
+ return loaders;
28
+ };
29
+
30
+ module.exports = {
31
+ entry: './demo/index.tsx',
32
+ output: {
33
+ filename: 'xyrtc.[name].js',
34
+ chunkFilename: 'xyrtc_[name].js',
35
+ path: path.resolve(__dirname, '../build'),
36
+ clean: true
37
+ },
38
+ mode: isProduction ? 'production' : 'development',
39
+ devtool: false,
40
+ resolve: {
41
+ extensions: ['.tsx', '.ts', '.js', '.jsx'],
42
+ alias: {
43
+ '@': path.resolve(__dirname, '../demo'),
44
+ '@xylink/xy-rtc-sdk': path.resolve(__dirname, '../src/index.ts')
45
+ }
46
+ },
47
+ externals: {},
48
+ optimization: {
49
+ moduleIds: 'deterministic',
50
+ runtimeChunk: 'single',
51
+ splitChunks: {
52
+ chunks: 'all',
53
+ cacheGroups: {
54
+ vendor: {
55
+ test: /[\\/]node_modules[\\/]/,
56
+ name: 'vendors',
57
+ chunks: 'all'
58
+ }
59
+ }
60
+ },
61
+ minimize: false,
62
+ minimizer: [
63
+ new TerserPlugin({
64
+ terserOptions: { format: { comments: false } },
65
+ extractComments: false
66
+ })
67
+ ]
68
+ },
69
+ cache: {
70
+ type: 'filesystem',
71
+ buildDependencies: {
72
+ // 更改配置文件时,重新缓存
73
+ config: [__filename]
74
+ }
75
+ },
76
+ module: {
77
+ rules: [
78
+ {
79
+ test: /\.worker\.ts$/,
80
+ loader: 'worker-loader',
81
+ options: { inline: 'no-fallback' }
82
+ },
83
+ {
84
+ test: /\.(ts|tsx|js|jsx)$/,
85
+ loader: 'babel-loader',
86
+ options: {
87
+ cacheDirectory: true
88
+ },
89
+ exclude: /node_modules/
90
+ },
91
+ {
92
+ test: /\.css$/,
93
+ use: getStyleLoader()
94
+ },
95
+ {
96
+ test: /\.(css|scss)$/,
97
+ use: getStyleLoader('postcss-loader', 'sass-loader')
98
+ },
99
+ {
100
+ test: /\.(less)$/,
101
+ use: getStyleLoader({
102
+ loader: 'less-loader',
103
+ options: {
104
+ lessOptions: {
105
+ javascriptEnabled: true,
106
+ modifyVars: {
107
+ '@primary-color': '#3876ff',
108
+ '@success-color': '#32CFA8',
109
+ '@text-color': '#3A3A3A',
110
+ '@primary-5': '#3876ff'
111
+ }
112
+ }
113
+ }
114
+ })
115
+ },
116
+ {
117
+ test: /\.(jpe?g|png|gif|woff|woff2|eot|ttf|otf|ogg|wav)$/,
118
+ type: 'asset/resource',
119
+ generator: {
120
+ filename: 'source/[name].[hash:6][ext]'
121
+ }
122
+ },
123
+ {
124
+ test: /\.svg$/i,
125
+ issuer: /\.[jt]sx?$/,
126
+ use: ['@svgr/webpack']
127
+ }
128
+ ]
129
+ },
130
+ plugins: [
131
+ new HtmlWebpackPlugin({ template: './public/index.html', publicPath: './' }),
132
+ new MiniCssExtractPlugin({ filename: 'css/[name].[hash].css' }),
133
+ new webpack.HotModuleReplacementPlugin({}),
134
+ new webpack.DefinePlugin({
135
+ _BUILDVERSION_: version
136
+ }),
137
+ new CopyPlugin({ patterns: ['public/login.ico'] })
138
+ ]
139
+ };
@@ -0,0 +1,27 @@
1
+ const path = require('path');
2
+ const { merge } = require('webpack-merge');
3
+ const common = require('./webpack.common.js');
4
+
5
+ module.exports = merge(common, {
6
+ devServer: {
7
+ open: true,
8
+ host: 'localhost',
9
+ hot: true,
10
+ port: 8082,
11
+ static: {
12
+ directory: path.join(__dirname, 'public')
13
+ },
14
+ client: {
15
+ reconnect: 5
16
+ },
17
+ historyApiFallback: true
18
+ },
19
+ target: 'web',
20
+ cache: {
21
+ type: 'filesystem',
22
+ buildDependencies: {
23
+ config: [__filename]
24
+ },
25
+ name: 'development-cache'
26
+ }
27
+ });
@@ -0,0 +1,68 @@
1
+ const path = require('path');
2
+ const webpack = require('webpack');
3
+ const { currentTime } = require('./utils');
4
+ const TerserPlugin = require('terser-webpack-plugin');
5
+
6
+ const version = JSON.stringify(`${require('../package.json').version} - build on ${currentTime()}`);
7
+ const isProduction = !!(process.env.NODE_ENV === 'production');
8
+
9
+ module.exports = {
10
+ entry: {
11
+ umd: {
12
+ import: './src/index.ts',
13
+ library: { name: 'xyRTC', type: 'umd' }
14
+ },
15
+ cjs: {
16
+ import: './src/index.ts',
17
+ library: { type: 'commonjs' }
18
+ }
19
+ },
20
+ output: {
21
+ filename: 'xyrtc.[name].js',
22
+ chunkFilename: 'xyrtc_[name].js',
23
+ path: path.resolve(__dirname, '../lib'),
24
+ clean: true
25
+ },
26
+ mode: isProduction ? 'production' : 'development',
27
+ devtool: false,
28
+ resolve: {
29
+ extensions: ['.ts', '.js'],
30
+ alias: {}
31
+ },
32
+ optimization: {
33
+ minimize: true,
34
+ minimizer: [
35
+ new TerserPlugin({
36
+ terserOptions: { format: { comments: false } },
37
+ extractComments: false
38
+ })
39
+ ]
40
+ },
41
+ module: {
42
+ rules: [
43
+ {
44
+ test: /\.worker\.ts$/,
45
+ use: [
46
+ 'babel-loader',
47
+ {
48
+ loader: 'worker-loader',
49
+ options: { inline: 'no-fallback' }
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ test: /\.(ts)$/,
55
+ use: [
56
+ 'babel-loader',
57
+ {
58
+ loader: 'ts-loader',
59
+ options: {
60
+ configFile: 'tsconfig.lib.json'
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ },
67
+ plugins: [new webpack.DefinePlugin({ _BUILDVERSION_: version })]
68
+ };
@@ -0,0 +1,37 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES6",
4
+ "module": "esnext",
5
+ "sourceMap": true,
6
+ "allowSyntheticDefaultImports": true,
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "noImplicitAny": true,
10
+ "experimentalDecorators": true,
11
+ "preserveConstEnums": true,
12
+ "outDir": "lib",
13
+ "declaration": true,
14
+ "allowJs": true,
15
+ "moduleResolution": "node",
16
+ "skipLibCheck": true,
17
+ "useUnknownInCatchVariables": false,
18
+ "jsx": "preserve",
19
+ "lib": [
20
+ "es2015.promise",
21
+ "es5",
22
+ "dom",
23
+ "webworker"
24
+ ],
25
+ "baseUrl": ".",
26
+ "paths": {}
27
+ },
28
+ "exclude": [
29
+ "node_modules",
30
+ "lib",
31
+ "output",
32
+ "build"
33
+ ],
34
+ "include": [
35
+ "src/**/*",
36
+ ]
37
+ }