yootd 0.2.30 → 0.2.32
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.
- package/dist/video-player/index.js +96 -64
- package/package.json +92 -91
@@ -4,6 +4,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
4
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
6
6
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
7
|
+
console.log('process.env', process.env.NODE_ENV);
|
8
|
+
var isDev = process.env.NODE_ENV === 'development';
|
7
9
|
// import * as faceapi from '@vladmandic/face-api';
|
8
10
|
//
|
9
11
|
// import * as posedetection from '@tensorflow-models/pose-detection';
|
@@ -457,13 +459,13 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
457
459
|
male: '男',
|
458
460
|
female: '女'
|
459
461
|
};
|
460
|
-
/* neutral: 'calm',
|
461
|
-
happy: 'happy',
|
462
|
-
sad: 'depressed',
|
463
|
-
angry: 'angry',
|
464
|
-
fearful: 'dread',
|
465
|
-
disgusted: 'detest',
|
466
|
-
surprised: 'surprised',
|
462
|
+
/* neutral: 'calm',
|
463
|
+
happy: 'happy',
|
464
|
+
sad: 'depressed',
|
465
|
+
angry: 'angry',
|
466
|
+
fearful: 'dread',
|
467
|
+
disgusted: 'detest',
|
468
|
+
surprised: 'surprised',
|
467
469
|
*/
|
468
470
|
|
469
471
|
var emotionMap = {
|
@@ -810,7 +812,7 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
810
812
|
useEffect(function () {
|
811
813
|
var loaded = true;
|
812
814
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
813
|
-
var tf, faceapi,
|
815
|
+
var tf, faceapi, poseDetection, detectorConfig, _poseDetector;
|
814
816
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
815
817
|
while (1) switch (_context3.prev = _context3.next) {
|
816
818
|
case 0:
|
@@ -822,100 +824,130 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
822
824
|
case 2:
|
823
825
|
_context3.prev = 2;
|
824
826
|
if (!((aiFeature.anchor || aiFeature.emotion || aiFeature.character || aiFeature.pose) && !tfInitialized)) {
|
825
|
-
_context3.next =
|
827
|
+
_context3.next = 17;
|
826
828
|
break;
|
827
829
|
}
|
828
|
-
|
830
|
+
if (!isDev) {
|
831
|
+
_context3.next = 10;
|
832
|
+
break;
|
833
|
+
}
|
834
|
+
_context3.next = 7;
|
829
835
|
return import('@tensorflow/tfjs');
|
830
|
-
case
|
831
|
-
|
832
|
-
_context3.next = 9;
|
833
|
-
return tf.ready();
|
834
|
-
case 9:
|
836
|
+
case 7:
|
837
|
+
_context3.t0 = _context3.sent;
|
835
838
|
_context3.next = 11;
|
836
|
-
return tf.setBackend('webgl');
|
837
|
-
case 11:
|
838
|
-
setTfInitialized(true);
|
839
|
-
case 12:
|
840
|
-
_context3.next = 17;
|
841
839
|
break;
|
840
|
+
case 10:
|
841
|
+
_context3.t0 = window.tf;
|
842
|
+
case 11:
|
843
|
+
tf = _context3.t0;
|
844
|
+
_context3.next = 14;
|
845
|
+
return tf.setBackend('webgl');
|
842
846
|
case 14:
|
843
|
-
_context3.
|
844
|
-
|
845
|
-
|
847
|
+
_context3.next = 16;
|
848
|
+
return tf.ready();
|
849
|
+
case 16:
|
850
|
+
setTfInitialized(true);
|
846
851
|
case 17:
|
847
|
-
_context3.
|
852
|
+
_context3.next = 22;
|
853
|
+
break;
|
854
|
+
case 19:
|
855
|
+
_context3.prev = 19;
|
856
|
+
_context3.t1 = _context3["catch"](2);
|
857
|
+
console.error('tensorflow 加载失败: ', _context3.t1);
|
858
|
+
case 22:
|
859
|
+
_context3.prev = 22;
|
848
860
|
if (!((aiFeature.anchor || aiFeature.emotion || aiFeature.character) && !faceApiInitialized)) {
|
849
|
-
_context3.next =
|
861
|
+
_context3.next = 45;
|
862
|
+
break;
|
863
|
+
}
|
864
|
+
if (!isDev) {
|
865
|
+
_context3.next = 30;
|
850
866
|
break;
|
851
867
|
}
|
852
|
-
_context3.next =
|
868
|
+
_context3.next = 27;
|
853
869
|
return import('@vladmandic/face-api');
|
854
|
-
case
|
855
|
-
|
856
|
-
_context3.next =
|
870
|
+
case 27:
|
871
|
+
_context3.t2 = _context3.sent;
|
872
|
+
_context3.next = 31;
|
873
|
+
break;
|
874
|
+
case 30:
|
875
|
+
_context3.t2 = window.faceapi;
|
876
|
+
case 31:
|
877
|
+
faceapi = _context3.t2;
|
878
|
+
_context3.next = 34;
|
857
879
|
return faceapi.nets.ssdMobilenetv1.load("".concat(OSS, "/model-zoo/face-api-models/model"));
|
858
|
-
case
|
859
|
-
_context3.next =
|
880
|
+
case 34:
|
881
|
+
_context3.next = 36;
|
860
882
|
return faceapi.nets.ageGenderNet.load("".concat(OSS, "/face-api-models/model"));
|
861
|
-
case
|
862
|
-
_context3.next =
|
883
|
+
case 36:
|
884
|
+
_context3.next = 38;
|
863
885
|
return faceapi.nets.faceLandmark68Net.load("".concat(OSS, "/model-zoo/face-api-models/model"));
|
864
|
-
case
|
865
|
-
_context3.next =
|
886
|
+
case 38:
|
887
|
+
_context3.next = 40;
|
866
888
|
return faceapi.nets.faceRecognitionNet.load("".concat(OSS, "/model-zoo/face-api-models/model"));
|
867
|
-
case
|
868
|
-
_context3.next =
|
889
|
+
case 40:
|
890
|
+
_context3.next = 42;
|
869
891
|
return faceapi.nets.faceExpressionNet.load("".concat(OSS, "/model-zoo/face-api-models/model"));
|
870
|
-
case
|
892
|
+
case 42:
|
871
893
|
setOptions(new faceapi.SsdMobilenetv1Options({
|
872
894
|
minConfidence: MIN_SCORE,
|
873
895
|
maxResults: MAX_RESULTS
|
874
896
|
}));
|
875
897
|
detectAllFacesRef.current = faceapi.detectAllFaces;
|
876
898
|
setFaceApiInitialized(true);
|
877
|
-
case
|
878
|
-
_context3.next =
|
899
|
+
case 45:
|
900
|
+
_context3.next = 50;
|
879
901
|
break;
|
880
|
-
case
|
881
|
-
_context3.prev =
|
882
|
-
_context3.
|
883
|
-
console.error('faceapi 加载失败: ', _context3.
|
884
|
-
case
|
885
|
-
_context3.prev =
|
902
|
+
case 47:
|
903
|
+
_context3.prev = 47;
|
904
|
+
_context3.t3 = _context3["catch"](22);
|
905
|
+
console.error('faceapi 加载失败: ', _context3.t3);
|
906
|
+
case 50:
|
907
|
+
_context3.prev = 50;
|
886
908
|
if (!(aiFeature.pose && poseDetector == null)) {
|
887
|
-
_context3.next =
|
909
|
+
_context3.next = 66;
|
910
|
+
break;
|
911
|
+
}
|
912
|
+
if (!isDev) {
|
913
|
+
_context3.next = 58;
|
888
914
|
break;
|
889
915
|
}
|
890
|
-
_context3.next =
|
916
|
+
_context3.next = 55;
|
891
917
|
return import('@tensorflow-models/pose-detection');
|
892
|
-
case
|
893
|
-
|
918
|
+
case 55:
|
919
|
+
_context3.t4 = _context3.sent;
|
920
|
+
_context3.next = 59;
|
921
|
+
break;
|
922
|
+
case 58:
|
923
|
+
_context3.t4 = window.poseDetection;
|
924
|
+
case 59:
|
925
|
+
poseDetection = _context3.t4;
|
894
926
|
detectorConfig = {
|
895
|
-
modelType:
|
927
|
+
modelType: poseDetection.movenet.modelType.MULTIPOSE_LIGHTNING,
|
896
928
|
enableTracking: true,
|
897
|
-
trackerType:
|
929
|
+
trackerType: poseDetection.TrackerType.BoundingBox,
|
898
930
|
scoreThreshold: 0.3,
|
899
931
|
modelUrl: "".concat(OSS, "/model-zoo/pose-detection-models/model.json")
|
900
932
|
};
|
901
|
-
_context3.next =
|
902
|
-
return
|
903
|
-
case
|
933
|
+
_context3.next = 63;
|
934
|
+
return poseDetection.createDetector(poseDetection.SupportedModels.MoveNet, detectorConfig);
|
935
|
+
case 63:
|
904
936
|
_poseDetector = _context3.sent;
|
905
|
-
getAdjacentPairsRef.current =
|
937
|
+
getAdjacentPairsRef.current = poseDetection.util.getAdjacentPairs;
|
906
938
|
setPoseDetector(_poseDetector);
|
907
|
-
case
|
908
|
-
_context3.next =
|
939
|
+
case 66:
|
940
|
+
_context3.next = 71;
|
909
941
|
break;
|
910
|
-
case
|
911
|
-
_context3.prev =
|
912
|
-
_context3.
|
913
|
-
console.error('pose detection 加载失败: ', _context3.
|
914
|
-
case
|
942
|
+
case 68:
|
943
|
+
_context3.prev = 68;
|
944
|
+
_context3.t5 = _context3["catch"](50);
|
945
|
+
console.error('pose detection 加载失败: ', _context3.t5);
|
946
|
+
case 71:
|
915
947
|
case "end":
|
916
948
|
return _context3.stop();
|
917
949
|
}
|
918
|
-
}, _callee3, null, [[2,
|
950
|
+
}, _callee3, null, [[2, 19], [22, 47], [50, 68]]);
|
919
951
|
}))();
|
920
952
|
return function () {
|
921
953
|
loaded = false;
|
package/package.json
CHANGED
@@ -1,91 +1,92 @@
|
|
1
|
-
{
|
2
|
-
"name": "yootd",
|
3
|
-
"version": "0.2.
|
4
|
-
"description": "基于 Antd 二次开发的组件库",
|
5
|
-
"license": "MIT",
|
6
|
-
"module": "dist/index.js",
|
7
|
-
"types": "dist/index.d.ts",
|
8
|
-
"files": [
|
9
|
-
"dist"
|
10
|
-
],
|
11
|
-
"scripts": {
|
12
|
-
"build": "father build",
|
13
|
-
"build:watch": "father dev",
|
14
|
-
"dev": "dumi dev",
|
15
|
-
"docs:build": "dumi build",
|
16
|
-
"docs:preview": "dumi preview",
|
17
|
-
"doctor": "father doctor",
|
18
|
-
"lint": "npm run lint:es && npm run lint:css",
|
19
|
-
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
20
|
-
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
21
|
-
"prepare": "husky install && dumi setup",
|
22
|
-
"prepublishOnly": "father doctor && npm run build",
|
23
|
-
"start": "npm run dev"
|
24
|
-
},
|
25
|
-
"commitlint": {
|
26
|
-
"extends": [
|
27
|
-
"@commitlint/config-conventional"
|
28
|
-
]
|
29
|
-
},
|
30
|
-
"lint-staged": {
|
31
|
-
"*.{md,json}": [
|
32
|
-
"prettier --write --no-error-on-unmatched-pattern"
|
33
|
-
],
|
34
|
-
"*.{css,less}": [
|
35
|
-
"stylelint --fix",
|
36
|
-
"prettier --write"
|
37
|
-
],
|
38
|
-
"*.{js,jsx}": [
|
39
|
-
"eslint --fix",
|
40
|
-
"prettier --write"
|
41
|
-
],
|
42
|
-
"*.{ts,tsx}": [
|
43
|
-
"eslint --fix",
|
44
|
-
"prettier --parser=typescript --write"
|
45
|
-
]
|
46
|
-
},
|
47
|
-
"dependencies": {
|
48
|
-
"@ant-design/icons": "^6.0.0",
|
49
|
-
"@babel/runtime": "^7.26.9"
|
50
|
-
},
|
51
|
-
"devDependencies": {
|
52
|
-
"@commitlint/cli": "^17.1.2",
|
53
|
-
"@commitlint/config-conventional": "^17.1.0",
|
54
|
-
"@types/lodash": "^4.17.12",
|
55
|
-
"@types/react": "^18.0.0",
|
56
|
-
"@types/react-dom": "^18.0.0",
|
57
|
-
"@umijs/lint": "^4.0.0",
|
58
|
-
"
|
59
|
-
"dumi
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"prettier
|
66
|
-
"prettier-plugin-
|
67
|
-
"
|
68
|
-
"
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
"@dnd-kit/
|
73
|
-
"@dnd-kit/
|
74
|
-
"@dnd-kit/
|
75
|
-
"@
|
76
|
-
"@
|
77
|
-
"@tensorflow/
|
78
|
-
"@
|
79
|
-
"@
|
80
|
-
"
|
81
|
-
"
|
82
|
-
"
|
83
|
-
"
|
84
|
-
"
|
85
|
-
"react
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
1
|
+
{
|
2
|
+
"name": "yootd",
|
3
|
+
"version": "0.2.32",
|
4
|
+
"description": "基于 Antd 二次开发的组件库",
|
5
|
+
"license": "MIT",
|
6
|
+
"module": "dist/index.js",
|
7
|
+
"types": "dist/index.d.ts",
|
8
|
+
"files": [
|
9
|
+
"dist"
|
10
|
+
],
|
11
|
+
"scripts": {
|
12
|
+
"build": "father build",
|
13
|
+
"build:watch": "father dev",
|
14
|
+
"dev": "dumi dev",
|
15
|
+
"docs:build": "dumi build",
|
16
|
+
"docs:preview": "dumi preview",
|
17
|
+
"doctor": "father doctor",
|
18
|
+
"lint": "npm run lint:es && npm run lint:css",
|
19
|
+
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
20
|
+
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
21
|
+
"prepare": "husky install && dumi setup",
|
22
|
+
"prepublishOnly": "father doctor && npm run build",
|
23
|
+
"start": "npm run dev"
|
24
|
+
},
|
25
|
+
"commitlint": {
|
26
|
+
"extends": [
|
27
|
+
"@commitlint/config-conventional"
|
28
|
+
]
|
29
|
+
},
|
30
|
+
"lint-staged": {
|
31
|
+
"*.{md,json}": [
|
32
|
+
"prettier --write --no-error-on-unmatched-pattern"
|
33
|
+
],
|
34
|
+
"*.{css,less}": [
|
35
|
+
"stylelint --fix",
|
36
|
+
"prettier --write"
|
37
|
+
],
|
38
|
+
"*.{js,jsx}": [
|
39
|
+
"eslint --fix",
|
40
|
+
"prettier --write"
|
41
|
+
],
|
42
|
+
"*.{ts,tsx}": [
|
43
|
+
"eslint --fix",
|
44
|
+
"prettier --parser=typescript --write"
|
45
|
+
]
|
46
|
+
},
|
47
|
+
"dependencies": {
|
48
|
+
"@ant-design/icons": "^6.0.0",
|
49
|
+
"@babel/runtime": "^7.26.9"
|
50
|
+
},
|
51
|
+
"devDependencies": {
|
52
|
+
"@commitlint/cli": "^17.1.2",
|
53
|
+
"@commitlint/config-conventional": "^17.1.0",
|
54
|
+
"@types/lodash": "^4.17.12",
|
55
|
+
"@types/react": "^18.0.0",
|
56
|
+
"@types/react-dom": "^18.0.0",
|
57
|
+
"@umijs/lint": "^4.0.0",
|
58
|
+
"cross-env": "^10.0.0",
|
59
|
+
"dumi": "^2.3.0",
|
60
|
+
"dumi-theme-antd": "^0.4.2",
|
61
|
+
"eslint": "^8.23.0",
|
62
|
+
"father": "^4.1.0",
|
63
|
+
"husky": "^8.0.1",
|
64
|
+
"lint-staged": "^13.0.3",
|
65
|
+
"prettier": "^2.7.1",
|
66
|
+
"prettier-plugin-organize-imports": "^3.0.0",
|
67
|
+
"prettier-plugin-packagejson": "^2.2.18",
|
68
|
+
"sass": "^1.80.0",
|
69
|
+
"stylelint": "^14.9.1"
|
70
|
+
},
|
71
|
+
"peerDependencies": {
|
72
|
+
"@dnd-kit/core": ">=6.1.0",
|
73
|
+
"@dnd-kit/modifiers": ">=7.0.0",
|
74
|
+
"@dnd-kit/sortable": ">=8.0.0",
|
75
|
+
"@dnd-kit/utilities": ">=3.2.2",
|
76
|
+
"@tanstack/react-query": ">=5.59.15",
|
77
|
+
"@tensorflow-models/pose-detection": ">=2.1.3",
|
78
|
+
"@tensorflow/tfjs": ">=4.22.0",
|
79
|
+
"@vladmandic/face-api": ">=1.7.14",
|
80
|
+
"@xyflow/react": ">=12.3.3",
|
81
|
+
"antd": ">=5.21.4",
|
82
|
+
"axios": ">=1.7.7",
|
83
|
+
"dayjs": ">=1.11.13",
|
84
|
+
"lodash": ">=4.17.21",
|
85
|
+
"react": ">=18.0.0",
|
86
|
+
"react-dom": ">=18.0.0"
|
87
|
+
},
|
88
|
+
"publishConfig": {
|
89
|
+
"access": "public"
|
90
|
+
},
|
91
|
+
"authors": []
|
92
|
+
}
|