@realsee/vreo 2.6.2 → 2.6.4-alpha.2
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/lib/PlayController/createHTMLAudioElement.js +10 -14
- package/lib/PlayController/index.js +63 -73
- package/lib/Player/App.js +2 -2
- package/lib/Player/AudioFocus.d.ts +36 -0
- package/lib/Player/AudioFocus.js +139 -0
- package/lib/Player/Controller.d.ts +16 -0
- package/lib/Player/Controller.js +119 -61
- package/lib/Player/custom/SpatialScenePanel/index.js +34 -11
- package/lib/Player/index.d.ts +8 -2
- package/lib/Player/index.js +182 -123
- package/lib/Player/modules/Drawer/index.js +1 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +8 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +173 -203
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +1 -0
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +6 -2
- package/lib/Player/modules/VideoAgent/index.js +10 -2
- package/lib/Player/modules/keyframes/BgMusic/index.js +46 -54
- package/lib/Player/modules/keyframes/CameraMovement/index.js +43 -45
- package/lib/Player/modules/keyframes/InfoPanel/index.js +37 -32
- package/lib/Player/modules/keyframes/ModelVideo/index.js +98 -57
- package/lib/Player/modules/keyframes/PanoTag/index.js +1 -1
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +3 -3
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +3 -3
- package/lib/Player/modules/keyframes/VideoEffect/index.js +87 -74
- package/lib/Player/typings.d.ts +10 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +6 -6
- package/lib/fivePlugins/CameraMovementPlugin/index.js +173 -180
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
- package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts +2 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +87 -43
- package/lib/index.d.ts +1 -0
- package/lib/react/index.js +1 -1
- package/lib/shared-utils/Audio.js +53 -56
- package/lib/shared-utils/AudioLike.js +12 -14
- package/lib/shared-utils/animationFrame/BetterTween.js +13 -15
- package/lib/shared-utils/animationFrame/tween.js +1 -3
- package/lib/shared-utils/getMediaInfo.js +0 -1
- package/lib/typings/VreoUnit.js +134 -27
- package/package.json +6 -4
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -78
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1640
- package/docs/classes/Player.AudioLike.html +0 -15
- package/docs/classes/Player.Controller.html +0 -87
- package/docs/classes/Player.Player.html +0 -54
- package/docs/classes/Player.VideoAgentMesh.html +0 -72
- package/docs/classes/Player.VideoAgentScene.html +0 -9
- package/docs/demo/assets/AppReact-CkuqZtcS.js +0 -1
- package/docs/demo/assets/default-BQGCQRLt.css +0 -1
- package/docs/demo/assets/default-CVvVdmSW.js +0 -5540
- package/docs/demo/assets/dynamic-CO5wq52h.js +0 -1
- package/docs/demo/assets/examples-BCLzFApO.css +0 -1
- package/docs/demo/assets/examples-DfiAz2fR.js +0 -25
- package/docs/demo/assets/index-CBBSwaYT.js +0 -1
- package/docs/demo/assets/index-CmEXi2sK.css +0 -1
- package/docs/demo/assets/main-BF1tvUg-.js +0 -25
- package/docs/demo/assets/react-BnzBLum3.css +0 -1
- package/docs/demo/assets/react-C4h9qndP.js +0 -25
- package/docs/demo/examples.html +0 -16
- package/docs/demo/index-react-dynamic.html +0 -18
- package/docs/demo/index-react.html +0 -19
- package/docs/demo/index.html +0 -19
- package/docs/enums/Player.InfoPanelStyleEnum.html +0 -3
- package/docs/enums/Player.InfoPanelTypeEnum.html +0 -4
- package/docs/enums/Player.PanoEffectEnum.html +0 -4
- package/docs/enums/Player.PanoTagEnum.html +0 -4
- package/docs/enums/Player.PanoTagStyleEnum.html +0 -6
- package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
- package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -3
- package/docs/enums/fivePlugins.Rotation.html +0 -4
- package/docs/functions/custom.SpatialScenePanel.html +0 -2
- package/docs/functions/react.useVreoAction.html +0 -8
- package/docs/functions/react.useVreoEventCallback.html +0 -10
- package/docs/functions/react.useVreoPausedState.html +0 -8
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -160
- package/docs/interfaces/Player.Appearance.html +0 -2
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -3
- package/docs/interfaces/Player.PlayerConfigs.html +0 -20
- package/docs/interfaces/Player.Vertex.html +0 -5
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -9
- package/docs/interfaces/Player.VreoKeyframe.html +0 -8
- package/docs/interfaces/Player.VreoUnit.html +0 -9
- package/docs/interfaces/Player.VreoVideo.html +0 -7
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -8
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -3
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -5
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -5
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -4
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -2
- package/docs/interfaces/fivePlugins.Vector3Position.html +0 -5
- package/docs/interfaces/react.VreoActionCallbacks.html +0 -18
- package/docs/interfaces/react.VreoProviderProps.html +0 -6
- package/docs/modules/Player.html +0 -1
- package/docs/modules/custom.html +0 -1
- package/docs/modules/fivePlugins.html +0 -1
- package/docs/modules/react.html +0 -1
- package/docs/modules.html +0 -1
- package/docs/types/Player.AppSize.html +0 -1
- package/docs/types/Player.AudioLikeEvent.html +0 -6
- package/docs/types/Player.CameraMovementData.html +0 -2
- package/docs/types/Player.CustomData.html +0 -2
- package/docs/types/Player.InfoPanelData.html +0 -7
- package/docs/types/Player.ModelVideoData.html +0 -9
- package/docs/types/Player.PanoEffectData.html +0 -4
- package/docs/types/Player.PanoTagData.html +0 -6
- package/docs/types/Player.PanoTextLabelData.html +0 -7
- package/docs/types/Player.PrompterData.html +0 -3
- package/docs/types/Player.QuadrangleVertexs.html +0 -2
- package/docs/types/Player.Quaternion.html +0 -6
- package/docs/types/Player.UpdateVRPanoramaData.html +0 -7
- package/docs/types/Player.Vertexs.html +0 -2
- package/docs/types/Player.VideoEffectData.html +0 -7
- package/docs/types/Player.VreoKeyframeEvent.html +0 -2
- package/docs/types/Player.VreoKeyframeMap.html +0 -6
- package/docs/types/Player.VreoSubscribe.html +0 -1
- package/docs/types/Player.WaveAppearance.html +0 -1
- package/docs/types/fivePlugins.CSS3DRenderPluginParameterType.html +0 -1
- package/docs/types/fivePlugins.MoveArgs.html +0 -1
- package/docs/types/fivePlugins.MoveOpts.html +0 -1
- package/docs/types/fivePlugins.RotateArgs.html +0 -1
- package/docs/types/fivePlugins.RotateOpts.html +0 -1
- package/docs/variables/fivePlugins.CSS3DRenderPlugin.html +0 -3
- package/docs/variables/fivePlugins.CameraMovementPlugin.html +0 -2
- package/docs/variables/fivePlugins.ModelTVVideoPlugin.html +0 -1
- package/docs/variables/react.VreoProvider.html +0 -9
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
|
|
3
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
// import { Preloader } from '../../../../shared-utils/Preloader'
|
|
7
8
|
import { VreoKeyframeEnum } from "../../../../typings/VreoUnit.js";
|
|
8
|
-
import { useController, useFiveInstance } from "../../../hooks.js";
|
|
9
|
-
var inlinePlay = function inlinePlay(videoInstance) {
|
|
10
|
-
if (!videoInstance) return;
|
|
11
|
-
var canplaythrough = function canplaythrough() {
|
|
12
|
-
videoInstance.removeEventListener('canplaythrough', canplaythrough);
|
|
13
|
-
try {
|
|
14
|
-
videoInstance.play();
|
|
15
|
-
} catch (error) {}
|
|
16
|
-
};
|
|
17
|
-
videoInstance.addEventListener('canplaythrough', canplaythrough);
|
|
18
|
-
videoInstance.load();
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// const emptyVideo = '//vr-static.realsee-cdn.cn/release/web/leisure.69fd3522.mov'
|
|
9
|
+
import { useController, useFiveInstance } from "../../../hooks.js"; // const emptyVideo = '//vr-static.realsee-cdn.cn/release/web/leisure.69fd3522.mov'
|
|
22
10
|
var PI = Math.PI;
|
|
23
11
|
var PI_2 = PI * 2;
|
|
24
12
|
export function VideoEffect() {
|
|
@@ -36,46 +24,75 @@ export function VideoEffect() {
|
|
|
36
24
|
videoRef.current.src = blob;
|
|
37
25
|
};
|
|
38
26
|
React.useEffect(function () {
|
|
27
|
+
var generation = 0;
|
|
28
|
+
var removeCanPlay;
|
|
39
29
|
var callback = /*#__PURE__*/function () {
|
|
40
|
-
var _ref = _asyncToGenerator(
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(keyframe) {
|
|
31
|
+
var _removeCanPlay;
|
|
32
|
+
var current, start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude, active, valid, video, play;
|
|
33
|
+
return _regenerator().w(function (_context) {
|
|
34
|
+
while (1) switch (_context.n) {
|
|
35
|
+
case 0:
|
|
36
|
+
current = ++generation;
|
|
37
|
+
start = keyframe.start, end = keyframe.end;
|
|
38
|
+
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, fov = _ref2.fov, direction = _ref2.direction, panoIndex = _ref2.panoIndex, vector = _ref2.vector;
|
|
39
|
+
_ref3 = function () {
|
|
40
|
+
if (vector) {
|
|
41
|
+
return [vector.longitude, vector.latitude];
|
|
42
|
+
}
|
|
43
|
+
if (!direction) {
|
|
44
|
+
return [0, 0];
|
|
45
|
+
}
|
|
46
|
+
var longitude = -Math.atan2(direction.x, -direction.z);
|
|
47
|
+
longitude = (longitude % PI_2 + PI_2) % PI_2;
|
|
48
|
+
var latitude = -Math.asin(direction.y / 1);
|
|
49
|
+
return [longitude, latitude];
|
|
50
|
+
}(), _ref4 = _slicedToArray(_ref3, 2), longitude = _ref4[0], latitude = _ref4[1];
|
|
51
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
52
|
+
if (videoRef.current) {
|
|
53
|
+
videoRef.current.muted = true;
|
|
54
|
+
videoRef.current.pause();
|
|
55
|
+
}
|
|
56
|
+
five.setState({
|
|
57
|
+
fov: fov,
|
|
58
|
+
panoIndex: panoIndex,
|
|
59
|
+
longitude: longitude,
|
|
60
|
+
latitude: latitude
|
|
61
|
+
}, true);
|
|
62
|
+
setBlobSrc(videoSrc);
|
|
63
|
+
(_removeCanPlay = removeCanPlay) === null || _removeCanPlay === void 0 || _removeCanPlay();
|
|
64
|
+
active = controller.audioFocus.capture();
|
|
65
|
+
valid = function valid() {
|
|
66
|
+
return current === generation && active();
|
|
67
|
+
};
|
|
68
|
+
video = videoRef.current;
|
|
69
|
+
if (!(!video || !valid())) {
|
|
70
|
+
_context.n = 1;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
return _context.a(2);
|
|
74
|
+
case 1:
|
|
75
|
+
play = function play() {
|
|
76
|
+
var _removeCanPlay2;
|
|
77
|
+
(_removeCanPlay2 = removeCanPlay) === null || _removeCanPlay2 === void 0 || _removeCanPlay2();
|
|
78
|
+
if (!valid()) return;
|
|
79
|
+
video.muted = false;
|
|
80
|
+
void video.play().catch(function (error) {
|
|
81
|
+
if (valid()) {
|
|
82
|
+
controller.audioFocus.cancel('paused');
|
|
83
|
+
console.error(error);
|
|
54
84
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
setBlobSrc(videoSrc);
|
|
67
|
-
inlinePlay(videoRef.current);
|
|
68
|
-
setVisible(true);
|
|
69
|
-
timeoutRef.current = setTimeout(function () {
|
|
70
|
-
var _videoRef$current;
|
|
71
|
-
(_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 ? void 0 : _videoRef$current.pause();
|
|
72
|
-
setVisible(false);
|
|
73
|
-
setBlobSrc('');
|
|
74
|
-
}, end - start);
|
|
75
|
-
case 8:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
removeCanPlay = function removeCanPlay() {
|
|
88
|
+
return video.removeEventListener('canplaythrough', play);
|
|
89
|
+
};
|
|
90
|
+
video.addEventListener('canplaythrough', play);
|
|
91
|
+
video.load();
|
|
92
|
+
setVisible(true);
|
|
93
|
+
timeoutRef.current = setTimeout(destroy, Math.max(0, end - start));
|
|
94
|
+
case 2:
|
|
95
|
+
return _context.a(2);
|
|
79
96
|
}
|
|
80
97
|
}, _callee);
|
|
81
98
|
}));
|
|
@@ -85,21 +102,21 @@ export function VideoEffect() {
|
|
|
85
102
|
}();
|
|
86
103
|
controller.on(VreoKeyframeEnum.VideoEffect, callback);
|
|
87
104
|
var destroy = function destroy() {
|
|
88
|
-
var _videoRef$
|
|
105
|
+
var _removeCanPlay3, _videoRef$current;
|
|
106
|
+
++generation;
|
|
89
107
|
if (timeoutRef.current) {
|
|
90
108
|
clearTimeout(timeoutRef.current);
|
|
91
109
|
}
|
|
92
|
-
(
|
|
110
|
+
(_removeCanPlay3 = removeCanPlay) === null || _removeCanPlay3 === void 0 || _removeCanPlay3();
|
|
111
|
+
if (videoRef.current) videoRef.current.muted = true;
|
|
112
|
+
(_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 || _videoRef$current.pause();
|
|
93
113
|
setVisible(false);
|
|
94
114
|
setBlobSrc('');
|
|
95
115
|
};
|
|
96
|
-
controller.
|
|
97
|
-
return destroy();
|
|
98
|
-
});
|
|
99
|
-
controller.on('ended', function () {
|
|
100
|
-
return destroy();
|
|
101
|
-
});
|
|
116
|
+
var remove = controller.audioFocus.add(destroy);
|
|
102
117
|
return function () {
|
|
118
|
+
destroy();
|
|
119
|
+
remove();
|
|
103
120
|
controller.off(VreoKeyframeEnum.VideoEffect, callback);
|
|
104
121
|
if (timeoutRef.current) {
|
|
105
122
|
clearTimeout(timeoutRef.current);
|
|
@@ -107,27 +124,23 @@ export function VideoEffect() {
|
|
|
107
124
|
};
|
|
108
125
|
}, [controller]);
|
|
109
126
|
React.useEffect(function () {
|
|
110
|
-
var _controller$configs
|
|
127
|
+
var _controller$configs;
|
|
111
128
|
if (!ref.current) return;
|
|
112
|
-
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0
|
|
129
|
+
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 || (_controller$configs = _controller$configs.videos) === null || _controller$configs === void 0 ? void 0 : _controller$configs.videoEffect) || document.createElement('video');
|
|
113
130
|
// <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
|
|
114
131
|
video.setAttribute('playsinline', 'true');
|
|
115
132
|
video.setAttribute('webkit-playsinline', 'true');
|
|
116
|
-
video.
|
|
133
|
+
video.autoplay = false;
|
|
134
|
+
video.muted = true;
|
|
117
135
|
video.setAttribute('key', 'VideoEffect-video');
|
|
118
136
|
video.setAttribute('class', 'VideoEffect-video');
|
|
119
137
|
videoRef.current = video;
|
|
120
138
|
ref.current.append(videoRef.current);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// const asyncfunc = async () => {
|
|
127
|
-
// setBlobSrc(await URL.createObjectURL(await Preloader.blob(emptyVideo)))
|
|
128
|
-
// inlinePlay(videoRef.current)
|
|
129
|
-
// }
|
|
130
|
-
// asyncfunc()
|
|
139
|
+
return function () {
|
|
140
|
+
video.muted = true;
|
|
141
|
+
video.pause();
|
|
142
|
+
video.remove();
|
|
143
|
+
};
|
|
131
144
|
}, []);
|
|
132
145
|
return /*#__PURE__*/React.createElement("div", {
|
|
133
146
|
ref: ref,
|
package/lib/Player/typings.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { AudioFocusHost } from './AudioFocus';
|
|
1
2
|
import React, { ReactNode } from 'react';
|
|
2
3
|
import { Subscribe, Five } from '@realsee/five';
|
|
3
4
|
import { VreoKeyframe, VreoKeyframeConfigMap, VreoKeyframeEvent } from '../typings/VreoUnit';
|
|
4
5
|
import { VideoAgentMeshOptions } from './modules/VideoAgent/VideoAgentMesh';
|
|
5
6
|
export interface PlayerConfigs {
|
|
7
|
+
audioFocus?: AudioFocusHost;
|
|
6
8
|
/**
|
|
7
9
|
* @deprecated rename to container
|
|
8
10
|
*/
|
|
@@ -37,6 +39,13 @@ export interface PlayerConfigs {
|
|
|
37
39
|
waveStaticPrefix?: string;
|
|
38
40
|
onAvatarClick?: () => any;
|
|
39
41
|
onWaveClick?: () => any;
|
|
42
|
+
/**
|
|
43
|
+
* 是否等待背景音乐加载完成后再播放
|
|
44
|
+
* - true: 等待音频完全可播放(canplaythrough)后再播放,确保不会卡顿
|
|
45
|
+
* - false: 立即播放,边加载边播放(默认行为)
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
waitForBgMusicLoaded?: boolean;
|
|
40
49
|
}
|
|
41
50
|
export type AppSize = 'S' | 'M' | 'L' | 'XL';
|
|
42
51
|
export type WaveAppearance = 'single' | 'double' | 'solid' | 'swap' | 'expand';
|
|
@@ -45,6 +54,7 @@ export interface Appearance {
|
|
|
45
54
|
}
|
|
46
55
|
export type VreoSubscribe = Pick<Subscribe<VreoKeyframeEvent>, 'on' | 'once' | 'off'>;
|
|
47
56
|
export interface CustomVreoKeyframeProps {
|
|
57
|
+
audioFocus: AudioFocusHost;
|
|
48
58
|
subscribe: Pick<Subscribe<{
|
|
49
59
|
[key: string]: (data: VreoKeyframe, currentTime: number) => any;
|
|
50
60
|
}>, 'on' | 'once' | 'off'>;
|
|
@@ -28,7 +28,7 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
28
28
|
});
|
|
29
29
|
var config = params[1];
|
|
30
30
|
if ((points === null || points === void 0 ? void 0 : points.length) < 4) return console.error('points must be equal or greater than than 4');
|
|
31
|
-
if (!(five !== null && five !== void 0 && (_five$model = five.model) !== null && _five$model !== void 0 && _five$model.loaded)) return console.error('five.model.loaded is: ', five === null || five === void 0
|
|
31
|
+
if (!(five !== null && five !== void 0 && (_five$model = five.model) !== null && _five$model !== void 0 && _five$model.loaded)) return console.error('five.model.loaded is: ', five === null || five === void 0 || (_five$model2 = five.model) === null || _five$model2 === void 0 ? void 0 : _five$model2.loaded);
|
|
32
32
|
var fiveElement = five.getElement();
|
|
33
33
|
if (!fiveElement) return console.error('five.getElement() is ' + fiveElement);
|
|
34
34
|
var disposers = [];
|
|
@@ -92,16 +92,16 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
92
92
|
css3DRenderer.domElement.style.top = '0';
|
|
93
93
|
css3DRenderer.domElement.style.userSelect = 'none';
|
|
94
94
|
css3DRenderer.domElement.style.pointerEvents = 'none';
|
|
95
|
-
var
|
|
95
|
+
var _renderEveryFrame = function renderEveryFrame() {
|
|
96
96
|
if (stopRenderFlag) return;
|
|
97
|
-
requestAnimationFrameId = requestAnimationFrame(
|
|
97
|
+
requestAnimationFrameId = requestAnimationFrame(_renderEveryFrame);
|
|
98
98
|
css3DRenderer.render(scene, five.camera);
|
|
99
99
|
};
|
|
100
100
|
return function () {
|
|
101
101
|
var _resizeObserver, _resizeObserver$obser;
|
|
102
102
|
scene.add(css3DObject);
|
|
103
|
-
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0
|
|
104
|
-
|
|
103
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || (_resizeObserver$obser = _resizeObserver.observe) === null || _resizeObserver$obser === void 0 || _resizeObserver$obser.call(_resizeObserver);
|
|
104
|
+
_renderEveryFrame();
|
|
105
105
|
if (mode === 'behind' && mesh) {
|
|
106
106
|
five.scene.add(mesh);
|
|
107
107
|
disposers.push(function () {
|
|
@@ -138,7 +138,7 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
138
138
|
if (mode === 'behind') state.behindMode = undefined;
|
|
139
139
|
if (!state.behindMode && !state.frontMode) {
|
|
140
140
|
var _resizeObserver2, _resizeObserver2$unob;
|
|
141
|
-
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0
|
|
141
|
+
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 || (_resizeObserver2$unob = _resizeObserver2.unobserve) === null || _resizeObserver2$unob === void 0 || _resizeObserver2$unob.call(_resizeObserver2);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
return true;
|