tencentcloud-webar 1.0.23-2 → 1.0.23-21

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.
@@ -1 +1 @@
1
- import"./lib";import"./core";import"./lib-3d";export{ArSdk}from"./index";export{plugin3d}from"./plugin-3d";export{authorize}from"./auth";
1
+ import"./core";import"./lib";export{ArSdk}from"./index";
@@ -1 +1 @@
1
- const a1h=a1b;function a1b(a,b){const c=a1a();return a1b=function(d,e){d=d-0xf4;let f=c[d];return f;},a1b(a,b);}function a1a(){const k=['postMessage','32947083cXEmrB','9937674vdTfoc','1520070gSuugD','1893zeSCMM','2910hNEYoi','onMessage','20560sxpqol','6110566QgUPwo','start','9709408AuWFom','96DtvVmf'];a1a=function(){return k;};return a1a();}(function(a,b){const g=a1b,c=a();while(!![]){try{const d=-parseInt(g(0xfd))/0x1+-parseInt(g(0xff))/0x2*(parseInt(g(0xfe))/0x3)+-parseInt(g(0xf9))/0x4*(-parseInt(g(0xf5))/0x5)+parseInt(g(0xfc))/0x6+-parseInt(g(0xf6))/0x7+-parseInt(g(0xf8))/0x8+parseInt(g(0xfb))/0x9;if(d===b)break;else c['push'](c['shift']());}catch(f){c['push'](c['shift']());}}}(a1a,0xd9855));let e;worker[a1h(0xf4)](a=>{const i=a1h;i(0xf7)===a?e=setInterval(()=>{const j=i;worker[j(0xfa)]({});},0x21):clearInterval(e);});
1
+ let e;worker.onMessage((r=>{"start"===r?e=setInterval((()=>{worker.postMessage({})}),33):clearInterval(e)}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tencentcloud-webar",
3
- "version": "1.0.23-2",
3
+ "version": "1.0.23-21",
4
4
  "description": "",
5
5
  "main": "build-esm/index.js",
6
6
  "devDependencies": {
@@ -61,9 +61,11 @@
61
61
  "build": "npm run install-pixi-dependency && npm run build-esm && npm run build-umd && npm run build-wx",
62
62
  "build-esm:dev": "npx webpack --config ./webpack/esm/webpack.esm.dev.js && node upload.js",
63
63
  "build-esm": "npx webpack --config ./webpack/esm/webpack.prod.js && node upload.js",
64
+ "build-hand:dev": "npx webpack --config ./webpack/esm/hand.dev.js && node upload.js",
64
65
  "build-umd": "npx webpack --config ./webpack/umd/webpack.umd.js",
65
66
  "build-umd:dev": "npx webpack --config ./webpack/umd/webpack.umd.dev.js",
66
67
  "build-wx:dev": "npx webpack --config ./webpack/wx/webpack.wx.dev.js",
68
+ "build-wx-hand:dev": "npx webpack --config ./webpack/wx/hand.wx.dev.js",
67
69
  "build-wx": "npx webpack --config ./webpack/wx/webpack.wx.js",
68
70
  "build-metric": "npx webpack --config ./webpack/metric/webpack.config.js && cd ./packages/metric-solver && npm install && node enc.js",
69
71
  "pack-custom-detect": "node ./packages/wasm/enc.js",
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [English](#documentation) | [简体中文](#文档)
2
2
  # Documentation
3
- The main function of this SDK is to provide you with fast and secure access to [Web AR Face Filters](https://www.tencentcloud.com/document/product/1143/51226), and to use all features.
3
+ The main function of this SDK is to provide you with fast and secure access to [Web AR Face Filters](https://trtc.io/document/50099?platform=web&product=beautyar), and to use all features.
4
4
 
5
5
  ## Process Description
6
6
  The SDK implements a concise and non-invasive interface for access. You only need to initialize the instance and add the rendering node to your page to quickly achieve **Web Beauty Effects** functionality.
@@ -15,20 +15,20 @@ npm install tencentcloud-webar
15
15
 
16
16
  ## SDK Integration
17
17
  We provide two initialization methods: Built-in Camera and Custom Stream.
18
- - [Built-in Camera and Player](https://www.tencentcloud.com/document/product/1143/50101): Utilizes built-in camera and player encapsulation, with simple and rapid invocation.
19
- - [Custom Stream Integration](https://www.tencentcloud.com/document/product/1143/50102): Suitable for scenarios where there is a need to maintain media streams or require higher flexibility and controllability.
18
+ - [Built-in Camera and Player](https://trtc.io/document/50101?platform=web&product=beautyar): Utilizes built-in camera and player encapsulation, with simple and rapid invocation.
19
+ - [Custom Stream Integration](https://trtc.io/document/50102?platform=web&product=beautyar): Suitable for scenarios where there is a need to maintain media streams or require higher flexibility and controllability.
20
20
 
21
21
  ## Setting Beauty and Effects
22
- All materials of the SDK are compatible with both WeChat Mini Program and Web, with consistent calling methods. For details, please refer to [Setting Beauty and Effects](https://www.tencentcloud.com/document/product/1143/54291).
22
+ All materials of the SDK are compatible with both WeChat Mini Program and Web, with consistent calling methods. For details, please refer to [Setting Beauty and Effects](https://trtc.io/document/54291?platform=web&product=beautyar).
23
23
 
24
24
  ## Using Portrait Segmentation (Virtual Background)
25
- Achieve virtual background effects with portrait segmentation capability. For details, please refer to [Using Portrait Segmentation (Virtual Background)](https://www.tencentcloud.com/document/product/1143/50105).
25
+ Achieve virtual background effects with portrait segmentation capability. For details, please refer to [Using Portrait Segmentation (Virtual Background)](https://trtc.io/document/50105?platform=web&product=beautyar).
26
26
 
27
27
  ## Using Animoji and Virtual Avatars
28
- Animoji expressions and VR virtual avatar functions. For details, please refer to [Using Expressions and Virtual Avatars](https://www.tencentcloud.com/document/product/1143/51231).
28
+ Animoji expressions and VR virtual avatar functions. For details, please refer to [Using Expressions and Virtual Avatars](https://trtc.io/document/51231?platform=web&product=beautyar).
29
29
 
30
30
  ## Parameter and Method Description
31
- Refer to the [API Documentation](https://www.tencentcloud.com/document/product/1143/50105).
31
+ Refer to the [API Documentation](https://trtc.io/document/50106?platform=web&product=beautyar).
32
32
 
33
33
  ## Compatibility
34
34
 
@@ -41,10 +41,10 @@ Refer to the [API Documentation](https://www.tencentcloud.com/document/product/1
41
41
  | WeChat webview | Android/iOS WeChat 8.0.16 and above |
42
42
  | WeChat Mini Program | Android/iOS WeChat 8.0.16 and above |
43
43
 
44
- For more platform compatibility information, please refer to [Product Overview - Web](https://www.tencentcloud.com/document/product/1143/53942).
44
+ For more platform compatibility information, please refer to [Product Overview - Web](https://trtc.io/document/60216?platform=web&product=beautyar).
45
45
 
46
46
  ## Code Examples
47
- Please refer to [Quick Start](https://www.tencentcloud.com/document/product/1143/53939).
47
+ Please refer to [Quick Start](https://trtc.io/document/53939?platform=web&product=beautyar).
48
48
 
49
49
 
50
50
  # 文档
@@ -0,0 +1,150 @@
1
+ // const HtmlWebpackPlugin = require('html-webpack-plugin');
2
+
3
+ // const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const workPath = process.cwd()
7
+ const WebpackObfuscator = require("webpack-obfuscator");
8
+ const TerserPlugin = require("terser-webpack-plugin");
9
+
10
+ const buildPath = path.join(workPath, "build-esm");
11
+ const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
12
+ const definePlugin = require('../config')
13
+
14
+ const useCustomDetect = true
15
+ const conditionalCompiler = {
16
+ loader: "js-conditional-compile-loader",
17
+ options: {
18
+ platform_h5: true, // enabled by `npm run build --myflag`
19
+ platform_wx: false, // enabled by `npm run build --myflag`
20
+ '3d_enabled': true, // three.js模式
21
+ pixi_3d_enabled: false, // pixi3d模式
22
+ for_console_debug: true, // 控制台调试
23
+ avatar_enabled: false, // 3D表情
24
+ build_esm: true,
25
+ hand_sdk: true,
26
+ custom_detect: useCustomDetect,
27
+ offical_detect: !useCustomDetect
28
+ },
29
+ };
30
+ const webpack = require("webpack")
31
+
32
+ module.exports = {
33
+ mode: "production",
34
+ experiments: {
35
+ outputModule: true,
36
+ },
37
+ entry: {
38
+ index: "./index.ts"
39
+ },
40
+ output: {
41
+ filename: "[name].js",
42
+ path: buildPath,
43
+ libraryTarget: "module",
44
+ clean: true,
45
+ publicPath: 'https://webar-static.tencent-cloud.com/ar-sdk/resources/dev/',
46
+ chunkFilename: '[name].[hash].js'
47
+
48
+ },
49
+ module: {
50
+ rules: [
51
+ {
52
+ test: /\.worker\.ts$/,
53
+ use: {
54
+ loader: "worker-loader",
55
+ options: {
56
+ filename: "[name].js",
57
+ inline: "no-fallback",
58
+ },
59
+ },
60
+ },
61
+ {
62
+ test: /\.(png|jpg)$/i,
63
+ use: {
64
+ loader: 'url-loader',
65
+ options: {
66
+ limit: 8192,
67
+ },
68
+ },
69
+ exclude: [/node_modules/]
70
+ },
71
+
72
+ {
73
+ test: /\.tsx?$/,
74
+ use: [
75
+ {
76
+ loader: 'thread-loader',
77
+ },
78
+ {
79
+ loader: "ts-loader",
80
+ options: {
81
+ configFile: "tsconfig.esm.json",
82
+ happyPackMode: true
83
+ },
84
+ },
85
+ conditionalCompiler,
86
+ ],
87
+ exclude: [
88
+ /node_modules/,
89
+ path.resolve(workPath, "src/wx")
90
+ ],
91
+ },
92
+ {
93
+ test: /\.js$/,
94
+ use: [
95
+ {
96
+ loader: 'babel-loader',
97
+ options: {
98
+ presets: ['@babel/preset-env']
99
+ }
100
+ },
101
+ conditionalCompiler
102
+ ],
103
+ exclude: [
104
+ /node_modules/,
105
+ path.resolve(workPath, "src/wx"),
106
+ ],
107
+ },
108
+ {
109
+ test: /\.(glsl|vs|fs|vert|frag)$/,
110
+ loader: "ts-shader-loader",
111
+ exclude: [path.resolve(workPath, "src/wx")],
112
+ }
113
+ ],
114
+ },
115
+ resolve: {
116
+ extensions: [".tsx", ".ts", ".js"],
117
+ plugins: [
118
+ new TsconfigPathsPlugin({
119
+ configFile: path.resolve(workPath, "tsconfig.esm.json"),
120
+ }),
121
+ ],
122
+ },
123
+ plugins: [
124
+ definePlugin
125
+ ],
126
+ optimization: {
127
+ usedExports: true,
128
+ splitChunks: {
129
+ // chunks: 'all',
130
+ cacheGroups: {
131
+ three: {
132
+ test: /[\\/]three[\\/]/,
133
+ name: 'lib-3d',
134
+ chunks: 'all'
135
+ },
136
+ // packages: {
137
+ // test:/[\\/]packages[\\/]/,
138
+ // name: 'lib',
139
+ // chunks: 'all'
140
+ // }
141
+ }
142
+ },
143
+ minimize: false,
144
+ minimizer: [
145
+ new TerserPlugin({
146
+ extractComments: false,
147
+ }),
148
+ ],
149
+ },
150
+ };
@@ -0,0 +1,165 @@
1
+ // const HtmlWebpackPlugin = require('html-webpack-plugin');
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const version = parseInt(Math.random() * 100000000).toString();
7
+ const TerserPlugin = require("terser-webpack-plugin");
8
+ const webpack = require("webpack");
9
+ const workPath = process.cwd();
10
+
11
+ const buildPath = path.join(
12
+ workPath,
13
+ "miniprogram_dist"
14
+ // "miniprogram/miniprogram/pages/index"
15
+ );
16
+ const CopyPlugin = require("copy-webpack-plugin");
17
+ const conditionalCompiler = {
18
+ loader: "js-conditional-compile-loader",
19
+ options: {
20
+ platform_wx: true,
21
+ platform_h5: false,
22
+ '3d_enabled': true, // three.js模式
23
+ hand_sdk: true,
24
+ face_sdk: false,
25
+ },
26
+ };
27
+
28
+ const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
29
+ const definePlugin = require("../config");
30
+
31
+ //
32
+ class WxPrefixPlugin {
33
+ apply(compiler) {
34
+ compiler.hooks.emit.tapAsync("WxPrefixPlugin", (compilation, callback) => {
35
+ // console.log('compilation',compilation)
36
+ compilation.chunks.forEach((chunk) => {
37
+ chunk.files.forEach((filename) => {
38
+ // console.log(compilation.assets[filename].source())
39
+ // worker不处理
40
+ if (filename.indexOf("worker") === -1) {
41
+ let newContent =
42
+ `var self = wx;` + compilation.assets[filename].source();
43
+ compilation.assets[filename] = {
44
+ source: () => {
45
+ return newContent;
46
+ },
47
+ size: () => {
48
+ return Buffer.byteLength(newContent, "utf8");
49
+ },
50
+ };
51
+ }
52
+ });
53
+ });
54
+ callback();
55
+ });
56
+ }
57
+ }
58
+
59
+ module.exports = {
60
+ mode: "production",
61
+ // mode: "production",
62
+ experiments: {
63
+ outputModule: true,
64
+ },
65
+ entry: {
66
+ hand: "./src/wx/hand.js",
67
+ "worker/tick.worker": "./src/wx/worker/tick.worker.js",
68
+ "plugin-3d": "./src/plugins/stickers-3d/index.ts",
69
+ },
70
+ output: {
71
+ filename: "[name].js",
72
+ path: buildPath,
73
+ libraryTarget: "module",
74
+ },
75
+ module: {
76
+ rules: [
77
+ {
78
+ test: /\.js$/,
79
+ use: [conditionalCompiler],
80
+ exclude: [
81
+ /node_modules/,
82
+ path.resolve(workPath, "miniprogram"),
83
+ path.resolve(workPath, "src/h5/"),
84
+ ],
85
+ },
86
+ {
87
+ test: /\.tsx?$/,
88
+ use: [
89
+ {
90
+ loader: "thread-loader",
91
+ },
92
+ {
93
+ loader: "ts-loader",
94
+ options: {
95
+ configFile: "tsconfig.esm.json",
96
+ happyPackMode: true,
97
+ },
98
+ },
99
+ conditionalCompiler,
100
+ ],
101
+ exclude: [
102
+ /node_modules/,
103
+ path.resolve(workPath, "miniprogram"),
104
+ path.resolve(workPath, "src/h5/"),
105
+ ],
106
+ },
107
+ {
108
+ test: /\.(glsl|vs|fs|vert|frag)$/,
109
+ loader: "ts-shader-loader",
110
+ exclude: [path.resolve(workPath, "src/wx")],
111
+ },
112
+ ],
113
+ },
114
+ resolve: {
115
+ extensions: [".tsx", ".ts", ".js"],
116
+ plugins: [
117
+ new TsconfigPathsPlugin({
118
+ configFile: path.resolve(workPath, "tsconfig.json"),
119
+ }),
120
+ ],
121
+ },
122
+ plugins: [
123
+ definePlugin,
124
+ new WxPrefixPlugin(),
125
+ new CopyPlugin({
126
+ patterns: [
127
+ {
128
+ from: path.resolve(workPath, "src/wx/webar.js"),
129
+ to: path.resolve(workPath, "miniprogram_dist/webar.js"),
130
+ },
131
+ ],
132
+ }),
133
+ ],
134
+ optimization: {
135
+ usedExports: true,
136
+ sideEffects: true,
137
+ providedExports: true,
138
+ splitChunks: {
139
+ cacheGroups: {
140
+ // pixi: {
141
+ // test: /[\\/]pixi[\\/]/,
142
+ // name: "lib",
143
+ // chunks: "all",
144
+ // },
145
+
146
+ // three: {
147
+ // test: /[\\/]three[\\/]/,
148
+ // name: "three",
149
+ // chunks: "all",
150
+ // },
151
+ },
152
+ },
153
+ minimize: true,
154
+ minimizer: [
155
+ new TerserPlugin({
156
+ extractComments: false,
157
+ terserOptions: {
158
+ format: {
159
+ comments: false,
160
+ },
161
+ },
162
+ }),
163
+ ],
164
+ },
165
+ };