@realsee/vreo 2.3.6 → 2.3.8
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 +7 -13
- package/lib/PlayController/index.js +27 -95
- package/lib/Player/App.js +2 -28
- package/lib/Player/Controller.js +48 -132
- package/lib/Player/custom/SpatialScenePanel/index.js +45 -76
- package/lib/Player/hooks.js +1 -11
- package/lib/Player/index.js +34 -101
- package/lib/Player/modules/Drawer/index.js +2 -19
- package/lib/Player/modules/PopUp/index.js +2 -12
- package/lib/Player/modules/ResizeObserver/index.js +1 -9
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +29 -123
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +15 -37
- package/lib/Player/modules/VideoAgent/index.js +2 -19
- package/lib/Player/modules/Wave/index.js +14 -43
- package/lib/Player/modules/keyframes/BgMusic/index.js +10 -28
- package/lib/Player/modules/keyframes/CameraMovement/index.js +6 -30
- package/lib/Player/modules/keyframes/InfoPanel/index.js +9 -39
- package/lib/Player/modules/keyframes/ModelVideo/index.js +6 -32
- package/lib/Player/modules/keyframes/PanoEffect/index.js +19 -52
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -8
- package/lib/Player/modules/keyframes/PanoTag/index.js +5 -23
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +27 -57
- package/lib/Player/modules/keyframes/Prompter/index.js +15 -42
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +19 -26
- package/lib/Player/modules/keyframes/VideoEffect/index.js +18 -59
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +21 -62
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
- package/lib/fivePlugins/CameraMovementPlugin/index.js +20 -74
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +15 -69
- package/lib/index.js +0 -1
- package/lib/react/index.js +10 -41
- package/lib/shared-utils/Audio.js +35 -96
- package/lib/shared-utils/AudioLike.js +20 -56
- package/lib/shared-utils/Preloader.js +0 -7
- package/lib/shared-utils/addResizeListener.js +0 -5
- package/lib/shared-utils/animationFrame/BetterTween.js +19 -58
- package/lib/shared-utils/animationFrame/index.js +2 -10
- package/lib/shared-utils/animationFrame/tween.js +2 -11
- package/lib/shared-utils/createTransMatrix.js +5 -26
- package/lib/shared-utils/getFileExpandedName.js +0 -1
- package/lib/shared-utils/getMediaInfo.js +1 -10
- package/lib/shared-utils/setElementDataset.js +0 -2
- package/lib/typings/VreoUnit.js +0 -15
- package/package.json +4 -3
|
@@ -1,88 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.Prompter = Prompter;
|
|
9
|
-
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
13
|
var _hooks = require("../../../hooks");
|
|
15
|
-
|
|
16
14
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
-
|
|
26
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
-
|
|
28
|
-
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."); }
|
|
29
|
-
|
|
30
|
-
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); }
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
|
-
|
|
36
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
-
|
|
38
17
|
function Prompter() {
|
|
39
18
|
var _React$useState = React.useState(''),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
19
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
20
|
+
text = _React$useState2[0],
|
|
21
|
+
setText = _React$useState2[1];
|
|
44
22
|
var _React$useState3 = React.useState(true),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
23
|
+
_React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
|
|
24
|
+
hidden = _React$useState4[0],
|
|
25
|
+
setHidden = _React$useState4[1];
|
|
49
26
|
var ref = React.useRef(null);
|
|
50
27
|
var controller = (0, _hooks.useController)();
|
|
51
28
|
React.useEffect(function () {
|
|
52
29
|
var _controller$configs;
|
|
53
|
-
|
|
54
30
|
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
|
|
55
31
|
return;
|
|
56
32
|
}
|
|
57
|
-
|
|
58
33
|
var callback = function callback(keyframe) {
|
|
59
34
|
var start = keyframe.start,
|
|
60
|
-
|
|
61
|
-
|
|
35
|
+
end = keyframe.end,
|
|
36
|
+
data = keyframe.data;
|
|
62
37
|
setText(data.text);
|
|
63
38
|
setHidden(false);
|
|
64
|
-
|
|
65
39
|
if (ref.current) {
|
|
66
40
|
clearTimeout(ref.current);
|
|
67
41
|
ref.current = null;
|
|
68
42
|
}
|
|
69
|
-
|
|
70
43
|
ref.current = setTimeout(function () {
|
|
71
44
|
setHidden(true);
|
|
72
|
-
setText('');
|
|
45
|
+
setText('');
|
|
46
|
+
// setTimeout(() => setText(''), 500)
|
|
73
47
|
|
|
74
48
|
if (ref.current) clearTimeout(ref.current);
|
|
75
49
|
ref.current = null;
|
|
76
50
|
}, end - start);
|
|
77
51
|
};
|
|
78
|
-
|
|
79
52
|
controller.on(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
|
|
80
53
|
return function () {
|
|
81
54
|
controller.off(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
|
|
82
55
|
};
|
|
83
56
|
}, [controller]);
|
|
84
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
className: (0, _classnames["default"])('vreo-prompter',
|
|
58
|
+
className: (0, _classnames["default"])('vreo-prompter', (0, _defineProperty2["default"])({
|
|
86
59
|
'vreo-prompter--hidden': hidden
|
|
87
60
|
}, "vreo-prompter-left--".concat(controller.agentType), true))
|
|
88
61
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,40 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.UpdateVRPanorama = UpdateVRPanorama;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _five = require("@realsee/five");
|
|
13
|
-
|
|
14
10
|
var _hooks = require("../../../hooks");
|
|
15
|
-
|
|
16
11
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
17
|
-
|
|
18
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
14
|
function UpdateVRPanorama() {
|
|
23
15
|
var controller = (0, _hooks.useController)();
|
|
24
16
|
var five = (0, _hooks.useFiveInstance)();
|
|
25
17
|
var deafultWorkRef = React.useRef(null);
|
|
26
|
-
var updateWorkRef = React.useRef(null);
|
|
18
|
+
var updateWorkRef = React.useRef(null);
|
|
27
19
|
|
|
20
|
+
// 恢复默认 VR
|
|
28
21
|
var restoreCallback = React.useCallback(function () {
|
|
29
22
|
// 先清理掉 之前的 VR 数据备份
|
|
30
23
|
updateWorkRef.current = null;
|
|
31
|
-
|
|
32
24
|
if (deafultWorkRef.current) {
|
|
33
25
|
var work = (0, _five.parseWork)(deafultWorkRef.current);
|
|
34
26
|
five.load(work);
|
|
35
27
|
}
|
|
36
|
-
}, []);
|
|
28
|
+
}, []);
|
|
37
29
|
|
|
30
|
+
// 暂停时: 恢复默认 VR
|
|
38
31
|
var pausedCallback = React.useCallback(function () {
|
|
39
32
|
if (deafultWorkRef.current) {
|
|
40
33
|
var work = (0, _five.parseWork)(deafultWorkRef.current);
|
|
@@ -43,33 +36,32 @@ function UpdateVRPanorama() {
|
|
|
43
36
|
});
|
|
44
37
|
five.load(work);
|
|
45
38
|
}
|
|
46
|
-
}, []);
|
|
39
|
+
}, []);
|
|
47
40
|
|
|
41
|
+
// 播放时:如果暂停前有更新 VR 需要还原
|
|
48
42
|
var playingCallback = React.useCallback(function () {
|
|
49
43
|
if (!updateWorkRef.current) {
|
|
50
44
|
return;
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
five.load(updateWorkRef.current);
|
|
54
47
|
}, []);
|
|
55
48
|
React.useEffect(function () {
|
|
56
49
|
var callback = function callback(keyframe) {
|
|
57
50
|
var _five$work;
|
|
58
|
-
|
|
59
51
|
if (!deafultWorkRef.current) {
|
|
60
52
|
deafultWorkRef.current = five.work.raw.works;
|
|
61
53
|
}
|
|
54
|
+
var data = keyframe.data;
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
// 如果数据中有新 work 数据,则直接载入
|
|
65
57
|
if (data.work) {
|
|
66
58
|
updateWorkRef.current = (0, _five.parseWork)(data.work);
|
|
67
59
|
five.load(updateWorkRef.current);
|
|
68
60
|
return;
|
|
69
61
|
}
|
|
62
|
+
var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0];
|
|
70
63
|
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
// 动态场景:不提供完成的签名数据,需重新整理
|
|
73
65
|
if (data.dynamic_scene && !data.panorama) {
|
|
74
66
|
var lastWork = JSON.parse(lastRawWork);
|
|
75
67
|
var panorama = lastWork.panorama;
|
|
@@ -78,7 +70,6 @@ function UpdateVRPanorama() {
|
|
|
78
70
|
data.panorama = panorama;
|
|
79
71
|
delete data.dynamic_scene;
|
|
80
72
|
}
|
|
81
|
-
|
|
82
73
|
Object.assign(window, {
|
|
83
74
|
$work1: JSON.parse(lastRawWork),
|
|
84
75
|
$work2: data,
|
|
@@ -87,15 +78,17 @@ function UpdateVRPanorama() {
|
|
|
87
78
|
updateWorkRef.current = (0, _five.parseWork)([lastRawWork, data]);
|
|
88
79
|
five.load(updateWorkRef.current);
|
|
89
80
|
};
|
|
81
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
|
|
90
82
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback); // 新载入数据 将之前的内容清空
|
|
94
|
-
|
|
95
|
-
controller.on('loaded', restoreCallback); // 暂停 回到默认状态
|
|
83
|
+
// 离开 将之前的内容清空
|
|
84
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback);
|
|
96
85
|
|
|
97
|
-
|
|
86
|
+
// 新载入数据 将之前的内容清空
|
|
87
|
+
controller.on('loaded', restoreCallback);
|
|
98
88
|
|
|
89
|
+
// 暂停 回到默认状态
|
|
90
|
+
controller.on('paused', pausedCallback);
|
|
91
|
+
// 播放 回归暂停前状态
|
|
99
92
|
controller.on('playing', playingCallback);
|
|
100
93
|
return function () {
|
|
101
94
|
// 清理事件监听
|
|
@@ -1,85 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.VideoEffect = VideoEffect;
|
|
9
|
-
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
13
|
var React = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
14
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
15
|
-
|
|
16
15
|
var _hooks = require("../../../hooks");
|
|
17
|
-
|
|
18
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
|
-
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); } }
|
|
25
|
-
|
|
26
|
-
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); }); }; }
|
|
27
|
-
|
|
28
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
-
|
|
30
|
-
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."); }
|
|
31
|
-
|
|
32
|
-
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); }
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
36
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
-
|
|
38
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
// import { Preloader } from '../../../../shared-utils/Preloader'
|
|
39
19
|
|
|
40
20
|
var inlinePlay = function inlinePlay(videoInstance) {
|
|
41
21
|
if (!videoInstance) return;
|
|
42
|
-
|
|
43
22
|
var canplaythrough = function canplaythrough() {
|
|
44
23
|
videoInstance.removeEventListener('canplaythrough', canplaythrough);
|
|
45
|
-
|
|
46
24
|
try {
|
|
47
25
|
videoInstance.play();
|
|
48
26
|
} catch (error) {}
|
|
49
27
|
};
|
|
50
|
-
|
|
51
28
|
videoInstance.addEventListener('canplaythrough', canplaythrough);
|
|
52
29
|
videoInstance.load();
|
|
53
|
-
};
|
|
54
|
-
|
|
30
|
+
};
|
|
55
31
|
|
|
32
|
+
// const emptyVideo = '//vrlab-static.ljcdn.com/release/web/leisure.69fd3522.mov'
|
|
56
33
|
var PI = Math.PI;
|
|
57
34
|
var PI_2 = PI * 2;
|
|
58
|
-
|
|
59
35
|
function VideoEffect() {
|
|
60
36
|
var ref = React.useRef(null);
|
|
61
37
|
var videoRef = React.useRef();
|
|
62
38
|
var controller = (0, _hooks.useController)();
|
|
63
39
|
var timeoutRef = React.useRef();
|
|
64
|
-
|
|
65
40
|
var _React$useState = React.useState(false),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
41
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
42
|
+
visible = _React$useState2[0],
|
|
43
|
+
setVisible = _React$useState2[1];
|
|
70
44
|
var five = (0, _hooks.useFiveInstance)();
|
|
71
|
-
|
|
72
45
|
var setBlobSrc = function setBlobSrc(blob) {
|
|
73
46
|
if (!videoRef.current) return;
|
|
74
47
|
videoRef.current.src = blob;
|
|
75
48
|
};
|
|
76
|
-
|
|
77
49
|
React.useEffect(function () {
|
|
78
50
|
var callback = /*#__PURE__*/function () {
|
|
79
|
-
var _ref =
|
|
51
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyframe) {
|
|
80
52
|
var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude;
|
|
81
|
-
|
|
82
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
53
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
83
54
|
while (1) {
|
|
84
55
|
switch (_context.prev = _context.next) {
|
|
85
56
|
case 0:
|
|
@@ -89,16 +60,14 @@ function VideoEffect() {
|
|
|
89
60
|
if (vector) {
|
|
90
61
|
return [vector.longitude, vector.latitude];
|
|
91
62
|
}
|
|
92
|
-
|
|
93
63
|
if (!direction) {
|
|
94
64
|
return [0, 0];
|
|
95
65
|
}
|
|
96
|
-
|
|
97
66
|
var longitude = -Math.atan2(direction.x, -direction.z);
|
|
98
67
|
longitude = (longitude % PI_2 + PI_2) % PI_2;
|
|
99
68
|
var latitude = -Math.asin(direction.y / 1);
|
|
100
69
|
return [longitude, latitude];
|
|
101
|
-
}(), _ref4 =
|
|
70
|
+
}(), _ref4 = (0, _slicedToArray2["default"])(_ref3, 2), longitude = _ref4[0], latitude = _ref4[1];
|
|
102
71
|
five.setState({
|
|
103
72
|
fov: fov,
|
|
104
73
|
panoIndex: panoIndex,
|
|
@@ -110,12 +79,10 @@ function VideoEffect() {
|
|
|
110
79
|
setVisible(true);
|
|
111
80
|
timeoutRef.current = setTimeout(function () {
|
|
112
81
|
var _videoRef$current;
|
|
113
|
-
|
|
114
82
|
(_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 ? void 0 : _videoRef$current.pause();
|
|
115
83
|
setVisible(false);
|
|
116
84
|
setBlobSrc('');
|
|
117
85
|
}, end - start);
|
|
118
|
-
|
|
119
86
|
case 8:
|
|
120
87
|
case "end":
|
|
121
88
|
return _context.stop();
|
|
@@ -123,26 +90,20 @@ function VideoEffect() {
|
|
|
123
90
|
}
|
|
124
91
|
}, _callee);
|
|
125
92
|
}));
|
|
126
|
-
|
|
127
93
|
return function callback(_x) {
|
|
128
94
|
return _ref.apply(this, arguments);
|
|
129
95
|
};
|
|
130
96
|
}();
|
|
131
|
-
|
|
132
97
|
controller.on(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
|
|
133
|
-
|
|
134
98
|
var destroy = function destroy() {
|
|
135
99
|
var _videoRef$current2;
|
|
136
|
-
|
|
137
100
|
if (timeoutRef.current) {
|
|
138
101
|
clearTimeout(timeoutRef.current);
|
|
139
102
|
}
|
|
140
|
-
|
|
141
103
|
(_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 ? void 0 : _videoRef$current2.pause();
|
|
142
104
|
setVisible(false);
|
|
143
105
|
setBlobSrc('');
|
|
144
106
|
};
|
|
145
|
-
|
|
146
107
|
controller.on('paused', function () {
|
|
147
108
|
return destroy();
|
|
148
109
|
});
|
|
@@ -151,7 +112,6 @@ function VideoEffect() {
|
|
|
151
112
|
});
|
|
152
113
|
return function () {
|
|
153
114
|
controller.off(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
|
|
154
|
-
|
|
155
115
|
if (timeoutRef.current) {
|
|
156
116
|
clearTimeout(timeoutRef.current);
|
|
157
117
|
}
|
|
@@ -159,10 +119,9 @@ function VideoEffect() {
|
|
|
159
119
|
}, [controller]);
|
|
160
120
|
React.useEffect(function () {
|
|
161
121
|
var _controller$configs, _controller$configs$v;
|
|
162
|
-
|
|
163
122
|
if (!ref.current) return;
|
|
164
|
-
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.videoEffect) || document.createElement('video');
|
|
165
|
-
|
|
123
|
+
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.videoEffect) || document.createElement('video');
|
|
124
|
+
// <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
|
|
166
125
|
video.setAttribute('playsinline', 'true');
|
|
167
126
|
video.setAttribute('webkit-playsinline', 'true');
|
|
168
127
|
video.setAttribute('autoplay', 'true');
|
|
@@ -172,10 +131,10 @@ function VideoEffect() {
|
|
|
172
131
|
ref.current.append(videoRef.current);
|
|
173
132
|
document.addEventListener('WeixinJSBridgeReady', function () {
|
|
174
133
|
var _videoRef$current3;
|
|
175
|
-
|
|
176
134
|
(_videoRef$current3 = videoRef.current) === null || _videoRef$current3 === void 0 ? void 0 : _videoRef$current3.play();
|
|
177
135
|
}, false);
|
|
178
|
-
if (!ref.current) return;
|
|
136
|
+
if (!ref.current) return;
|
|
137
|
+
// const asyncfunc = async () => {
|
|
179
138
|
// setBlobSrc(await URL.createObjectURL(await Preloader.blob(emptyVideo)))
|
|
180
139
|
// inlinePlay(videoRef.current)
|
|
181
140
|
// }
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = centerPoint;
|
|
7
|
-
|
|
8
7
|
var _three = require("three");
|
|
9
|
-
|
|
10
8
|
function centerPoint(point1, point2) {
|
|
11
9
|
return new _three.Vector3((point1.x + point2.x) / 2, (point1.y + point2.y) / 2, (point1.z + point2.z) / 2);
|
|
12
10
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = evenNumber;
|
|
7
|
-
|
|
8
7
|
function evenNumber(num, config) {
|
|
9
8
|
var roundNum = Math.round(num);
|
|
10
9
|
return roundNum % 2 === 0 ? roundNum : roundNum + Number(config !== null && config !== void 0 && config.smaller ? -1 : 1);
|