yootd 0.0.86 → 0.0.87-test

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.
@@ -0,0 +1,1197 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
5
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
6
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
7
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ import * as faceapi from '@vladmandic/face-api';
18
+ import * as posedetection from '@tensorflow-models/pose-detection';
19
+ import * as tf from '@tensorflow/tfjs';
20
+ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
21
+ import { EndPoint } from 'yootd-webrtc-sdk';
22
+ import { useBem } from "../hooks/useBem";
23
+ import "./index.scss";
24
+ import { throttle } from 'lodash';
25
+ import { message, Spin } from "./..";
26
+ import { useOSS } from "../hooks/useOSS";
27
+ import controlBottomBg from "./assets/control-background.png";
28
+ var PROGRESS_BAR_HEIGHT = 63;
29
+ var MIN_SCORE = 0.5; // minimum score
30
+ var MAX_RESULTS = 20; // maximum number of results to return
31
+
32
+ // print hello world
33
+
34
+ var speeds = ['2.0', '1.75', '1.5', '1.25', '1.0', '0.75', '0.5'];
35
+ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
36
+ var src = _ref.src,
37
+ isLive = _ref.isLive,
38
+ controls = _ref.controls,
39
+ autoPlay = _ref.autoPlay,
40
+ muted = _ref.muted,
41
+ style = _ref.style,
42
+ _ref$retry = _ref.retry,
43
+ retry = _ref$retry === void 0 ? false : _ref$retry,
44
+ _ref$retryInterval = _ref.retryInterval,
45
+ retryInterval = _ref$retryInterval === void 0 ? 5000 : _ref$retryInterval,
46
+ className = _ref.className,
47
+ _ref$audioEnable = _ref.audioEnable,
48
+ audioEnable = _ref$audioEnable === void 0 ? true : _ref$audioEnable,
49
+ _ref$videoEnable = _ref.videoEnable,
50
+ videoEnable = _ref$videoEnable === void 0 ? true : _ref$videoEnable,
51
+ _ref$rotateWhenFullSc = _ref.rotateWhenFullScreen,
52
+ rotateWhenFullScreen = _ref$rotateWhenFullSc === void 0 ? false : _ref$rotateWhenFullSc,
53
+ _ref$miniProgram = _ref.miniProgram,
54
+ miniProgram = _ref$miniProgram === void 0 ? false : _ref$miniProgram,
55
+ _ref$showCapture = _ref.showCapture,
56
+ showCapture = _ref$showCapture === void 0 ? true : _ref$showCapture,
57
+ onPlayStateChange = _ref.onPlayStateChange,
58
+ onCapture = _ref.onCapture,
59
+ onCurrentTimeChange = _ref.onCurrentTimeChange,
60
+ onError = _ref.onError;
61
+ var containerRef = useRef(null);
62
+ var videoRef = useRef(null);
63
+ var canvasRef = useRef(null);
64
+ var poseCanvasRef = useRef(null);
65
+ var _useState = useState(null),
66
+ _useState2 = _slicedToArray(_useState, 2),
67
+ poseDetector = _useState2[0],
68
+ setPoseDetector = _useState2[1];
69
+ var OSS = useOSS();
70
+ var bem = useBem('video-player');
71
+ var _useState3 = useState(true),
72
+ _useState4 = _slicedToArray(_useState3, 1),
73
+ show = _useState4[0];
74
+ var _useState5 = useState(false),
75
+ _useState6 = _slicedToArray(_useState5, 2),
76
+ isFullScreen = _useState6[0],
77
+ setIsFullScreen = _useState6[1];
78
+ var _useState7 = useState(false),
79
+ _useState8 = _slicedToArray(_useState7, 2),
80
+ isPlaying = _useState8[0],
81
+ setIsPlaying = _useState8[1];
82
+ var _useState9 = useState(0),
83
+ _useState10 = _slicedToArray(_useState9, 2),
84
+ volume = _useState10[0],
85
+ setVolume = _useState10[1];
86
+ var _useState11 = useState(false),
87
+ _useState12 = _slicedToArray(_useState11, 2),
88
+ hasAudio = _useState12[0],
89
+ setHasAudio = _useState12[1];
90
+ var _useState13 = useState(0),
91
+ _useState14 = _slicedToArray(_useState13, 2),
92
+ currentTime = _useState14[0],
93
+ setCurrentTime = _useState14[1];
94
+ var _useState15 = useState(),
95
+ _useState16 = _slicedToArray(_useState15, 2),
96
+ duration = _useState16[0],
97
+ setDuration = _useState16[1];
98
+ var _useState17 = useState(false),
99
+ _useState18 = _slicedToArray(_useState17, 2),
100
+ showSpeedPicker = _useState18[0],
101
+ setShowSpeedPicker = _useState18[1];
102
+ var _useState19 = useState('1.0'),
103
+ _useState20 = _slicedToArray(_useState19, 2),
104
+ speed = _useState20[0],
105
+ setSpeed = _useState20[1];
106
+ var _useState21 = useState(false),
107
+ _useState22 = _slicedToArray(_useState21, 2),
108
+ showVolumeSlider = _useState22[0],
109
+ setShowVolumeSlider = _useState22[1];
110
+ var _useState23 = useState(false),
111
+ _useState24 = _slicedToArray(_useState23, 2),
112
+ mouseDown = _useState24[0],
113
+ setMouseDown = _useState24[1];
114
+ var _useState25 = useState(0),
115
+ _useState26 = _slicedToArray(_useState25, 2),
116
+ buffered = _useState26[0],
117
+ setBuffered = _useState26[1];
118
+ var _useState27 = useState(false),
119
+ _useState28 = _slicedToArray(_useState27, 2),
120
+ showSettingPanel = _useState28[0],
121
+ setShowSettingPanel = _useState28[1];
122
+ var _useState29 = useState({
123
+ emotion: false,
124
+ character: false,
125
+ anchor: false,
126
+ pose: false
127
+ }),
128
+ _useState30 = _slicedToArray(_useState29, 2),
129
+ aiFeature = _useState30[0],
130
+ setAIFeature = _useState30[1];
131
+ var _useState31 = useState(null),
132
+ _useState32 = _slicedToArray(_useState31, 2),
133
+ options = _useState32[0],
134
+ setOptions = _useState32[1];
135
+ var _useState33 = useState(false),
136
+ _useState34 = _slicedToArray(_useState33, 2),
137
+ faceApiInited = _useState34[0],
138
+ setFaceApiInited = _useState34[1];
139
+ var _useState35 = useState({
140
+ width: 0,
141
+ height: 0
142
+ }),
143
+ _useState36 = _slicedToArray(_useState35, 2),
144
+ canvasSize = _useState36[0],
145
+ setCanvasSize = _useState36[1];
146
+ var _useState37 = useState({
147
+ width: 0,
148
+ height: 0
149
+ }),
150
+ _useState38 = _slicedToArray(_useState37, 2),
151
+ videoEleSize = _useState38[0],
152
+ setVideoEleSize = _useState38[1];
153
+ var _useState39 = useState(false),
154
+ _useState40 = _slicedToArray(_useState39, 2),
155
+ isSeeking = _useState40[0],
156
+ setIsSeeking = _useState40[1];
157
+ var _useState41 = useState(false),
158
+ _useState42 = _slicedToArray(_useState41, 2),
159
+ isError = _useState42[0],
160
+ setIsError = _useState42[1];
161
+ var _useState43 = useState(),
162
+ _useState44 = _slicedToArray(_useState43, 2),
163
+ features = _useState44[0],
164
+ setFeatures = _useState44[1];
165
+ useImperativeHandle(ref, function () {
166
+ return {
167
+ play: function play() {
168
+ var _videoRef$current;
169
+ void ((_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 ? void 0 : _videoRef$current.play());
170
+ },
171
+ pause: function pause() {
172
+ var _videoRef$current2;
173
+ (_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 || _videoRef$current2.pause();
174
+ },
175
+ // 设置播放时间
176
+ setVideoCurrentTime: function setVideoCurrentTime(time) {
177
+ // 判断是否为数字
178
+ if (typeof time !== 'number' || isNaN(time)) {
179
+ return;
180
+ }
181
+ if (videoRef.current) {
182
+ videoRef.current.currentTime = time;
183
+ }
184
+ },
185
+ // 使用启用面部表情/角色/锚点/姿态
186
+ useFaceExpression: function useFaceExpression(type, use) {
187
+ setAIFeature(function () {
188
+ return _defineProperty({
189
+ emotion: false,
190
+ character: false,
191
+ anchor: false,
192
+ pose: false
193
+ }, type, use);
194
+ });
195
+ },
196
+ currentTime: function (_currentTime) {
197
+ function currentTime() {
198
+ return _currentTime.apply(this, arguments);
199
+ }
200
+ currentTime.toString = function () {
201
+ return _currentTime.toString();
202
+ };
203
+ return currentTime;
204
+ }(function () {
205
+ return currentTime;
206
+ })
207
+ };
208
+ });
209
+ var handleFullScreen = function handleFullScreen() {
210
+ if (containerRef.current != null) {
211
+ void containerRef.current.requestFullscreen();
212
+ }
213
+ };
214
+ var handleExitFullScreen = function handleExitFullScreen() {
215
+ if (document.exitFullscreen) {
216
+ void document.exitFullscreen();
217
+ }
218
+ };
219
+ var handleCanPlay = function handleCanPlay(e) {
220
+ var video = e.target;
221
+ try {
222
+ var _video$audioTracks;
223
+ setHasAudio(
224
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
225
+ // @ts-ignore
226
+ video.mozHasAudio ||
227
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
228
+ // @ts-ignore
229
+ Boolean(video.webkitAudioDecodedByteCount) ||
230
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
231
+ // @ts-ignore
232
+ Boolean((_video$audioTracks = video.audioTracks) === null || _video$audioTracks === void 0 ? void 0 : _video$audioTracks.length));
233
+ // console.log(
234
+ // '是否包含音频: ',
235
+ // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
236
+ // // @ts-expect-error
237
+ // video.mozHasAudio ||
238
+ // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
239
+ // // @ts-expect-error
240
+ // Boolean(video.webkitAudioDecodedByteCount) ||
241
+ // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
242
+ // // @ts-expect-error
243
+ // Boolean(video.audioTracks?.length),
244
+ // );
245
+ } catch (e) {
246
+ console.log(e);
247
+ }
248
+ };
249
+ var handlePlayAndStop = function handlePlayAndStop() {
250
+ try {
251
+ if (isPlaying) {
252
+ var _videoRef$current3;
253
+ (_videoRef$current3 = videoRef.current) === null || _videoRef$current3 === void 0 || _videoRef$current3.pause();
254
+ } else {
255
+ var _videoRef$current4;
256
+ void ((_videoRef$current4 = videoRef.current) === null || _videoRef$current4 === void 0 ? void 0 : _videoRef$current4.play());
257
+ }
258
+ } catch (e) {
259
+ console.log(e);
260
+ }
261
+ };
262
+ var handleOnTimeUpdate = function handleOnTimeUpdate(e) {
263
+ var _ele$currentTime, _ele$currentTime2;
264
+ if (isLive) {
265
+ return;
266
+ }
267
+ var ele = e.target;
268
+ setCurrentTime((_ele$currentTime = ele.currentTime) !== null && _ele$currentTime !== void 0 ? _ele$currentTime : 0);
269
+ onCurrentTimeChange === null || onCurrentTimeChange === void 0 || onCurrentTimeChange((_ele$currentTime2 = ele.currentTime) !== null && _ele$currentTime2 !== void 0 ? _ele$currentTime2 : 0);
270
+ if (ele.buffered != null) {
271
+ try {
272
+ setBuffered(ele.buffered.end(0));
273
+ } catch (e) {
274
+ console.log(e);
275
+ }
276
+ }
277
+ };
278
+ var handleOnLoadMetadata = function handleOnLoadMetadata() {
279
+ if (videoRef.current == null) {
280
+ return;
281
+ }
282
+ setVideoEleSize({
283
+ width: videoRef.current.videoWidth,
284
+ height: videoRef.current.videoHeight
285
+ });
286
+ if (!isLive) {
287
+ console.log('videoRef.current.duration', videoRef.current.duration);
288
+ setDuration(videoRef.current.duration);
289
+ }
290
+ };
291
+
292
+ // convert video duration (seconds) to hh::mm:ss if the duration is larger than 3600 , else convert to mm:ss
293
+ var formatDuration = function formatDuration(duration) {
294
+ console.log('duration 111111111', duration);
295
+ var hours = Math.floor(duration / 3600);
296
+ var minutes = Math.floor(duration % 3600 / 60);
297
+ var seconds = Math.floor(duration % 60);
298
+ return duration > 3600 ? "".concat(hours.toString().padStart(2, '0'), ":").concat(minutes.toString().padStart(2, '0'), ":").concat(seconds.toString().padStart(2, '0')) : "".concat(minutes.toString().padStart(2, '0'), ":").concat(seconds.toString().padStart(2, '0'));
299
+ };
300
+ var handleOnSpeedSelect = function handleOnSpeedSelect(speed) {
301
+ setSpeed(speed);
302
+ setShowSpeedPicker(false);
303
+ if (videoRef.current != null) {
304
+ videoRef.current.playbackRate = Number(speed);
305
+ }
306
+ };
307
+ var handleShowSpeedPicker = function handleShowSpeedPicker() {
308
+ setShowSpeedPicker(true);
309
+ };
310
+ var handleShowVolumeSlider = function handleShowVolumeSlider() {
311
+ if (hasAudio) {
312
+ setShowVolumeSlider(true);
313
+ }
314
+ };
315
+ var handleHideVolumeSlider = function handleHideVolumeSlider() {
316
+ setShowVolumeSlider(false);
317
+ setMouseDown(false);
318
+ };
319
+ var handleOnMouseMove = function handleOnMouseMove(e) {
320
+ var _e$currentTarget;
321
+ if (!mouseDown) {
322
+ return;
323
+ }
324
+ var progress = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.querySelector('.progress-bar');
325
+ if (progress != null) {
326
+ var rect = progress.getBoundingClientRect();
327
+ var _volume = (rect.bottom - e.clientY) / PROGRESS_BAR_HEIGHT * 100;
328
+ if (_volume > 100) {
329
+ _volume = 100;
330
+ } else if (_volume < 0) {
331
+ _volume = 0;
332
+ }
333
+ setVolume(_volume);
334
+ if (videoRef.current != null) {
335
+ videoRef.current.muted = false;
336
+ videoRef.current.volume = Math.floor(volume) / 100;
337
+ }
338
+ }
339
+ };
340
+ var handleOnMouseDown = function handleOnMouseDown() {
341
+ setMouseDown(true);
342
+ };
343
+ var handleSetCurrentTime = function handleSetCurrentTime(e) {
344
+ if (duration == null) {
345
+ return;
346
+ }
347
+ var ele = e.currentTarget;
348
+ var rect = ele.getBoundingClientRect();
349
+ var currentTime = (e.clientX - rect.x) / rect.width * duration;
350
+ if (videoRef.current != null) {
351
+ videoRef.current.currentTime = currentTime;
352
+ }
353
+ };
354
+ var handleShowSettingPanel = function handleShowSettingPanel(e) {
355
+ e.stopPropagation();
356
+ setShowSettingPanel(function (prev) {
357
+ return !prev;
358
+ });
359
+ };
360
+ var initFaceApi = useCallback(function () {
361
+ void _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
362
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
363
+ while (1) switch (_context.prev = _context.next) {
364
+ case 0:
365
+ _context.prev = 0;
366
+ _context.next = 3;
367
+ return faceapi.nets.ssdMobilenetv1.load("".concat(OSS, "/model-zoo/face-api-models/model"));
368
+ case 3:
369
+ _context.next = 5;
370
+ return faceapi.nets.ssdMobilenetv1.load("".concat(OSS, "/model-zoo/face-api-models/model"));
371
+ case 5:
372
+ _context.next = 7;
373
+ return faceapi.nets.ageGenderNet.load("".concat(OSS, "/face-api-models/model"));
374
+ case 7:
375
+ _context.next = 9;
376
+ return faceapi.nets.faceLandmark68Net.load("".concat(OSS, "/model-zoo/face-api-models/model"));
377
+ case 9:
378
+ _context.next = 11;
379
+ return faceapi.nets.faceRecognitionNet.load("".concat(OSS, "/model-zoo/face-api-models/model"));
380
+ case 11:
381
+ _context.next = 13;
382
+ return faceapi.nets.faceExpressionNet.load("".concat(OSS, "/model-zoo/face-api-models/model"));
383
+ case 13:
384
+ setOptions(new faceapi.SsdMobilenetv1Options({
385
+ minConfidence: MIN_SCORE,
386
+ maxResults: MAX_RESULTS
387
+ }));
388
+ setFaceApiInited(true);
389
+ _context.next = 20;
390
+ break;
391
+ case 17:
392
+ _context.prev = 17;
393
+ _context.t0 = _context["catch"](0);
394
+ console.log(_context.t0);
395
+ case 20:
396
+ case "end":
397
+ return _context.stop();
398
+ }
399
+ }, _callee, null, [[0, 17]]);
400
+ }))();
401
+ }, []);
402
+ var initPoseDetecter = useCallback(function () {
403
+ _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
404
+ var detectorConfig, _poseDetector;
405
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
406
+ while (1) switch (_context2.prev = _context2.next) {
407
+ case 0:
408
+ _context2.prev = 0;
409
+ detectorConfig = {
410
+ modelType: posedetection.movenet.modelType.MULTIPOSE_LIGHTNING,
411
+ enableTracking: true,
412
+ trackerType: posedetection.TrackerType.BoundingBox,
413
+ scoreThreshold: 0.3,
414
+ modelUrl: "".concat(OSS, "/model-zoo/pose-detection-models/model.json")
415
+ };
416
+ _context2.next = 4;
417
+ return posedetection.createDetector(posedetection.SupportedModels.MoveNet, detectorConfig);
418
+ case 4:
419
+ _poseDetector = _context2.sent;
420
+ setPoseDetector(_poseDetector);
421
+ _context2.next = 11;
422
+ break;
423
+ case 8:
424
+ _context2.prev = 8;
425
+ _context2.t0 = _context2["catch"](0);
426
+ void message.error('初始化姿态检测器失败');
427
+ case 11:
428
+ case "end":
429
+ return _context2.stop();
430
+ }
431
+ }, _callee2, null, [[0, 8]]);
432
+ }))();
433
+ }, []);
434
+ var drawFaces = useCallback(function (canvas, detections, fps, faceFeature) {
435
+ var ctx = canvas.getContext('2d', {
436
+ willReadFrequently: true
437
+ });
438
+ if (!ctx) {
439
+ return;
440
+ }
441
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
442
+ ctx.fillStyle = 'white';
443
+ ctx.font = 'small-caps 20px "Segoe UI"';
444
+ ctx.fillText("FPS: ".concat(fps), 10, 25);
445
+ var _iterator = _createForOfIteratorHelper(detections),
446
+ _step;
447
+ try {
448
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
449
+ var person = _step.value;
450
+ // draw box around each face
451
+ ctx.lineWidth = 3;
452
+ ctx.strokeStyle = '#7aff00';
453
+ ctx.fillStyle = '#7aff00';
454
+ ctx.globalAlpha = 0.6;
455
+ ctx.beginPath();
456
+ ctx.rect(person.detection.box.x, person.detection.box.y, person.detection.box.width, person.detection.box.height);
457
+ ctx.stroke();
458
+ ctx.globalAlpha = 1;
459
+ // draw text labels
460
+ var expression = Object.entries(person.expressions).sort(function (a, b) {
461
+ return b[1] - a[1];
462
+ });
463
+ ctx.fillStyle = 'black';
464
+ // if (faceFeature.character) {
465
+ // ctx.fillText(
466
+ // `性别: ${Math.round(100 * person.genderProbability)}% ${
467
+ // person.gender
468
+ // }`,
469
+ // person.detection.box.x,
470
+ // person.detection.box.y - 59
471
+ // );
472
+ // ctx.fillText(
473
+ // `age: ${Math.round(person.age)} years`,
474
+ // person.detection.box.x,
475
+ // person.detection.box.y - 23
476
+ // );
477
+ // }
478
+ // if (faceFeature.emotion) {
479
+ // ctx.fillText(
480
+ // `expression: ${Math.round(100 * expression[0][1])}% ${
481
+ // expression[0][0]
482
+ // }`,
483
+ // person.detection.box.x,
484
+ // person.detection.box.y - 41
485
+ // );
486
+ // }
487
+ // ctx.fillText(
488
+ // `roll:${person.angle.roll}° pitch:${person.angle.pitch}° yaw:${person.angle.yaw}°`,
489
+ // person.detection.box.x,
490
+ // person.detection.box.y - 5
491
+ // );
492
+ var genderMap = {
493
+ male: '男',
494
+ female: '女'
495
+ };
496
+ var emotionMap = {
497
+ neutral: '平静',
498
+ happy: '开心',
499
+ sad: '伤心',
500
+ angry: '愤怒',
501
+ fearful: '恐惧',
502
+ disgusted: '厌恶',
503
+ surprised: '惊讶'
504
+ };
505
+ ctx.fillStyle = '#7aff00';
506
+ if (faceFeature.character) {
507
+ var _genderMap$person$gen;
508
+ ctx.fillText("\u6027\u522B: ".concat(Math.round(100 * person.genderProbability), "% ").concat((_genderMap$person$gen = genderMap[person.gender]) !== null && _genderMap$person$gen !== void 0 ? _genderMap$person$gen : ''), person.detection.box.x, person.detection.box.y - 65);
509
+ ctx.fillText("\u5E74\u9F84: ".concat(Math.round(person.age), " \u5C81"), person.detection.box.x,
510
+ // person.detection.box.y - 20
511
+ person.detection.box.y - 42);
512
+ }
513
+ if (faceFeature.emotion) {
514
+ var _emotionMap;
515
+ ctx.fillText("\u8868\u60C5: ".concat(Math.round(100 * expression[0][1]), "% ").concat( // eslint-disable-next-line @typescript-eslint/ban-ts-comment
516
+ // @ts-expect-error
517
+ (_emotionMap = emotionMap[expression[0][0]]) !== null && _emotionMap !== void 0 ? _emotionMap : ''), person.detection.box.x, person.detection.box.y - 20
518
+ // person.detection.box.y - 42
519
+ );
520
+ }
521
+ // ctx.fillText(
522
+ // `roll:${person.angle.roll}° pitch:${person.angle.pitch}° yaw:${person.angle.yaw}°`,
523
+ // person.detection.box.x,
524
+ // person.detection.box.y - 6
525
+ // );
526
+ // draw face points for each face
527
+ ctx.globalAlpha = 0.8;
528
+ ctx.fillStyle = '#7aff00';
529
+ var pointSize = 2;
530
+ if (faceFeature.anchor) {
531
+ for (var i = 0; i < person.landmarks.positions.length; i++) {
532
+ ctx.beginPath();
533
+ ctx.arc(person.landmarks.positions[i].x, person.landmarks.positions[i].y, pointSize, 0, 2 * Math.PI);
534
+ ctx.fill();
535
+ }
536
+ }
537
+ }
538
+ } catch (err) {
539
+ _iterator.e(err);
540
+ } finally {
541
+ _iterator.f();
542
+ }
543
+ }, []);
544
+ var detectFaces = useCallback(function () {
545
+ return new Promise(function (resolve, reject) {
546
+ if (videoRef.current != null && options != null && faceApiInited) {
547
+ var t0 = performance.now();
548
+ faceapi.detectAllFaces(videoRef.current, options).withFaceLandmarks().withFaceExpressions().withAgeAndGender()
549
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
550
+ // @ts-ignore
551
+ .then(function (detections) {
552
+ if (canvasRef.current != null) {
553
+ var fps = 1000 / (performance.now() - t0);
554
+ drawFaces(canvasRef.current, detections, fps.toLocaleString(), aiFeature);
555
+ resolve(true);
556
+ } else {
557
+ reject(false);
558
+ }
559
+ }).catch(function (e) {
560
+ reject(e);
561
+ });
562
+ }
563
+ });
564
+
565
+ // 肢体检测
566
+ }, [drawFaces, faceApiInited, aiFeature, options]);
567
+ var drawKeyPoints = function drawKeyPoints(keypoints, ctx) {
568
+ keypoints.forEach(function (keypoint) {
569
+ if (keypoint.score && keypoint.score > 0.3) {
570
+ ctx.beginPath();
571
+ ctx.arc(keypoint.x, keypoint.y, 5, 0, 2 * Math.PI);
572
+ ctx.fillStyle = 'red';
573
+ ctx.fill();
574
+
575
+ // 添加关键点标签,帮助调试
576
+ ctx.fillStyle = 'white';
577
+ ctx.fillText("".concat(Math.round(keypoint.score * 100), "%"), keypoint.x + 5, keypoint.y - 5);
578
+ }
579
+ });
580
+ };
581
+
582
+ // 绘制骨架
583
+ var drawSkeleton = function drawSkeleton(keypoints, ctx) {
584
+ var adjacentPairs = posedetection.util.getAdjacentPairs(posedetection.SupportedModels.MoveNet);
585
+ adjacentPairs.forEach(function (_ref5) {
586
+ var _ref6 = _slicedToArray(_ref5, 2),
587
+ i = _ref6[0],
588
+ j = _ref6[1];
589
+ var kp1 = keypoints[i];
590
+ var kp2 = keypoints[j];
591
+ if (kp1.score && kp2.score && kp1.score > 0.3 && kp2.score > 0.3) {
592
+ ctx.beginPath();
593
+ ctx.moveTo(kp1.x, kp1.y);
594
+ ctx.lineTo(kp2.x, kp2.y);
595
+ ctx.strokeStyle = 'blue';
596
+ ctx.lineWidth = 2;
597
+ ctx.stroke();
598
+ }
599
+ });
600
+ };
601
+ var drawPose = useCallback(function (canvas, pose) {
602
+ var ctx = canvas.getContext('2d');
603
+ if (ctx == null) {
604
+ return;
605
+ }
606
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
607
+ pose.forEach(function (p) {
608
+ drawKeyPoints(p.keypoints, ctx);
609
+ drawSkeleton(p.keypoints, ctx);
610
+ });
611
+ }, []);
612
+ var detectPose = useCallback(function () {
613
+ if (poseDetector == null || videoRef.current == null || poseCanvasRef.current == null) {
614
+ return;
615
+ }
616
+ var video = videoRef.current;
617
+ var canvas = poseCanvasRef.current;
618
+ var detect = /*#__PURE__*/function () {
619
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
620
+ var pose;
621
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
622
+ while (1) switch (_context3.prev = _context3.next) {
623
+ case 0:
624
+ _context3.prev = 0;
625
+ _context3.next = 3;
626
+ return poseDetector.estimatePoses(video, {
627
+ flipHorizontal: false,
628
+ maxPoses: 1
629
+ });
630
+ case 3:
631
+ pose = _context3.sent;
632
+ drawPose(canvas, pose);
633
+ _context3.next = 10;
634
+ break;
635
+ case 7:
636
+ _context3.prev = 7;
637
+ _context3.t0 = _context3["catch"](0);
638
+ console.error('检测肢体失败', _context3.t0);
639
+ case 10:
640
+ case "end":
641
+ return _context3.stop();
642
+ }
643
+ }, _callee3, null, [[0, 7]]);
644
+ }));
645
+ return function detect() {
646
+ return _ref7.apply(this, arguments);
647
+ };
648
+ }();
649
+ detect();
650
+ }, [poseDetector]);
651
+ var handleCapture = function handleCapture() {
652
+ if (videoRef.current != null) {
653
+ var _canvas$getContext;
654
+ // 检查 video 是否加载完成
655
+ if (videoRef.current.readyState !== 4) {
656
+ return;
657
+ }
658
+ var canvas = document.createElement('canvas');
659
+ canvas.width = videoRef.current.videoWidth;
660
+ canvas.height = videoRef.current.videoHeight;
661
+ (_canvas$getContext = canvas.getContext('2d')) === null || _canvas$getContext === void 0 || _canvas$getContext.drawImage(videoRef.current, 0, 0);
662
+ // 获取 base64
663
+ var _base = canvas.toDataURL('image/png');
664
+ onCapture === null || onCapture === void 0 || onCapture(_base);
665
+ }
666
+ };
667
+ // 开始跳转时触发
668
+ var handleSeeking = function handleSeeking() {
669
+ setIsSeeking(true);
670
+ };
671
+
672
+ // 跳转完成时触发
673
+ var handleSeeked = function handleSeeked() {
674
+ setIsSeeking(false);
675
+ };
676
+ var handleVideoError = function handleVideoError(e) {
677
+ var video = e.currentTarget;
678
+
679
+ // 获取具体的错误代码
680
+ var error = video.error;
681
+ setIsError(true);
682
+ if (error) {
683
+ switch (error.code) {
684
+ case MediaError.MEDIA_ERR_ABORTED:
685
+ onError === null || onError === void 0 || onError('视频加载已终止');
686
+ break;
687
+ case MediaError.MEDIA_ERR_NETWORK:
688
+ onError === null || onError === void 0 || onError('网络错误导致视频加载失败');
689
+ break;
690
+ case MediaError.MEDIA_ERR_DECODE:
691
+ onError === null || onError === void 0 || onError('视频解码失败');
692
+ break;
693
+ case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:
694
+ onError === null || onError === void 0 || onError('视频格式不支持或链接无效');
695
+ break;
696
+ default:
697
+ onError === null || onError === void 0 || onError('发生未知错误');
698
+ }
699
+ }
700
+ };
701
+ useEffect(function () {
702
+ var player = null;
703
+ if (isLive && videoRef.current != null) {
704
+ player = new EndPoint({
705
+ element: videoRef.current,
706
+ zlmsdpUrl: src,
707
+ recvOnly: true,
708
+ audioEnable: audioEnable,
709
+ videoEnable: videoEnable,
710
+ autoReconnect: retry,
711
+ reconnectInterval: retryInterval
712
+ });
713
+ }
714
+ return function () {
715
+ if (player != null) {
716
+ player.close();
717
+ }
718
+ };
719
+ }, [isLive, src, audioEnable, videoEnable, retry, retryInterval]);
720
+ useEffect(function () {
721
+ if (!isLive && videoRef.current != null) {
722
+ videoRef.current.src = src;
723
+ }
724
+ }, [isLive, src]);
725
+ useEffect(function () {
726
+ var dom = containerRef.current;
727
+ var handleFullScreenChange = function handleFullScreenChange(e) {
728
+ var ele = e.target;
729
+ if (document.fullscreenElement === ele) {
730
+ setIsFullScreen(true);
731
+ } else {
732
+ setIsFullScreen(false);
733
+ }
734
+ };
735
+ if (dom != null) {
736
+ dom.addEventListener('fullscreenchange', handleFullScreenChange);
737
+ }
738
+ return function () {
739
+ dom === null || dom === void 0 || dom.removeEventListener('fullscreenchange', handleFullScreen);
740
+ };
741
+ }, []);
742
+ useEffect(function () {
743
+ _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
744
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
745
+ while (1) switch (_context4.prev = _context4.next) {
746
+ case 0:
747
+ _context4.prev = 0;
748
+ _context4.next = 3;
749
+ return tf.ready();
750
+ case 3:
751
+ if ((aiFeature.emotion || aiFeature.character || aiFeature.anchor) && !faceApiInited) {
752
+ // 开始初始化人脸
753
+ initFaceApi();
754
+ }
755
+ if (aiFeature.pose && !poseDetector) {
756
+ initPoseDetecter();
757
+ }
758
+ _context4.next = 9;
759
+ break;
760
+ case 7:
761
+ _context4.prev = 7;
762
+ _context4.t0 = _context4["catch"](0);
763
+ case 9:
764
+ case "end":
765
+ return _context4.stop();
766
+ }
767
+ }, _callee4, null, [[0, 7]]);
768
+ }))();
769
+ }, [aiFeature, faceApiInited, initFaceApi, initPoseDetecter, poseDetector]);
770
+ useEffect(function () {
771
+ if (features == null) {
772
+ return;
773
+ }
774
+ if (!showSettingPanel) {
775
+ setAIFeature(function (prev) {
776
+ var cloned = _objectSpread({}, prev);
777
+ return Object.assign(cloned, features);
778
+ });
779
+ }
780
+ }, [features, showSettingPanel]);
781
+ useEffect(function () {
782
+ var handler = null;
783
+ // let lastTime = Date.now();
784
+ /* const start = () => {
785
+ if (
786
+ !faceFeature.anchor &&
787
+ !faceFeature.emotion &&
788
+ !faceFeature.character
789
+ ) {
790
+ return;
791
+ }
792
+ if (lastTime + 1000 <= Date.now()) {
793
+ lastTime = Date.now();
794
+ detect()
795
+ .catch((e) => {
796
+ console.log("error", e);
797
+ })
798
+ .finally(() => {
799
+ handler = requestAnimationFrame(start);
800
+ });
801
+ } else {
802
+ handler = requestAnimationFrame(start);
803
+ }
804
+ }; */
805
+
806
+ var lastTime = 0;
807
+ var fps = 30;
808
+ var start = function start(currentTime) {
809
+ if (currentTime - lastTime < 1000 / fps) {
810
+ handler = requestAnimationFrame(start);
811
+ return;
812
+ }
813
+ lastTime = currentTime;
814
+ if (aiFeature.anchor || aiFeature.emotion || aiFeature.character) {
815
+ detectFaces().catch(function (e) {
816
+ console.log('error', e);
817
+ }).finally(function () {});
818
+ }
819
+ if (aiFeature.pose) {
820
+ detectPose();
821
+ }
822
+ handler = requestAnimationFrame(start);
823
+ };
824
+ start(0);
825
+ return function () {
826
+ if (handler != null) {
827
+ cancelAnimationFrame(handler);
828
+ }
829
+ };
830
+ }, [detectFaces, detectPose, aiFeature.anchor, aiFeature.character, aiFeature.emotion, aiFeature.pose]);
831
+ useEffect(function () {
832
+ var handleClick = function handleClick() {
833
+ setShowSettingPanel(false);
834
+ };
835
+ window.addEventListener('click', handleClick);
836
+ return function () {
837
+ window.removeEventListener('click', handleClick);
838
+ };
839
+ }, []);
840
+ useEffect(function () {
841
+ if (videoRef.current != null) {
842
+ var resizeObserver = new ResizeObserver(function (entries) {
843
+ var entry = entries[0];
844
+ if (entry != null) {
845
+ setCanvasSize({
846
+ width: entry.contentRect.width,
847
+ height: entry.contentRect.height
848
+ });
849
+ }
850
+ });
851
+ resizeObserver.observe(videoRef.current);
852
+ }
853
+ }, []);
854
+ useEffect(function () {
855
+ if (videoRef.current == null) {
856
+ return;
857
+ }
858
+ var handlePlaying = function handlePlaying() {
859
+ setIsPlaying(true);
860
+ onPlayStateChange === null || onPlayStateChange === void 0 || onPlayStateChange(true);
861
+ };
862
+ var handlePause = function handlePause() {
863
+ setIsPlaying(false);
864
+ onPlayStateChange === null || onPlayStateChange === void 0 || onPlayStateChange(false);
865
+ };
866
+ videoRef.current.addEventListener('playing', handlePlaying);
867
+ videoRef.current.addEventListener('pause', handlePause);
868
+ return function () {
869
+ if (videoRef.current != null) {
870
+ videoRef.current.removeEventListener('playing', handlePlaying);
871
+ videoRef.current.removeEventListener('pause', handlePause);
872
+ }
873
+ };
874
+ }, []);
875
+ return /*#__PURE__*/React.createElement("div", {
876
+ ref: containerRef,
877
+ className: "".concat(bem, " ").concat(className !== null && className !== void 0 ? className : '')
878
+ }, /*#__PURE__*/React.createElement("div", {
879
+ className: "".concat(isFullScreen && rotateWhenFullScreen ? bem.m('full-screened') : '', " ").concat(bem.b('container'))
880
+ }, /*#__PURE__*/React.createElement(Spin, {
881
+ spinning: isSeeking,
882
+ delay: 100,
883
+ tip: /*#__PURE__*/React.createElement("span", {
884
+ style: {
885
+ color: 'black'
886
+ }
887
+ }, "\u89C6\u9891\u6B63\u5728\u7F13\u51B2\u4E2D...")
888
+ }, /*#__PURE__*/React.createElement("video", {
889
+ ref: videoRef,
890
+ muted: muted !== null && muted !== void 0 ? muted : false,
891
+ autoPlay: autoPlay !== null && autoPlay !== void 0 ? autoPlay : false,
892
+ onCanPlay: handleCanPlay,
893
+ onTimeUpdate: handleOnTimeUpdate,
894
+ onLoadedMetadata: handleOnLoadMetadata,
895
+ className: "".concat(bem.b('container').e('video')),
896
+ crossOrigin: 'anonymous'
897
+ // eslint-disable-next-line react/no-unknown-property
898
+ ,
899
+ "x5-video-player-type": miniProgram ? 'h5' : undefined
900
+ // style={{backgroundColor: "black", ...(style ?? {})}}
901
+ ,
902
+ style: _objectSpread({}, style !== null && style !== void 0 ? style : {}),
903
+ onSeeking: handleSeeking // 添加seeking事件监听
904
+ ,
905
+ onSeeked: handleSeeked,
906
+ onError: handleVideoError
907
+ })), controls === true && show && !isError && /*#__PURE__*/React.createElement("div", {
908
+ className: "".concat(bem.b('container').e('controls'))
909
+ }, /*#__PURE__*/React.createElement("div", {
910
+ className: "".concat(bem.b('container').e('mask')),
911
+ style: {
912
+ backgroundImage: "url(\"".concat(controlBottomBg, "\")")
913
+ }
914
+ }), /*#__PURE__*/React.createElement("div", {
915
+ className: "".concat(bem.b('container').e('progress')),
916
+ onClick: handleSetCurrentTime
917
+ }, /*#__PURE__*/React.createElement("div", {
918
+ className: "".concat(bem.b('container').e('progress-bar'))
919
+ }), /*#__PURE__*/React.createElement("div", {
920
+ className: "".concat(bem.b('container').e('progress-bar')),
921
+ style: {
922
+ width: duration != null ? "".concat(buffered / duration * 100, "%") : '0%'
923
+ }
924
+ }), /*#__PURE__*/React.createElement("div", {
925
+ className: "".concat(bem.b('container').e('progress-bar')),
926
+ style: {
927
+ width: duration != null ? "".concat(currentTime / duration * 100, "%") : '0%',
928
+ backgroundColor: '#00adec'
929
+ }
930
+ })), /*#__PURE__*/React.createElement("div", {
931
+ className: "".concat(bem.b('container').e('controls-content'))
932
+ }, !isPlaying ? /*#__PURE__*/React.createElement("svg", {
933
+ className: "".concat(bem.b('container').e('controls-icon')),
934
+ onClick: handlePlayAndStop,
935
+ viewBox: "0 0 1024 1024",
936
+ version: "1.1",
937
+ xmlns: "http://www.w3.org/2000/svg",
938
+ width: "200",
939
+ height: "200"
940
+ }, /*#__PURE__*/React.createElement("path", {
941
+ d: "M177.26002244 1020.68826978c-8.39476931 0-16.78529945-2.08703457-24.36334146-6.21023633-16.33313206-8.95150085-26.50548539-26.04060047-26.50548539-44.65859052L126.39119559 54.20316557c0-18.61799004 10.17235194-35.76219902 26.50548539-44.66565629 16.27661148-8.95291345 36.21436639-8.18564235 51.88479014 1.88214681L916.92809291 469.23344724c14.54989766 9.35562463 23.34737815 25.48528291 23.34737816 42.77785771 0 17.29257478-8.79748049 33.42081908-23.34737816 42.78209687L204.78147112 1012.60153981C196.38528784 1017.94559264 186.82618801 1020.68826978 177.26002244 1020.68826978L177.26002244 1020.68826978zM177.26002244 1020.68826978",
942
+ fill: "#ffffff"
943
+ })) : /*#__PURE__*/React.createElement("svg", {
944
+ className: "".concat(bem.b('container').e('controls-icon')),
945
+ onClick: handlePlayAndStop,
946
+ viewBox: "0 0 1024 1024",
947
+ version: "1.1",
948
+ xmlns: "http://www.w3.org/2000/svg",
949
+ width: "200",
950
+ height: "200"
951
+ }, /*#__PURE__*/React.createElement("path", {
952
+ d: "M389.07152284 985.52773717c0 23.49913734-19.22615598 42.72529332-42.72529333 42.7252933L178.5559691 1028.25303047c-23.49913734 0-42.72529332-19.22615598-42.72529333-42.7252933l0-941.80430386c0-23.49913734 19.22615598-42.72529332 42.72529333-42.72529331l167.79026041 0c23.49913734 0 42.72529332 19.22615598 42.72529333 42.72529331L389.07152284 985.52773717z",
953
+ fill: "#ffffff"
954
+ }), /*#__PURE__*/React.createElement("path", {
955
+ d: "M877.46200022 985.52773717c0 23.49913734-19.22615598 42.72529332-42.72529332 42.7252933l-167.79026043 0c-23.49913734 0-42.72529332-19.22615598-42.72529332-42.7252933l0-941.80430386c0-23.49913734 19.22615598-42.72529332 42.72529332-42.72529331l167.79026043 0c23.49913734 0 42.72529332 19.22615598 42.72529332 42.72529331L877.46200022 985.52773717z",
956
+ fill: "#ffffff"
957
+ })), !isLive ? /*#__PURE__*/React.createElement("span", {
958
+ className: "".concat(bem.b('container').e('controls-text')),
959
+ style: {
960
+ color: 'white'
961
+ }
962
+ }, formatDuration(currentTime), /*#__PURE__*/React.createElement(React.Fragment, null, duration != null && duration !== 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, "/ ", formatDuration(duration)) : null)) : null, /*#__PURE__*/React.createElement("div", {
963
+ className: "".concat(bem.b('container').e('controls-speed'), " ").concat(isLive ? bem.m('controls-speed').m('disabled') : ''),
964
+ style: {
965
+ color: !isLive ? 'white' : 'gray'
966
+ }
967
+ }, /*#__PURE__*/React.createElement("span", {
968
+ onClick: handleShowSpeedPicker
969
+ }, speed === '1.0' ? '倍速' : "".concat(speed, "x")), showSpeedPicker ? /*#__PURE__*/React.createElement("ul", {
970
+ className: "".concat(bem.b('container').e('controls-speed-picker-container')),
971
+ style: {
972
+ backgroundColor: 'rgba(0,0,0,.8)'
973
+ },
974
+ onMouseLeave: function onMouseLeave() {
975
+ return setShowSpeedPicker(false);
976
+ }
977
+ }, speeds === null || speeds === void 0 ? void 0 : speeds.map(function (item, index) {
978
+ return /*#__PURE__*/React.createElement("li", {
979
+ key: index,
980
+ onClick: function onClick() {
981
+ return handleOnSpeedSelect(item);
982
+ },
983
+ className: "".concat(bem.b('container').e('controls-speeds'), " ").concat(item === speed ? bem.b('container').e('controls-speeds').m('selected') : '')
984
+ }, item);
985
+ })) : null), /*#__PURE__*/React.createElement("div", {
986
+ className: "".concat(bem.b('container').e('controls-volume')),
987
+ onClick: handleShowVolumeSlider
988
+ }, volume !== 0 ? /*#__PURE__*/React.createElement("svg", {
989
+ className: "".concat(bem.b('container').e('controls-volume').e('icon')),
990
+ style: {
991
+ color: 'white'
992
+ },
993
+ viewBox: "0 0 1024 1024",
994
+ version: "1.1",
995
+ xmlns: "http://www.w3.org/2000/svg",
996
+ width: "200",
997
+ height: "200"
998
+ }, /*#__PURE__*/React.createElement("path", {
999
+ d: "M92.5696 768.31857778a93.20675555 93.20675555 0 0 1-93.20675555-93.20675556V348.88817778a93.20675555 93.20675555 0 0 1 93.20675555-93.20675556h186.41351111l195.26815289-169.2401664A93.20675555 93.20675555 0 0 1 628.50844445 156.88226133v710.23547734a93.20675555 93.20675555 0 0 1-154.25718045 70.44100551L278.98311111 768.31857778H92.5696z m779.18517475-586.50350933A407.40672853 407.40672853 0 0 1 1024.63715555 500.34915555a407.40672853 407.40672853 0 0 1-152.8823808 318.53408712 34.95253333 34.95253333 0 0 1-43.76057173-54.525952 337.50166187 337.50166187 0 0 0 126.76118756-264.00813512c0-103.99543751-47.18592-200.16150755-126.76118756-264.0081351a34.95253333 34.95253333 0 1 1 43.76057173-54.525952z m-130.8389831 137.87609315C808.63049955 364.19738738 849.87448889 434.80150471 849.87448889 512c0 77.19849529-41.24398933 147.80261262-108.95869724 192.3088384a34.95253333 34.95253333 0 1 1-38.4011833-58.39403235C751.30834489 613.82838045 779.96942222 564.70842027 779.96942222 512s-28.68437902-101.85168213-77.45481387-133.91480605a34.95253333 34.95253333 0 1 1 38.4011833-58.39403235z",
1000
+ style: {
1001
+ fill: 'currentcolor'
1002
+ }
1003
+ })) : /*#__PURE__*/React.createElement("svg", {
1004
+ className: "".concat(bem.b('container').e('controls-volume').e('icon'), " ").concat(!hasAudio ? "".concat(bem.m('controls-volume').e('icon').m('disabled')) : ''),
1005
+ style: {
1006
+ color: hasAudio ? 'white' : 'gray'
1007
+ },
1008
+ viewBox: "0 0 1024 1024",
1009
+ version: "1.1",
1010
+ xmlns: "http://www.w3.org/2000/svg",
1011
+ width: "200",
1012
+ height: "200"
1013
+ }, /*#__PURE__*/React.createElement("path", {
1014
+ d: "M516.55839289 644.67399111v217.71423289L425.95365925 780.04102637 277.57165985 645.11696592a45.46256592 45.46256592 0 0 0-30.54584415-11.78919822l-138.33071881 0.04369067-0.44782934-291.05993955h105.94865304l-90.64235614-90.64235615h-15.3062969c-49.88867318 0.19903525-90.2224403 40.72091497-90.1945268 90.59866548v291.10363022c0 49.96634548 40.47212089 90.59866548 90.1945268 90.59866548h121.27679527L425.95365925 902.55572385l72.06775467 65.49352297c18.17653097 16.50050845 35.39550815 21.10137837 48.94811023 21.10137836 10.46270103 0 18.80640475-2.74280297 23.61116444-4.88850015 11.05980682-4.88850015 36.70622815-20.92418845 36.70622816-64.2993114V735.40494222l-90.72852386-90.73095111zM918.12173748 546.86636563c0 88.342528-22.64996978 152.06536533-47.47233659 195.68442785l63.29806696 63.30413511c36.10912237-55.672832 71.01189689-140.10019082 71.0118969-259.03225362 0-241.58025955-149.30071703-341.37945125-155.68804978-345.49365572a42.860544 42.860544 0 0 0-32.59687822-5.88367643 42.958848 42.958848 0 0 0-27.05059083 19.11102577c-12.97248711 20.32708267-7.38736355 47.31213748 12.60233008 60.82590341 4.66640592 3.16150518 115.89556148 80.11290548 115.89556148 271.48409363z",
1015
+ style: {
1016
+ fill: 'currentcolor'
1017
+ }
1018
+ }), /*#__PURE__*/React.createElement("path", {
1019
+ d: "M676.68589985 410.21652385c2.7646483 1.43815111 67.79941925 35.70012918 67.79941926 133.42037333 0 25.19373748-3.65545245 46.11792592-9.05731793 63.67914667l66.28359585 66.289664c16.6667757-32.5592557 29.56765867-74.65035852 29.56765867-129.92512 0-155.22929778-112.40152178-210.65819022-117.15652267-212.95801837v0.04369067a42.94185718 42.94185718 0 0 0-32.92334458-1.57043674 42.90059378 42.90059378 0 0 0-24.31992415 22.22884029c-10.28551111 21.74338845-1.53766875 47.710208 19.80643555 58.79186015zM397.38239052 269.27650133l28.53364623-25.94497422 90.64235614-82.39210193V388.4525037l90.73095111 90.73095112V103.38668089c0-29.9705837-13.7746963-53.90336-36.84458192-64.14396681-11.09864297-4.88850015-40.38352592-13.09385008-72.51072949 16.14612859l-71.9791597 65.42677333-92.72737186 84.29385955 64.15488949 64.16702578zM897.04341808 942.34821215c-11.59016297 0-23.18032592-4.42368-32.02768593-13.27104l-770.0844089-770.0844089c-17.69472-17.69472-17.69472-46.36065185 0-64.05537184 17.69472-17.69472 46.36065185-17.69472 64.05537186 0l770.08440889 770.08319526c17.69472 17.69472 17.69472 46.36065185 0 64.05537185-8.84736 8.84857363-20.43752297 13.27225363-32.02768592 13.27225363z",
1020
+ style: {
1021
+ fill: 'currentcolor'
1022
+ }
1023
+ })), showVolumeSlider ? /*#__PURE__*/React.createElement("div", {
1024
+ className: "".concat(bem.b('container').e('controls-volume').e('slider')),
1025
+ onMouseUp: function onMouseUp() {
1026
+ return setMouseDown(false);
1027
+ },
1028
+ onMouseMove: throttle(handleOnMouseMove, 10),
1029
+ onMouseLeave: handleHideVolumeSlider
1030
+ }, /*#__PURE__*/React.createElement("div", {
1031
+ className: "".concat(bem.b('container').e('controls-volume').e('slider').e('number'))
1032
+ }, /*#__PURE__*/React.createElement("span", {
1033
+ className: "".concat(bem.b('container').e('controls-volume').e('slider').e('number').e('text'))
1034
+ }, Math.floor(volume))), /*#__PURE__*/React.createElement("div", {
1035
+ className: "".concat(bem.b('container').e('controls-volume').e('slider').e('progress-bar'))
1036
+ }, /*#__PURE__*/React.createElement("div", {
1037
+ className: "".concat(bem.b('container').e('controls-volume').e('slider').e('progress-bar').e('line'), " progress-bar")
1038
+ }, /*#__PURE__*/React.createElement("div", {
1039
+ className: "".concat(bem.b('container').e('controls-volume').e('slider').e('progress-bar').e('line').e('button-1')),
1040
+ style: {
1041
+ top: "".concat(100 - volume, "%")
1042
+ }
1043
+ })), /*#__PURE__*/React.createElement("div", {
1044
+ className: "".concat(bem.b('container').e('controls-volume').e('slider').e('progress-bar').e('button-2')),
1045
+ style: {
1046
+ top: "calc(".concat(100 - volume, "% - 9px)")
1047
+ },
1048
+ onMouseDown: handleOnMouseDown
1049
+ }))) : null), showCapture ? /*#__PURE__*/React.createElement("div", {
1050
+ className: "".concat(bem.b('container').e('controls-capture'))
1051
+ }, /*#__PURE__*/React.createElement("svg", {
1052
+ viewBox: "0 0 16 16",
1053
+ fill: "#ffffff",
1054
+ xmlns: "http://www.w3.org/2000/svg",
1055
+ onClick: handleCapture
1056
+ }, /*#__PURE__*/React.createElement("g", {
1057
+ id: "Frame"
1058
+ }, /*#__PURE__*/React.createElement("path", {
1059
+ id: "Vector",
1060
+ d: "M13.8982 2.31663C13.9446 2.39087 13.976 2.47352 13.9904 2.55987C14.0049 2.64622 14.0022 2.73457 13.9825 2.81987C13.9628 2.90518 13.9265 2.98577 13.8757 3.05705C13.8249 3.12833 13.7605 3.1889 13.6862 3.2353L9.26624 5.99663L11.9429 7.66863L11.9782 7.66996C12.7357 7.70479 13.4555 8.01026 14.0069 8.53084C14.5582 9.05142 14.9044 9.75255 14.9826 10.5068C15.0608 11.261 14.8657 12.0182 14.4329 12.6408C14.0001 13.2634 13.3582 13.7101 12.624 13.8995C11.8898 14.089 11.112 14.0087 10.4319 13.6732C9.75191 13.3378 9.21482 12.7695 8.9183 12.0716C8.62178 11.3737 8.58553 10.5926 8.81613 9.87026C9.04673 9.14791 9.52887 8.53228 10.1749 8.1353L8.00891 6.78263L5.83424 8.14063C6.48043 8.54091 6.96107 9.16026 7.1884 9.88559C7.41573 10.6109 7.37458 11.3938 7.07246 12.0913C6.77034 12.7888 6.22741 13.3543 5.54282 13.6847C4.85823 14.015 4.07767 14.0881 3.34367 13.8905C2.60968 13.693 1.97123 13.238 1.54492 12.6087C1.11862 11.9793 0.932898 11.2177 1.02168 10.4628C1.11047 9.70786 1.46783 9.01007 2.02851 8.49684C2.58919 7.9836 3.31578 7.68916 4.07558 7.6673L6.75091 5.99663L2.33224 3.2353C2.19381 3.14873 2.09195 3.01437 2.04599 2.8577C2.00004 2.70102 2.01317 2.53293 2.08291 2.3853L2.12024 2.31663C2.16664 2.24239 2.22721 2.17802 2.29849 2.12718C2.36977 2.07635 2.45036 2.04005 2.53567 2.02037C2.62098 2.00068 2.70932 1.99799 2.79567 2.01245C2.88202 2.02691 2.96467 2.05823 3.03891 2.10463L8.00891 5.21063L12.9796 2.10463C13.0538 2.05823 13.1365 2.02691 13.2228 2.01245C13.3092 1.99799 13.3975 2.00068 13.4828 2.02037C13.5681 2.04005 13.6487 2.07635 13.72 2.12718C13.7913 2.17802 13.8518 2.24239 13.8982 2.31663ZM4.16691 8.99996C3.68068 8.99996 3.21437 9.19312 2.87055 9.53694C2.52673 9.88075 2.33358 10.3471 2.33358 10.8333C2.33358 11.3195 2.52673 11.7858 2.87055 12.1297C3.21437 12.4735 3.68068 12.6666 4.16691 12.6666C4.65314 12.6666 5.11946 12.4735 5.46327 12.1297C5.80709 11.7858 6.00024 11.3195 6.00024 10.8333C6.00024 10.3471 5.80709 9.88075 5.46327 9.53694C5.11946 9.19312 4.65314 8.99996 4.16691 8.99996ZM11.8336 8.99996C11.3473 8.99996 10.881 9.19312 10.5372 9.53694C10.1934 9.88075 10.0002 10.3471 10.0002 10.8333C10.0002 11.3195 10.1934 11.7858 10.5372 12.1297C10.881 12.4735 11.3473 12.6666 11.8336 12.6666C12.3198 12.6666 12.7861 12.4735 13.1299 12.1297C13.4738 11.7858 13.6669 11.3195 13.6669 10.8333C13.6669 10.3471 13.4738 9.88075 13.1299 9.53694C12.7861 9.19312 12.3198 8.99996 11.8336 8.99996Z",
1061
+ fill: "white"
1062
+ })))) : null, /*#__PURE__*/React.createElement("div", {
1063
+ className: "".concat(bem.b('container').e('controls-setting'))
1064
+ }, /*#__PURE__*/React.createElement("svg", {
1065
+ viewBox: "0 0 1024 1024",
1066
+ version: "1.1",
1067
+ xmlns: "http://www.w3.org/2000/svg",
1068
+ width: "200",
1069
+ height: "200",
1070
+ onClick: handleShowSettingPanel
1071
+ }, /*#__PURE__*/React.createElement("path", {
1072
+ d: "M1012.28088889 417.33688889c-0.22755555-2.048-0.45511111-3.75466667-0.79644444-4.77866667v-0.91022222l-0.45511112-2.50311111c-8.07822222-39.36711111-34.13333333-64.73955555-66.56-64.73955556h-5.34755555c-55.296 0-100.12444445-45.056-100.12444445-100.12444444 0-12.74311111 5.91644445-30.83377778 8.41955556-37.20533334 15.70133333-36.63644445-1.024-78.39288889-39.82222222-99.66933333L685.51111111 38.34311111l-2.27555556-0.79644444c-9.10222222-2.95822222-19.68355555-6.48533333-31.51644444-6.48533334-22.07288889 0-46.87644445 10.24-62.23644444 25.6-19.22844445 19.00088889-58.25422222 47.33155555-81.46488889 47.33155556-23.09688889 0-62.23644445-28.21688889-81.46488889-47.33155556-16.384-16.15644445-39.02577778-25.6-62.23644444-25.6-12.17422222 0-22.41422222 3.41333333-31.51644445 6.48533334l-2.048 0.79644444-128 69.29066667-0.79644445 0.45511111c-31.06133333 19.456-43.69066667 64.05688889-27.87555555 99.44177778l0.22755555 0.45511111 0.22755556 0.45511111c2.50311111 5.57511111 10.24 24.46222222 10.24 40.96 0 55.296-45.056 100.12444445-100.12444444 100.12444444h-5.34755556c-33.90577778 0-59.27822222 25.03111111-66.56 65.19466667l-0.45511111 2.27555555v0.79644445c0 1.13777778-0.45511111 2.73066667-0.79644445 4.77866667-2.84444445 17.18044445-9.67111111 57.68533333-9.6711111 90.79466666 0 33.10933333 6.71288889 73.61422222 9.6711111 90.79466667 0.22755555 2.048 0.45511111 3.75466667 0.79644445 4.77866667v0.91022222l0.45511111 2.50311111c8.07822222 39.36711111 34.13333333 64.73955555 66.56 64.73955555h2.73066667c55.296 0 100.12444445 45.056 100.12444444 100.12444445 0 12.74311111-5.91644445 30.83377778-8.41955555 37.20533333-15.13244445 34.47466667-0.79644445 78.73422222 32.65422222 101.03466667l0.91022222 0.45511111 120.60444444 67.12888889 2.27555556 0.79644445c9.10222222 2.95822222 19.456 6.48533333 31.28888889 6.48533333 25.25866667 0 48.01422222-9.67111111 62.23644445-25.6 1.36533333-1.024 2.73066667-2.38933333 4.32355555-3.75466667 14.56355555-12.74311111 53.70311111-46.42133333 79.53066667-46.42133333 19.22844445 0 51.42755555 20.13866667 83.85422222 52.56533333 16.384 16.15644445 39.02577778 25.6 62.23644444 25.6 15.70133333 0 27.30666667-4.32355555 40.50488889-10.80888889l0.45511111-0.22755555 123.67644445-68.38044445 0.45511111-0.45511111c31.06133333-19.456 43.69066667-64.05688889 27.87555556-99.44177778l-0.22755556-0.45511111-0.22755556-0.45511111c-0.22755555-0.11377778-9.89866667-20.25244445-8.07822222-38.34311111l0.22755556-1.13777778v-1.13777777c0-55.296 45.056-100.12444445 100.12444444-100.12444445h5.68888889c33.90577778 0 59.27822222-25.03111111 66.56-65.19466667l0.45511111-2.27555555v-0.79644445c0.22755555-0.91022222 0.45511111-2.27555555 0.79644444-4.096 2.95822222-16.72533333 9.78488889-55.75111111 9.7848889-91.47733333 0.22755555-32.99555555-6.48533333-73.38666667-9.44355556-90.56711111z m-500.62222222 253.04177778c-87.49511111 0-158.37866667-70.88355555-158.37866667-158.37866667s70.88355555-158.37866667 158.37866667-158.37866667S670.03733333 424.50488889 670.03733333 512s-70.88355555 158.37866667-158.37866666 158.37866667z",
1073
+ fill: "#ffffff"
1074
+ })), showSettingPanel ? /*#__PURE__*/React.createElement("div", {
1075
+ className: "".concat(bem.b('container').e('controls-setting').e('panel')),
1076
+ onClick: function onClick(e) {
1077
+ return e.stopPropagation();
1078
+ }
1079
+ }, /*#__PURE__*/React.createElement("div", {
1080
+ className: "".concat(bem.b('container').e('controls-setting').e('panel').e('item'))
1081
+ }, /*#__PURE__*/React.createElement("div", null, "\u9762\u90E8\u8868\u60C5"), /*#__PURE__*/React.createElement("input", {
1082
+ onClick: function onClick(e) {
1083
+ return e.stopPropagation();
1084
+ },
1085
+ type: 'checkbox',
1086
+ className: "".concat(bem.b('container').e('controls-setting').e('panel').e('item').e('checkbox')),
1087
+ checked: features === null || features === void 0 ? void 0 : features.emotion,
1088
+ onChange: function onChange(e) {
1089
+ setFeatures(function (prev) {
1090
+ return _objectSpread(_objectSpread({}, prev), {}, {
1091
+ emotion: e.target.checked
1092
+ });
1093
+ });
1094
+ }
1095
+ })), /*#__PURE__*/React.createElement("div", {
1096
+ className: "".concat(bem.b('container').e('controls-setting').e('panel').e('item'))
1097
+ }, /*#__PURE__*/React.createElement("div", null, "\u9762\u90E8\u7279\u5F81"), /*#__PURE__*/React.createElement("input", {
1098
+ onClick: function onClick(e) {
1099
+ return e.stopPropagation();
1100
+ },
1101
+ type: 'checkbox',
1102
+ className: "".concat(bem.b('container').e('controls-setting').e('panel').e('item').e('checkbox')),
1103
+ checked: features === null || features === void 0 ? void 0 : features.character,
1104
+ onChange: function onChange(e) {
1105
+ setFeatures(function (prev) {
1106
+ return _objectSpread(_objectSpread({}, prev), {}, {
1107
+ character: e.target.checked
1108
+ });
1109
+ });
1110
+ }
1111
+ })), /*#__PURE__*/React.createElement("div", {
1112
+ className: "".concat(bem.b('container').e('controls-setting').e('panel').e('item'))
1113
+ }, /*#__PURE__*/React.createElement("div", null, "\u9762\u90E8\u951A\u70B9"), /*#__PURE__*/React.createElement("input", {
1114
+ onClick: function onClick(e) {
1115
+ return e.stopPropagation();
1116
+ },
1117
+ type: 'checkbox',
1118
+ className: "".concat(bem.b('container').e('controls-setting').e('panel').e('item').e('checkbox')),
1119
+ checked: features === null || features === void 0 ? void 0 : features.anchor,
1120
+ onChange: function onChange(e) {
1121
+ setFeatures(function (prev) {
1122
+ return _objectSpread(_objectSpread({}, prev), {}, {
1123
+ anchor: e.target.checked
1124
+ });
1125
+ });
1126
+ }
1127
+ })), /*#__PURE__*/React.createElement("div", {
1128
+ className: "".concat(bem.b('container').e('controls-setting').e('panel').e('item'))
1129
+ }, /*#__PURE__*/React.createElement("div", null, "\u80A2\u4F53\u7EBF\u6761"), /*#__PURE__*/React.createElement("input", {
1130
+ onClick: function onClick(e) {
1131
+ return e.stopPropagation();
1132
+ },
1133
+ type: 'checkbox',
1134
+ className: "".concat(bem.b('container').e('controls-setting').e('panel').e('item').e('checkbox')),
1135
+ checked: features === null || features === void 0 ? void 0 : features.pose,
1136
+ onChange: function onChange(e) {
1137
+ setFeatures(function (prev) {
1138
+ return _objectSpread(_objectSpread({}, prev), {}, {
1139
+ pose: e.target.checked
1140
+ });
1141
+ });
1142
+ }
1143
+ }))) : null), !isFullScreen ? /*#__PURE__*/React.createElement("svg", {
1144
+ className: "".concat(bem.b('container').e('controls-full-screen')),
1145
+ onClick: handleFullScreen,
1146
+ viewBox: "0 0 1024 1024",
1147
+ version: "1.1",
1148
+ xmlns: "http://www.w3.org/2000/svg",
1149
+ width: "200",
1150
+ height: "200"
1151
+ }, /*#__PURE__*/React.createElement("path", {
1152
+ d: "M156.3230208 97.74775309H304.87387653a41.42522469 41.42522469 0 1 0 0-82.85044939H56.32252839a41.42522469 41.42522469 0 0 0-41.42522469 41.42522469v248.55134814a41.42522469 41.42522469 0 1 0 82.85044939 0v-148.55085573l177.81777699 177.81777698a41.42522469 41.42522469 0 1 0 58.55455509-58.59598032L156.3230208 97.74775309zM926.25224691 156.3230208V304.87387653a41.42522469 41.42522469 0 1 0 82.85044939 0V56.32252839a41.42522469 41.42522469 0 0 0-41.42522469-41.42522469H719.12612347a41.42522469 41.42522469 0 1 0 0 82.85044939h148.55085573l-177.81777698 177.81777699a41.42522469 41.42522469 0 1 0 58.59598032 58.55455509L926.25224691 156.3230208zM156.3230208 926.25224691H304.87387653a41.42522469 41.42522469 0 1 1 0 82.85044939H56.32252839a41.42522469 41.42522469 0 0 1-41.42522469-41.42522469V719.12612347a41.42522469 41.42522469 0 1 1 82.85044939 0v148.55085573l177.81777699-177.81777698a41.42522469 41.42522469 0 1 1 58.55455509 58.59598032L156.3230208 926.25224691zM926.25224691 867.6769792V719.12612347a41.42522469 41.42522469 0 1 1 82.85044939 0v248.55134814a41.42522469 41.42522469 0 0 1-41.42522469 41.42522469H719.12612347a41.42522469 41.42522469 0 1 1 0-82.85044939h148.55085573l-177.81777698-177.81777699a41.42522469 41.42522469 0 1 1 58.59598032-58.55455509L926.25224691 867.6769792z",
1153
+ fill: "#ffffff"
1154
+ })) : /*#__PURE__*/React.createElement("svg", {
1155
+ className: "".concat(bem.b('container').e('controls-full-screen')),
1156
+ onClick: handleExitFullScreen,
1157
+ viewBox: "0 0 1024 1024",
1158
+ version: "1.1",
1159
+ xmlns: "http://www.w3.org/2000/svg",
1160
+ width: "200",
1161
+ height: "200"
1162
+ }, /*#__PURE__*/React.createElement("path", {
1163
+ d: "M819.12661586 760.55134815H967.67747161a41.42522469 41.42522469 0 1 0 0-82.85044939H719.12612347a41.42522469 41.42522469 0 0 0-41.42522471 41.42522471v248.55134814a41.42522469 41.42522469 0 1 0 82.85044939 0v-148.55085575l177.81777699 177.81777699a41.42522469 41.42522469 0 1 0 58.55455509-58.59598032L819.12661586 760.55134815zM263.44865185 819.12661586V967.67747161a41.42522469 41.42522469 0 1 0 82.85044939 0V719.12612347a41.42522469 41.42522469 0 0 0-41.42522471-41.42522471H56.32252839a41.42522469 41.42522469 0 1 0 0 82.85044939h148.55085575l-177.81777699 177.81777699a41.42522469 41.42522469 0 1 0 58.59598032 58.55455509L263.44865185 819.12661586zM819.12661586 263.44865185H967.67747161a41.42522469 41.42522469 0 1 1 0 82.85044939H719.12612347a41.42522469 41.42522469 0 0 1-41.42522471-41.42522471V56.32252839a41.42522469 41.42522469 0 1 1 82.85044939 0v148.55085575l177.81777699-177.81777699a41.42522469 41.42522469 0 1 1 58.55455509 58.59598032L819.12661586 263.44865185zM263.44865185 204.87338414V56.32252839a41.42522469 41.42522469 0 1 1 82.85044939 0v248.55134814a41.42522469 41.42522469 0 0 1-41.42522471 41.42522471H56.32252839a41.42522469 41.42522469 0 1 1 0-82.85044939h148.55085575l-177.81777699-177.81777699a41.42522469 41.42522469 0 1 1 58.59598032-58.55455509L263.44865185 204.87338414z",
1164
+ fill: "#ffffff"
1165
+ }))), /*#__PURE__*/React.createElement("div", {
1166
+ className: "".concat(bem.b('container').e('controls-bottom-progress').e('bar'))
1167
+ }, /*#__PURE__*/React.createElement("div", {
1168
+ className: "".concat(bem.b('container').e('controls-bottom-progress').e('bar').e('item-1'))
1169
+ }), /*#__PURE__*/React.createElement("div", {
1170
+ className: "".concat(bem.b('container').e('controls-bottom-progress').e('bar').e('item-2')),
1171
+ style: {
1172
+ width: duration != null ? "".concat(buffered / duration * 100, "%") : '0%'
1173
+ }
1174
+ }), /*#__PURE__*/React.createElement("div", {
1175
+ className: "".concat(bem.b('container').e('controls-bottom-progress').e('bar').e('item-3')),
1176
+ style: {
1177
+ width: duration != null ? "".concat(currentTime / duration * 100, "%") : '0%'
1178
+ }
1179
+ }))), aiFeature.anchor || aiFeature.emotion || aiFeature.character ? /*#__PURE__*/React.createElement("canvas", {
1180
+ className: "".concat(bem.b('container').e('canvas')),
1181
+ width: videoEleSize.width,
1182
+ height: videoEleSize.height,
1183
+ ref: canvasRef,
1184
+ style: {
1185
+ transform: "scale(".concat(canvasSize.width / videoEleSize.width, ")")
1186
+ }
1187
+ }) : null, aiFeature.pose ? /*#__PURE__*/React.createElement("canvas", {
1188
+ className: "".concat(bem.b('container').e('canvas')),
1189
+ width: videoEleSize.width,
1190
+ height: videoEleSize.height,
1191
+ ref: poseCanvasRef,
1192
+ style: {
1193
+ transform: "scale(".concat(canvasSize.width / videoEleSize.width, ")")
1194
+ }
1195
+ }) : null));
1196
+ });
1197
+ VideoPlayer.displayName = 'VideoPlayer';