@realsee/vreo 2.2.5 → 2.2.7
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 +11 -6
- package/lib/PlayController/index.js +80 -15
- package/lib/Player/App.js +26 -0
- package/lib/Player/Controller.js +100 -23
- package/lib/Player/custom/SpatialScenePanel/index.js +68 -42
- package/lib/Player/hooks.js +10 -0
- package/lib/Player/index.js +88 -24
- package/lib/Player/modules/Drawer/index.js +17 -0
- package/lib/Player/modules/PopUp/index.js +10 -0
- package/lib/Player/modules/ResizeObserver/index.js +8 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +108 -17
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +24 -2
- package/lib/Player/modules/VideoAgent/index.js +17 -0
- package/lib/Player/modules/Wave/index.js +32 -7
- package/lib/Player/modules/keyframes/BgMusic/index.js +25 -7
- package/lib/Player/modules/keyframes/CameraMovement/index.js +27 -3
- package/lib/Player/modules/keyframes/InfoPanel/index.js +29 -6
- package/lib/Player/modules/keyframes/ModelVideo/index.js +29 -3
- package/lib/Player/modules/keyframes/PanoEffect/index.js +43 -15
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +7 -0
- package/lib/Player/modules/keyframes/PanoTag/index.js +22 -4
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +47 -22
- package/lib/Player/modules/keyframes/Prompter/index.js +32 -10
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -18
- package/lib/Player/modules/keyframes/VideoEffect/index.js +65 -16
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +2 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +60 -19
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +5 -2
- package/lib/fivePlugins/CameraMovementPlugin/index.js +73 -20
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +4 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +60 -11
- package/lib/index.js +1 -0
- package/lib/react/index.js +34 -7
- package/lib/shared-utils/Audio.js +69 -15
- package/lib/shared-utils/AudioLike.js +39 -5
- package/lib/shared-utils/Preloader.js +7 -0
- package/lib/shared-utils/addResizeListener.js +5 -0
- package/lib/shared-utils/animationFrame/BetterTween.js +38 -2
- package/lib/shared-utils/animationFrame/index.js +10 -2
- package/lib/shared-utils/animationFrame/tween.js +11 -2
- package/lib/shared-utils/createTransMatrix.js +17 -2
- package/lib/shared-utils/getFileExpandedName.js +1 -0
- package/lib/shared-utils/getMediaInfo.js +9 -0
- package/lib/shared-utils/setElementDataset.js +2 -0
- package/lib/typings/VreoUnit.js +15 -0
- package/package.json +4 -2
|
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = tween;
|
|
7
7
|
exports.tweenProgress = tweenProgress;
|
|
8
|
+
|
|
8
9
|
var _tween = require("@tweenjs/tween.js");
|
|
10
|
+
|
|
9
11
|
var _index = require("./index");
|
|
12
|
+
|
|
10
13
|
/**
|
|
11
14
|
* 对象变化的补间动画
|
|
12
15
|
* 1. 应用 requestAnimationFrameInterval 做 update
|
|
@@ -19,8 +22,8 @@ var _index = require("./index");
|
|
|
19
22
|
*/
|
|
20
23
|
function tween(from, to, duration) {
|
|
21
24
|
var easing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _tween.Easing.Linear.None;
|
|
22
|
-
var tween = new _tween.Tween(from).to(to, duration).easing(easing);
|
|
23
|
-
|
|
25
|
+
var tween = new _tween.Tween(from).to(to, duration).easing(easing); // 这里注意一下,因为 requestAnimationFrameInterval 给的时间是从 0 开始的,tween 动画也从 0 开始
|
|
26
|
+
|
|
24
27
|
(0, _index.nextFrame)(function () {
|
|
25
28
|
return tween.start(0);
|
|
26
29
|
});
|
|
@@ -28,10 +31,12 @@ function tween(from, to, duration) {
|
|
|
28
31
|
if (tween.update(time) === false) cancelAnimationFrame();
|
|
29
32
|
});
|
|
30
33
|
var destroyMethods = [];
|
|
34
|
+
|
|
31
35
|
tween.onDestroy = function (fn) {
|
|
32
36
|
destroyMethods.push(fn);
|
|
33
37
|
return tween;
|
|
34
38
|
};
|
|
39
|
+
|
|
35
40
|
tween.destroy = function () {
|
|
36
41
|
this.stop();
|
|
37
42
|
Object.assign(tween, {
|
|
@@ -41,13 +46,17 @@ function tween(from, to, duration) {
|
|
|
41
46
|
_onStopCallbackL: null
|
|
42
47
|
});
|
|
43
48
|
var destroyMethod;
|
|
49
|
+
|
|
44
50
|
while (destroyMethod = destroyMethods.shift()) {
|
|
45
51
|
destroyMethod();
|
|
46
52
|
}
|
|
53
|
+
|
|
47
54
|
cancelAnimationFrame();
|
|
48
55
|
};
|
|
56
|
+
|
|
49
57
|
return tween;
|
|
50
58
|
}
|
|
59
|
+
|
|
51
60
|
function tweenProgress(duration, easing) {
|
|
52
61
|
return tween({
|
|
53
62
|
progress: 0
|
|
@@ -1,27 +1,42 @@
|
|
|
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
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.createTransMatrix = createTransMatrix;
|
|
9
|
+
|
|
8
10
|
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
9
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); }
|
|
13
|
+
|
|
10
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; }
|
|
11
|
-
|
|
15
|
+
|
|
16
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
17
|
+
|
|
12
18
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
|
|
19
|
+
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
+
|
|
14
22
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
+
|
|
15
24
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
|
|
16
26
|
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); }
|
|
27
|
+
|
|
17
28
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
+
|
|
18
30
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
31
|
+
|
|
19
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
|
+
|
|
20
34
|
function createTransMatrix(arr1) {
|
|
21
35
|
var matrix4 = new THREE.Matrix4();
|
|
22
36
|
matrix4.fromArray(arr1);
|
|
23
37
|
return function (arr2) {
|
|
24
38
|
var vector3 = _construct(THREE.Vector3, _toConsumableArray(arr2));
|
|
39
|
+
|
|
25
40
|
vector3.applyMatrix4(matrix4);
|
|
26
41
|
return vector3.toArray();
|
|
27
42
|
};
|
|
@@ -8,17 +8,22 @@ exports.getFileName = getFileName;
|
|
|
8
8
|
exports.getMediaType = getMediaType;
|
|
9
9
|
exports.getMediaTypeByExpandedName = getMediaTypeByExpandedName;
|
|
10
10
|
exports.getMediaTypeByUrl = getMediaTypeByUrl;
|
|
11
|
+
|
|
11
12
|
var _getFileExpandedName = _interopRequireDefault(require("./getFileExpandedName"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
13
16
|
function getMediaInfo(fileUrl) {
|
|
14
17
|
var type = getMediaType(fileUrl);
|
|
15
18
|
if (!type) return Promise.resolve({
|
|
16
19
|
error: '未知的文件类型: ' + fileUrl
|
|
17
20
|
});
|
|
21
|
+
|
|
18
22
|
var mediaElement = function () {
|
|
19
23
|
if (type === 'video') return document.createElement('video');
|
|
20
24
|
if (type === 'audio') return document.createElement('audio');
|
|
21
25
|
}();
|
|
26
|
+
|
|
22
27
|
if (!mediaElement) return Promise.resolve({
|
|
23
28
|
error: 'Unknown media element'
|
|
24
29
|
});
|
|
@@ -29,6 +34,7 @@ function getMediaInfo(fileUrl) {
|
|
|
29
34
|
error: 'onerror'
|
|
30
35
|
});
|
|
31
36
|
};
|
|
37
|
+
|
|
32
38
|
mediaElement.onloadedmetadata = function () {
|
|
33
39
|
resolve({
|
|
34
40
|
duration: mediaElement.duration * 1000,
|
|
@@ -43,6 +49,7 @@ function getMediaType(url) {
|
|
|
43
49
|
var type = getMediaTypeByExpandedName(fileExpandedName);
|
|
44
50
|
return type;
|
|
45
51
|
}
|
|
52
|
+
|
|
46
53
|
function getMediaTypeByExpandedName(fileExpandedName) {
|
|
47
54
|
if (!fileExpandedName) return 'unknown';
|
|
48
55
|
if (/jpg|jpeg|png$/.test(fileExpandedName)) return 'image';
|
|
@@ -50,11 +57,13 @@ function getMediaTypeByExpandedName(fileExpandedName) {
|
|
|
50
57
|
if (/avi|wmv|mpeg|mp4|m4v|mov|asf|flv|f4v|rmvb|rm|3gp|vob$/.test(fileExpandedName)) return 'video';
|
|
51
58
|
return 'unknown';
|
|
52
59
|
}
|
|
60
|
+
|
|
53
61
|
function getMediaTypeByUrl(fileUrl) {
|
|
54
62
|
if (!fileUrl) return;
|
|
55
63
|
var fileExpandedName = (0, _getFileExpandedName["default"])(fileUrl);
|
|
56
64
|
return getMediaTypeByExpandedName(fileExpandedName);
|
|
57
65
|
}
|
|
66
|
+
|
|
58
67
|
function getFileName(fileUrl) {
|
|
59
68
|
if (!fileUrl) return '';
|
|
60
69
|
var index1 = fileUrl.lastIndexOf('/');
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = setElementDataset;
|
|
7
|
+
|
|
7
8
|
function setElementDataset(element, dataset) {
|
|
8
9
|
if (element) {
|
|
9
10
|
Object.keys(dataset).forEach(function (key) {
|
|
10
11
|
var value = dataset[key].toString();
|
|
12
|
+
|
|
11
13
|
if (element instanceof Element) {
|
|
12
14
|
element.setAttribute("data-".concat(key), value);
|
|
13
15
|
} else if (element instanceof Document) {
|
package/lib/typings/VreoUnit.js
CHANGED
|
@@ -8,7 +8,9 @@ var VreoKeyframeEnum;
|
|
|
8
8
|
/**
|
|
9
9
|
* 支持自定义剧本关键帧配置项
|
|
10
10
|
*/
|
|
11
|
+
|
|
11
12
|
exports.VreoKeyframeEnum = VreoKeyframeEnum;
|
|
13
|
+
|
|
12
14
|
(function (VreoKeyframeEnum) {
|
|
13
15
|
VreoKeyframeEnum["CameraMovement"] = "CameraMovement";
|
|
14
16
|
VreoKeyframeEnum["PanoTag"] = "PanoTag";
|
|
@@ -23,6 +25,7 @@ exports.VreoKeyframeEnum = VreoKeyframeEnum;
|
|
|
23
25
|
VreoKeyframeEnum["Exit"] = "Exit";
|
|
24
26
|
VreoKeyframeEnum["Custom"] = "Custom";
|
|
25
27
|
})(VreoKeyframeEnum || (exports.VreoKeyframeEnum = VreoKeyframeEnum = {}));
|
|
28
|
+
|
|
26
29
|
/**
|
|
27
30
|
* 全景标签枚举
|
|
28
31
|
*/
|
|
@@ -30,17 +33,22 @@ var PanoTagEnum;
|
|
|
30
33
|
/**
|
|
31
34
|
* 标签样式种类
|
|
32
35
|
*/
|
|
36
|
+
|
|
33
37
|
exports.PanoTagEnum = PanoTagEnum;
|
|
38
|
+
|
|
34
39
|
(function (PanoTagEnum) {
|
|
35
40
|
PanoTagEnum["Text"] = "Text";
|
|
36
41
|
PanoTagEnum["Image"] = "Image";
|
|
37
42
|
})(PanoTagEnum || (exports.PanoTagEnum = PanoTagEnum = {}));
|
|
43
|
+
|
|
38
44
|
var PanoTagStyleEnum;
|
|
39
45
|
exports.PanoTagStyleEnum = PanoTagStyleEnum;
|
|
46
|
+
|
|
40
47
|
(function (PanoTagStyleEnum) {
|
|
41
48
|
PanoTagStyleEnum["Growth"] = "Growth";
|
|
42
49
|
PanoTagStyleEnum["Expand"] = "Expand";
|
|
43
50
|
})(PanoTagStyleEnum || (exports.PanoTagStyleEnum = PanoTagStyleEnum = {}));
|
|
51
|
+
|
|
44
52
|
/**
|
|
45
53
|
* 全景特效枚举
|
|
46
54
|
*/
|
|
@@ -48,24 +56,31 @@ var PanoEffectEnum;
|
|
|
48
56
|
/**
|
|
49
57
|
* 全景特效
|
|
50
58
|
*/
|
|
59
|
+
|
|
51
60
|
exports.PanoEffectEnum = PanoEffectEnum;
|
|
61
|
+
|
|
52
62
|
(function (PanoEffectEnum) {
|
|
53
63
|
PanoEffectEnum["Distance"] = "Distance";
|
|
54
64
|
})(PanoEffectEnum || (exports.PanoEffectEnum = PanoEffectEnum = {}));
|
|
65
|
+
|
|
55
66
|
/**
|
|
56
67
|
* 信息面板类型枚举
|
|
57
68
|
*/
|
|
58
69
|
var InfoPanelTypeEnum;
|
|
59
70
|
exports.InfoPanelTypeEnum = InfoPanelTypeEnum;
|
|
71
|
+
|
|
60
72
|
(function (InfoPanelTypeEnum) {
|
|
61
73
|
InfoPanelTypeEnum["Image"] = "Image";
|
|
62
74
|
InfoPanelTypeEnum["Video"] = "Video";
|
|
63
75
|
})(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
|
|
76
|
+
|
|
64
77
|
var InfoPanelStyleEnum;
|
|
65
78
|
/**
|
|
66
79
|
* 信息面板
|
|
67
80
|
*/
|
|
81
|
+
|
|
68
82
|
exports.InfoPanelStyleEnum = InfoPanelStyleEnum;
|
|
83
|
+
|
|
69
84
|
(function (InfoPanelStyleEnum) {
|
|
70
85
|
InfoPanelStyleEnum["Drawer"] = "Drawer";
|
|
71
86
|
InfoPanelStyleEnum["PopUp"] = "PopUp";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/vreo",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"realsee",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"build": "tsc && vite build",
|
|
22
22
|
"preview": "vite preview",
|
|
23
23
|
"docs": "npx typedoc && yarn run build",
|
|
24
|
-
"packages": "node ./dev-tools/build-packages.js"
|
|
24
|
+
"packages": "node ./dev-tools/build-packages.js",
|
|
25
|
+
"postpublish": "cnpm sync @realsee/vreo"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
28
|
"@realsee/five": "^5.0.0",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"@types/react-dom": "^17.0.11",
|
|
47
48
|
"@types/react-transition-group": "^4.4.4",
|
|
48
49
|
"@vitejs/plugin-react": "^1.1.0",
|
|
50
|
+
"cnpm": "^9.2.0",
|
|
49
51
|
"del": "^6.0.0",
|
|
50
52
|
"react": "^16.0.0",
|
|
51
53
|
"react-dom": "^16.0.0",
|