@realsee/vreo 1.2.1-alpha.0 → 1.2.1-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 +6 -11
- package/lib/PlayController/index.js +15 -80
- package/lib/Player/App.js +0 -26
- package/lib/Player/Controller.js +23 -100
- package/lib/Player/custom/SpatialScenePanel/index.js +42 -68
- package/lib/Player/hooks.js +0 -10
- package/lib/Player/index.js +24 -86
- package/lib/Player/modules/Drawer/index.js +0 -17
- package/lib/Player/modules/PopUp/index.js +0 -10
- package/lib/Player/modules/ResizeObserver/index.js +0 -8
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +17 -108
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -24
- package/lib/Player/modules/VideoAgent/index.js +0 -17
- package/lib/Player/modules/Wave/index.js +7 -32
- package/lib/Player/modules/keyframes/BgMusic/index.js +7 -23
- package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
- package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -29
- package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
- package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
- package/lib/Player/modules/keyframes/PanoTag/index.js +9 -20
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -47
- package/lib/Player/modules/keyframes/Prompter/index.js +10 -32
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
- package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
- 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 +19 -60
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
- package/lib/fivePlugins/CameraMovementPlugin/index.js +28 -76
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
- package/lib/index.js +0 -1
- package/lib/react/index.js +7 -34
- package/lib/shared-utils/Audio.js +15 -69
- package/lib/shared-utils/AudioLike.js +5 -39
- package/lib/shared-utils/Preloader.js +0 -7
- package/lib/shared-utils/addResizeListener.js +0 -5
- package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
- package/lib/shared-utils/animationFrame/index.js +2 -10
- package/lib/shared-utils/animationFrame/tween.js +2 -11
- package/lib/shared-utils/createTransMatrix.js +2 -17
- package/lib/shared-utils/getFileExpandedName.js +0 -1
- package/lib/shared-utils/getMediaInfo.js +0 -9
- package/lib/shared-utils/setElementDataset.js +0 -2
- package/lib/typings/VreoUnit.js +0 -15
- package/package.json +2 -2
|
@@ -1,81 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Prompter = Prompter;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _hooks = require("../../../hooks");
|
|
15
|
-
|
|
16
11
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
13
|
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
14
|
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
15
|
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
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
-
|
|
28
17
|
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
18
|
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
19
|
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
20
|
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
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
-
|
|
38
22
|
function Prompter() {
|
|
39
23
|
var _React$useState = React.useState(''),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
24
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
25
|
+
text = _React$useState2[0],
|
|
26
|
+
setText = _React$useState2[1];
|
|
44
27
|
var _React$useState3 = React.useState(true),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
29
|
+
hidden = _React$useState4[0],
|
|
30
|
+
setHidden = _React$useState4[1];
|
|
49
31
|
var ref = React.useRef(null);
|
|
50
32
|
var controller = (0, _hooks.useController)();
|
|
51
33
|
React.useEffect(function () {
|
|
52
34
|
var _controller$configs;
|
|
53
|
-
|
|
54
35
|
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
|
|
55
36
|
return;
|
|
56
37
|
}
|
|
57
|
-
|
|
58
38
|
var callback = function callback(keyframe) {
|
|
59
39
|
var start = keyframe.start,
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
end = keyframe.end,
|
|
41
|
+
data = keyframe.data;
|
|
62
42
|
setText(data.text);
|
|
63
43
|
setHidden(false);
|
|
64
|
-
|
|
65
44
|
if (ref.current) {
|
|
66
45
|
clearTimeout(ref.current);
|
|
67
46
|
ref.current = null;
|
|
68
47
|
}
|
|
69
|
-
|
|
70
48
|
ref.current = setTimeout(function () {
|
|
71
49
|
setHidden(true);
|
|
72
|
-
setText('');
|
|
50
|
+
setText('');
|
|
51
|
+
// setTimeout(() => setText(''), 500)
|
|
73
52
|
|
|
74
53
|
if (ref.current) clearTimeout(ref.current);
|
|
75
54
|
ref.current = null;
|
|
76
55
|
}, end - start);
|
|
77
56
|
};
|
|
78
|
-
|
|
79
57
|
controller.on(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
|
|
80
58
|
return function () {
|
|
81
59
|
controller.off(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
|
|
@@ -1,40 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
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,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.VideoEffect = VideoEffect;
|
|
9
|
-
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
9
|
var React = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
15
|
-
|
|
16
11
|
var _hooks = require("../../../hooks");
|
|
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
15
|
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
24
16
|
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
17
|
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
18
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
-
|
|
30
19
|
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
20
|
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
21
|
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
22
|
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
23
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
-
|
|
40
24
|
var inlinePlay = function inlinePlay(videoInstance) {
|
|
41
25
|
if (!videoInstance) return;
|
|
42
|
-
|
|
43
26
|
var canplaythrough = function canplaythrough() {
|
|
44
27
|
videoInstance.removeEventListener('canplaythrough', canplaythrough);
|
|
45
|
-
|
|
46
28
|
try {
|
|
47
29
|
videoInstance.play();
|
|
48
30
|
} catch (error) {}
|
|
49
31
|
};
|
|
50
|
-
|
|
51
32
|
videoInstance.addEventListener('canplaythrough', canplaythrough);
|
|
52
33
|
videoInstance.load();
|
|
53
|
-
};
|
|
54
|
-
|
|
34
|
+
};
|
|
55
35
|
|
|
36
|
+
// const emptyVideo = '//vrlab-static.ljcdn.com/release/web/leisure.69fd3522.mov'
|
|
56
37
|
var PI = Math.PI;
|
|
57
38
|
var PI_2 = PI * 2;
|
|
58
|
-
|
|
59
39
|
function VideoEffect() {
|
|
60
40
|
var ref = React.useRef(null);
|
|
61
41
|
var videoRef = React.useRef();
|
|
62
42
|
var controller = (0, _hooks.useController)();
|
|
63
43
|
var timeoutRef = React.useRef();
|
|
64
|
-
|
|
65
44
|
var _React$useState = React.useState(false),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
45
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
46
|
+
visible = _React$useState2[0],
|
|
47
|
+
setVisible = _React$useState2[1];
|
|
70
48
|
var five = (0, _hooks.useFiveInstance)();
|
|
71
|
-
|
|
72
49
|
var setBlobSrc = function setBlobSrc(blob) {
|
|
73
50
|
if (!videoRef.current) return;
|
|
74
51
|
videoRef.current.src = blob;
|
|
75
52
|
};
|
|
76
|
-
|
|
77
53
|
React.useEffect(function () {
|
|
78
54
|
var callback = /*#__PURE__*/function () {
|
|
79
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
55
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe) {
|
|
80
56
|
var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude;
|
|
81
|
-
|
|
82
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
57
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
83
58
|
while (1) {
|
|
84
59
|
switch (_context.prev = _context.next) {
|
|
85
60
|
case 0:
|
|
@@ -89,11 +64,9 @@ function VideoEffect() {
|
|
|
89
64
|
if (vector) {
|
|
90
65
|
return [vector.longitude, vector.latitude];
|
|
91
66
|
}
|
|
92
|
-
|
|
93
67
|
if (!direction) {
|
|
94
68
|
return [0, 0];
|
|
95
69
|
}
|
|
96
|
-
|
|
97
70
|
var longitude = -Math.atan2(direction.x, -direction.z);
|
|
98
71
|
longitude = (longitude % PI_2 + PI_2) % PI_2;
|
|
99
72
|
var latitude = -Math.asin(direction.y / 1);
|
|
@@ -110,17 +83,13 @@ function VideoEffect() {
|
|
|
110
83
|
setVisible(true);
|
|
111
84
|
timeoutRef.current = setTimeout(function () {
|
|
112
85
|
var _videoRef$current;
|
|
113
|
-
|
|
114
86
|
if (!((_videoRef$current = videoRef.current) !== null && _videoRef$current !== void 0 && _videoRef$current.paused)) {
|
|
115
87
|
var _videoRef$current2;
|
|
116
|
-
|
|
117
88
|
(_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 ? void 0 : _videoRef$current2.pause();
|
|
118
89
|
}
|
|
119
|
-
|
|
120
90
|
setVisible(false);
|
|
121
91
|
setBlobSrc('');
|
|
122
92
|
}, end - start);
|
|
123
|
-
|
|
124
93
|
case 8:
|
|
125
94
|
case "end":
|
|
126
95
|
return _context.stop();
|
|
@@ -128,16 +97,13 @@ function VideoEffect() {
|
|
|
128
97
|
}
|
|
129
98
|
}, _callee);
|
|
130
99
|
}));
|
|
131
|
-
|
|
132
100
|
return function callback(_x) {
|
|
133
101
|
return _ref.apply(this, arguments);
|
|
134
102
|
};
|
|
135
103
|
}();
|
|
136
|
-
|
|
137
104
|
controller.on(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
|
|
138
105
|
return function () {
|
|
139
106
|
controller.off(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
|
|
140
|
-
|
|
141
107
|
if (timeoutRef.current) {
|
|
142
108
|
clearTimeout(timeoutRef.current);
|
|
143
109
|
}
|
|
@@ -145,10 +111,9 @@ function VideoEffect() {
|
|
|
145
111
|
}, [controller]);
|
|
146
112
|
React.useEffect(function () {
|
|
147
113
|
var _controller$configs, _controller$configs$v;
|
|
148
|
-
|
|
149
114
|
if (!ref.current) return;
|
|
150
|
-
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');
|
|
151
|
-
|
|
115
|
+
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');
|
|
116
|
+
// <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
|
|
152
117
|
video.setAttribute('playsinline', 'true');
|
|
153
118
|
video.setAttribute('webkit-playsinline', 'true');
|
|
154
119
|
video.setAttribute('autoplay', 'true');
|
|
@@ -158,10 +123,10 @@ function VideoEffect() {
|
|
|
158
123
|
ref.current.append(videoRef.current);
|
|
159
124
|
document.addEventListener('WeixinJSBridgeReady', function () {
|
|
160
125
|
var _videoRef$current3;
|
|
161
|
-
|
|
162
126
|
(_videoRef$current3 = videoRef.current) === null || _videoRef$current3 === void 0 ? void 0 : _videoRef$current3.play();
|
|
163
127
|
}, false);
|
|
164
|
-
if (!ref.current) return;
|
|
128
|
+
if (!ref.current) return;
|
|
129
|
+
// const asyncfunc = async () => {
|
|
165
130
|
// setBlobSrc(await URL.createObjectURL(await Preloader.blob(emptyVideo)))
|
|
166
131
|
// inlinePlay(videoRef.current)
|
|
167
132
|
// }
|
|
@@ -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);
|