@realsee/vreo 0.2.0-alpha.9 → 1.0.0-alpha.10
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/CHANGELOG.md +30 -0
- package/README.md +16 -5
- package/docs/assets/highlight.css +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +28 -2
- package/docs/classes/Player.AudioLike.html +52 -0
- package/docs/classes/Player.Controller.html +13 -13
- package/docs/classes/Player.Player-1.html +11 -11
- package/docs/classes/Player.VideoAgentMesh.html +53 -53
- package/docs/classes/Player.VideoAgentScene.html +1 -1
- package/docs/demo/assets/AppReact.ea8cbdb3.js +1 -0
- package/docs/demo/assets/default.1dd2b2d4.js +3988 -0
- package/docs/demo/assets/default.bc4c715d.css +1 -0
- package/docs/demo/assets/dynamic.cd7d1da6.js +1 -0
- package/docs/demo/assets/examples.98aaf9e2.js +25 -0
- package/docs/demo/assets/examples.dac4a6fe.css +1 -0
- package/docs/demo/assets/index.9331038f.css +1 -0
- package/docs/demo/assets/index.a3d7bd8a.js +1 -0
- package/docs/demo/assets/main.f0c47cae.js +1 -0
- package/docs/demo/assets/react.2ee8565f.css +1 -0
- package/docs/demo/assets/react.5f3bcfc5.js +25 -0
- package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +1 -0
- package/docs/demo/examples.html +17 -0
- package/docs/demo/index-react-dynamic.html +20 -0
- package/docs/demo/index-react.html +20 -0
- package/docs/demo/index.html +19 -0
- package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
- package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
- package/docs/enums/Player.PanoEffectEnum.html +2 -2
- package/docs/enums/Player.PanoTagEnum.html +2 -2
- package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
- package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
- package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
- package/docs/enums/fivePlugins.Rotation.html +1 -1
- package/docs/index.html +13 -6
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
- package/docs/interfaces/Player.PlayerConfigs.html +4 -3
- package/docs/interfaces/Player.Vertex.html +2 -2
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +8 -1
- package/docs/interfaces/Player.VreoKeyframe.html +2 -2
- package/docs/interfaces/Player.VreoUnit.html +2 -2
- package/docs/interfaces/Player.VreoVideo.html +2 -2
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +4 -0
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/fivePlugins.Vector3Position.html +3 -0
- package/docs/interfaces/react.VreoActionCallbacks.html +15 -7
- package/docs/interfaces/react.VreoProviderProps.html +1 -1
- package/docs/modules/Player.html +21 -15
- package/docs/modules/custom.html +1 -1
- package/docs/modules/fivePlugins.html +5 -2
- package/docs/modules/react.html +1 -1
- package/docs/modules.html +1 -1
- package/lib/PlayController/createHTMLAudioElement.js +6 -11
- package/lib/PlayController/index.js +19 -85
- package/lib/Player/App.js +7 -29
- package/lib/Player/Controller.d.ts +29 -8
- package/lib/Player/Controller.js +185 -87
- package/lib/Player/custom/SpatialScenePanel/index.js +47 -72
- package/lib/Player/hooks.js +2 -12
- package/lib/Player/index.d.ts +5 -3
- package/lib/Player/index.js +108 -122
- package/lib/Player/modules/Drawer/index.js +1 -18
- package/lib/Player/modules/PopUp/index.js +1 -11
- package/lib/Player/modules/ResizeObserver/index.d.ts +2 -0
- package/lib/Player/modules/ResizeObserver/index.js +29 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +16 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +124 -145
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +3 -6
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +25 -52
- package/lib/Player/modules/VideoAgent/index.js +46 -22
- package/lib/Player/modules/Wave/index.d.ts +5 -0
- package/lib/Player/modules/Wave/index.js +77 -0
- package/lib/Player/modules/keyframes/BgMusic/index.js +3 -16
- package/lib/Player/modules/keyframes/CameraMovement/index.js +4 -28
- package/lib/Player/modules/keyframes/InfoPanel/index.js +30 -35
- package/lib/Player/modules/keyframes/ModelVideo/index.js +40 -29
- package/lib/Player/modules/keyframes/PanoEffect/index.js +16 -44
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -8
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -2
- package/lib/Player/modules/keyframes/PanoTag/index.js +75 -132
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +3 -0
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +93 -66
- package/lib/Player/modules/keyframes/Prompter/index.js +18 -53
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +22 -25
- package/lib/Player/modules/keyframes/VideoEffect/index.js +13 -48
- package/lib/Player/typings.d.ts +12 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +10 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +7 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +31 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +3 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +10 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +56 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +234 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +7 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +15 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.js +36 -82
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +12 -61
- package/lib/index.js +0 -1
- package/lib/react/index.d.ts +8 -4
- package/lib/react/index.js +10 -37
- package/lib/shared-utils/AduioLike.d.ts +37 -0
- package/lib/shared-utils/AduioLike.js +132 -0
- package/lib/shared-utils/Preloader.js +0 -7
- package/lib/shared-utils/addResizeListener.d.ts +4 -0
- package/lib/shared-utils/addResizeListener.js +46 -0
- package/lib/shared-utils/animationFrame/BetterTween.js +7 -39
- package/lib/shared-utils/animationFrame/index.js +2 -10
- package/lib/shared-utils/animationFrame/tween.js +3 -16
- package/lib/shared-utils/createTransMatrix.d.ts +1 -0
- package/lib/shared-utils/createTransMatrix.js +28 -0
- package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
- package/lib/shared-utils/getFileExpandedName.js +12 -0
- package/lib/shared-utils/getMediaInfo.d.ts +9 -0
- package/lib/shared-utils/getMediaInfo.js +66 -0
- package/lib/shared-utils/setElementDataset.d.ts +1 -0
- package/lib/shared-utils/setElementDataset.js +22 -0
- package/lib/typings/VreoUnit.d.ts +37 -2
- package/lib/typings/VreoUnit.js +10 -13
- package/package.json +10 -10
- package/resources/PlayController/index.ts +0 -13
- package/resources/Player/App.tsx +5 -4
- package/resources/Player/Controller.ts +274 -146
- package/resources/Player/custom/SpatialScenePanel/index.tsx +5 -5
- package/resources/Player/hooks.ts +3 -5
- package/resources/Player/index.tsx +190 -140
- package/resources/Player/modules/ResizeObserver/index.tsx +23 -0
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +87 -31
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +27 -24
- package/resources/Player/modules/VideoAgent/index.tsx +28 -12
- package/resources/Player/modules/Wave/index.tsx +64 -0
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +26 -11
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +52 -97
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +86 -34
- package/resources/Player/modules/keyframes/Prompter/index.tsx +6 -16
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +6 -2
- package/resources/Player/typings.ts +15 -1
- package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +5 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +17 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +4 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +254 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +5 -0
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +19 -12
- package/resources/react/index.tsx +7 -3
- package/resources/shared-utils/AduioLike.ts +109 -0
- package/resources/shared-utils/addResizeListener.ts +46 -0
- package/resources/shared-utils/createTransMatrix.ts +12 -0
- package/resources/shared-utils/getFileExpandedName.ts +6 -0
- package/resources/shared-utils/getMediaInfo.ts +52 -0
- package/resources/shared-utils/setElementDataset.ts +18 -0
- package/resources/typings/VreoUnit.ts +41 -3
- package/stylesheets/custom/SpatialScenePanel.css +2 -1
- package/stylesheets/default.css +350 -84
package/lib/Player/Controller.js
CHANGED
|
@@ -1,94 +1,185 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
4
|
-
|
|
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); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.ControllerContext = exports.Controller = void 0;
|
|
9
|
-
|
|
10
8
|
var _five = require("@realsee/five");
|
|
11
|
-
|
|
12
9
|
var _mobx = require("mobx");
|
|
13
|
-
|
|
14
10
|
var React = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _animationFrame = require("../shared-utils/animationFrame");
|
|
17
|
-
|
|
12
|
+
var _setElementDataset = _interopRequireDefault(require("../shared-utils/setElementDataset"));
|
|
13
|
+
var _getMediaInfo = require("../shared-utils/getMediaInfo");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
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); }
|
|
19
|
-
|
|
20
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; }
|
|
21
|
-
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
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."); }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
25
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
-
|
|
24
26
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
27
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
28
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
32
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
-
|
|
34
31
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
35
|
-
|
|
36
32
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
33
|
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; } }
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
34
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
35
|
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; }
|
|
43
|
-
|
|
44
36
|
/**
|
|
45
37
|
* 逻辑控制器:内部状态。
|
|
46
38
|
*/
|
|
47
39
|
var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
48
40
|
_inherits(Controller, _Subscribe);
|
|
49
|
-
|
|
50
41
|
var _super = _createSuper(Controller);
|
|
51
|
-
|
|
52
|
-
function Controller() {
|
|
42
|
+
function Controller(_ref) {
|
|
53
43
|
var _this;
|
|
54
|
-
|
|
44
|
+
var five = _ref.five,
|
|
45
|
+
container = _ref.container,
|
|
46
|
+
configs = _ref.configs;
|
|
55
47
|
_classCallCheck(this, Controller);
|
|
56
|
-
|
|
57
48
|
_this = _super.call(this);
|
|
58
|
-
|
|
59
49
|
_defineProperty(_assertThisInitialized(_this), "playing", false);
|
|
60
|
-
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "ended", false);
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "loading", false);
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "containerSize", {
|
|
53
|
+
width: 0,
|
|
54
|
+
height: 0
|
|
55
|
+
});
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "waveAppearance", null);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "appearance", {
|
|
58
|
+
waveStyle: 'wave'
|
|
59
|
+
});
|
|
60
|
+
_defineProperty(_assertThisInitialized(_this), "avatar", {});
|
|
61
61
|
_defineProperty(_assertThisInitialized(_this), "visible", false);
|
|
62
|
-
|
|
63
62
|
_defineProperty(_assertThisInitialized(_this), "popUp", null);
|
|
64
|
-
|
|
65
63
|
_defineProperty(_assertThisInitialized(_this), "drawerConfig", null);
|
|
66
|
-
|
|
64
|
+
_this.configs = configs;
|
|
65
|
+
_this.container = container;
|
|
66
|
+
_this.five = five;
|
|
67
|
+
_this.appSize = configs.appSize;
|
|
68
|
+
_this.appearance = _objectSpread(_objectSpread({}, _this.appearance), configs.appearance);
|
|
67
69
|
(0, _mobx.makeObservable)(_assertThisInitialized(_this), {
|
|
68
70
|
visible: _mobx.observable,
|
|
69
71
|
setVisible: _mobx.action,
|
|
70
72
|
playing: _mobx.observable,
|
|
71
73
|
setPlaying: _mobx.action,
|
|
74
|
+
loading: _mobx.observable,
|
|
75
|
+
setLoading: _mobx.action,
|
|
72
76
|
popUp: _mobx.observable.ref,
|
|
73
77
|
openPopUp: _mobx.action,
|
|
74
78
|
drawerConfig: _mobx.observable.ref,
|
|
75
|
-
openDrawer: _mobx.action
|
|
76
|
-
|
|
79
|
+
openDrawer: _mobx.action,
|
|
80
|
+
ended: _mobx.observable,
|
|
81
|
+
waveAppearance: _mobx.observable,
|
|
82
|
+
avatar: _mobx.observable,
|
|
83
|
+
containerSize: _mobx.observable,
|
|
84
|
+
setContainerSize: _mobx.action,
|
|
85
|
+
appearance: _mobx.observable,
|
|
86
|
+
setAppearance: _mobx.action,
|
|
87
|
+
configs: _mobx.observable.ref,
|
|
88
|
+
setEnded: _mobx.action,
|
|
89
|
+
setAvatar: _mobx.action
|
|
90
|
+
});
|
|
91
|
+
(0, _mobx.reaction)(function () {
|
|
92
|
+
return [_this.appearance.waveStyle, _this.loading];
|
|
93
|
+
}, function (_ref2) {
|
|
94
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
95
|
+
waveStyle = _ref3[0],
|
|
96
|
+
loading = _ref3[1];
|
|
97
|
+
if (loading === null) {
|
|
98
|
+
_this.waveAppearance = null;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (waveStyle === 'wave') {
|
|
102
|
+
switch (loading) {
|
|
103
|
+
case true:
|
|
104
|
+
_this.waveAppearance = 'double';
|
|
105
|
+
break;
|
|
106
|
+
case false:
|
|
107
|
+
_this.waveAppearance = 'solid';
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
} else if (waveStyle === 'solid') {
|
|
111
|
+
switch (loading) {
|
|
112
|
+
case true:
|
|
113
|
+
_this.waveAppearance = 'swap';
|
|
114
|
+
break;
|
|
115
|
+
case false:
|
|
116
|
+
_this.waveAppearance = 'expand';
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
fireImmediately: true
|
|
122
|
+
});
|
|
123
|
+
if (!_this.appSize) {
|
|
124
|
+
(0, _mobx.reaction)(function () {
|
|
125
|
+
return _this.containerSize;
|
|
126
|
+
}, function (containerSize) {
|
|
127
|
+
if (!(containerSize !== null && containerSize !== void 0 && containerSize.width)) return;
|
|
128
|
+
var width = containerSize.width;
|
|
129
|
+
var height = containerSize.height;
|
|
130
|
+
var size = function () {
|
|
131
|
+
if (width <= 500) return 'S';
|
|
132
|
+
if (width <= 1024) return 'M';
|
|
133
|
+
if (width <= 2048) return 'L';
|
|
134
|
+
return 'XL';
|
|
135
|
+
}();
|
|
136
|
+
var orientation = function () {
|
|
137
|
+
if (height > width) return 'portrait';
|
|
138
|
+
return 'landscape';
|
|
139
|
+
}();
|
|
140
|
+
(0, _setElementDataset["default"])(_this.container, {
|
|
141
|
+
size: size
|
|
142
|
+
});
|
|
143
|
+
(0, _setElementDataset["default"])(_this.container, {
|
|
144
|
+
orientation: orientation
|
|
145
|
+
});
|
|
146
|
+
}, {
|
|
147
|
+
fireImmediately: true
|
|
148
|
+
});
|
|
149
|
+
} else {
|
|
150
|
+
(0, _setElementDataset["default"])(_this.container, {
|
|
151
|
+
size: _this.appSize
|
|
152
|
+
});
|
|
153
|
+
}
|
|
77
154
|
|
|
155
|
+
// 监听播放情况:抛出触发时机
|
|
156
|
+
(0, _mobx.reaction)(function () {
|
|
157
|
+
return _this.ended;
|
|
158
|
+
}, function (ended) {
|
|
159
|
+
if (ended) {
|
|
160
|
+
_this.emit('paused', true);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
78
163
|
(0, _mobx.reaction)(function () {
|
|
79
164
|
return _this.playing;
|
|
80
165
|
}, function (playing) {
|
|
81
|
-
_this.
|
|
166
|
+
if (!_this.ended) {
|
|
167
|
+
_this.emit(playing ? 'playing' : 'paused');
|
|
168
|
+
}
|
|
82
169
|
});
|
|
83
170
|
return _this;
|
|
84
171
|
}
|
|
85
|
-
|
|
86
172
|
_createClass(Controller, [{
|
|
87
|
-
key: "
|
|
88
|
-
get:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
173
|
+
key: "agentType",
|
|
174
|
+
get:
|
|
175
|
+
// null 表示加载失败
|
|
176
|
+
|
|
177
|
+
function get() {
|
|
178
|
+
var _this$videoAgentScene, _this$avatar;
|
|
179
|
+
var type = (0, _getMediaInfo.getMediaType)((_this$videoAgentScene = this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.videoUrl);
|
|
180
|
+
if ((_this$avatar = this.avatar) !== null && _this$avatar !== void 0 && _this$avatar.force) return 'avatar';
|
|
181
|
+
if (type === 'video') return 'video';
|
|
182
|
+
return 'none';
|
|
92
183
|
}
|
|
93
184
|
}, {
|
|
94
185
|
key: "openPopUp",
|
|
@@ -97,9 +188,26 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
97
188
|
this.popUp = null;
|
|
98
189
|
return;
|
|
99
190
|
}
|
|
100
|
-
|
|
101
191
|
this.popUp = popUp;
|
|
102
192
|
}
|
|
193
|
+
}, {
|
|
194
|
+
key: "setLoading",
|
|
195
|
+
value: function setLoading(loading) {
|
|
196
|
+
this.loading = loading;
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "setAvatar",
|
|
200
|
+
value: function setAvatar(avatar) {
|
|
201
|
+
this.avatar = avatar;
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: "setContainerSize",
|
|
205
|
+
value: function setContainerSize(width, height) {
|
|
206
|
+
this.containerSize = {
|
|
207
|
+
width: width,
|
|
208
|
+
height: height
|
|
209
|
+
};
|
|
210
|
+
}
|
|
103
211
|
}, {
|
|
104
212
|
key: "setVisible",
|
|
105
213
|
value: function setVisible(v) {
|
|
@@ -110,19 +218,27 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
110
218
|
value: function setPlaying(playing) {
|
|
111
219
|
this.playing = playing;
|
|
112
220
|
}
|
|
221
|
+
}, {
|
|
222
|
+
key: "setEnded",
|
|
223
|
+
value: function setEnded(ended) {
|
|
224
|
+
this.ended = ended;
|
|
225
|
+
}
|
|
226
|
+
}, {
|
|
227
|
+
key: "setAppearance",
|
|
228
|
+
value: function setAppearance(appearance) {
|
|
229
|
+
this.appearance = _objectSpread(_objectSpread({}, this.appearance), appearance);
|
|
230
|
+
}
|
|
113
231
|
}, {
|
|
114
232
|
key: "openDrawer",
|
|
115
233
|
value: function openDrawer(drawerConfig) {
|
|
116
234
|
if (!drawerConfig) {
|
|
117
235
|
var _this$drawerConfig;
|
|
118
|
-
|
|
119
236
|
this.drawerConfig = {
|
|
120
237
|
content: '',
|
|
121
238
|
height: (_this$drawerConfig = this.drawerConfig) === null || _this$drawerConfig === void 0 ? void 0 : _this$drawerConfig.height
|
|
122
239
|
};
|
|
123
240
|
return;
|
|
124
241
|
}
|
|
125
|
-
|
|
126
242
|
this.drawerConfig = drawerConfig;
|
|
127
243
|
}
|
|
128
244
|
}, {
|
|
@@ -133,18 +249,16 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
133
249
|
}, {
|
|
134
250
|
key: "currentTime",
|
|
135
251
|
get: function get() {
|
|
136
|
-
var _this$
|
|
137
|
-
|
|
138
|
-
return ((_this$videoAgentScene3 = this.videoAgentScene) === null || _this$videoAgentScene3 === void 0 ? void 0 : _this$videoAgentScene3.videoAgentMesh.currentTime) || 0;
|
|
252
|
+
var _this$videoAgentScene2;
|
|
253
|
+
return ((_this$videoAgentScene2 = this.videoAgentScene) === null || _this$videoAgentScene2 === void 0 ? void 0 : _this$videoAgentScene2.videoAgentMesh.currentTime) || 0;
|
|
139
254
|
}
|
|
140
255
|
}, {
|
|
141
256
|
key: "currentKeyframes",
|
|
142
257
|
get: function get() {
|
|
143
258
|
var _this2 = this;
|
|
144
|
-
|
|
145
259
|
if (!this.vreoUnit) return [];
|
|
146
|
-
var keyframes = this.vreoUnit.keyframes;
|
|
147
|
-
|
|
260
|
+
var keyframes = this.vreoUnit.keyframes;
|
|
261
|
+
// 没有被解析过且开始时间低于当前时间戳 100ms
|
|
148
262
|
return keyframes.filter(function (keyframe) {
|
|
149
263
|
if (keyframe.parsed) return false;
|
|
150
264
|
var dur = _this2.currentTime - keyframe.start;
|
|
@@ -152,52 +266,43 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
152
266
|
});
|
|
153
267
|
}
|
|
154
268
|
}, {
|
|
155
|
-
key: "
|
|
269
|
+
key: "mediaInstance",
|
|
156
270
|
get: function get() {
|
|
157
|
-
var _this$
|
|
158
|
-
|
|
159
|
-
return (_this$videoAgentScene4 = this.videoAgentScene) === null || _this$videoAgentScene4 === void 0 ? void 0 : _this$videoAgentScene4.videoAgentMesh.videoInstance;
|
|
271
|
+
var _this$videoAgentScene3;
|
|
272
|
+
return (_this$videoAgentScene3 = this.videoAgentScene) === null || _this$videoAgentScene3 === void 0 ? void 0 : _this$videoAgentScene3.videoAgentMesh.mediaInstance;
|
|
160
273
|
}
|
|
274
|
+
|
|
161
275
|
/**
|
|
162
276
|
* 逐帧任务
|
|
163
277
|
*/
|
|
164
|
-
|
|
165
278
|
}, {
|
|
166
279
|
key: "requestAnimationFrameLoop",
|
|
167
280
|
value: function requestAnimationFrameLoop(callback) {
|
|
168
|
-
var _this$
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
281
|
+
var _this$mediaInstance,
|
|
282
|
+
_this$mediaInstance4,
|
|
283
|
+
_this3 = this;
|
|
284
|
+
if ((_this$mediaInstance = this.mediaInstance) !== null && _this$mediaInstance !== void 0 && _this$mediaInstance.ended) {
|
|
285
|
+
this.setEnded(true);
|
|
173
286
|
this.setPlaying(false);
|
|
174
|
-
this.
|
|
287
|
+
this.mediaInstance.pause();
|
|
175
288
|
return;
|
|
176
289
|
}
|
|
177
|
-
|
|
178
290
|
if (!this.playing) {
|
|
179
|
-
var _this$
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
(_this$videoInstance3 = this.videoInstance) === null || _this$videoInstance3 === void 0 ? void 0 : _this$videoInstance3.pause();
|
|
291
|
+
var _this$mediaInstance2;
|
|
292
|
+
if (!((_this$mediaInstance2 = this.mediaInstance) !== null && _this$mediaInstance2 !== void 0 && _this$mediaInstance2.paused)) {
|
|
293
|
+
var _this$mediaInstance3;
|
|
294
|
+
(_this$mediaInstance3 = this.mediaInstance) === null || _this$mediaInstance3 === void 0 ? void 0 : _this$mediaInstance3.pause();
|
|
185
295
|
}
|
|
186
|
-
|
|
187
296
|
return;
|
|
188
297
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
this.videoInstance.play();
|
|
298
|
+
if ((_this$mediaInstance4 = this.mediaInstance) !== null && _this$mediaInstance4 !== void 0 && _this$mediaInstance4.paused && this.playing) {
|
|
299
|
+
this.mediaInstance.play();
|
|
192
300
|
}
|
|
193
|
-
|
|
194
301
|
var currentKeyframes = this.currentKeyframes;
|
|
195
302
|
currentKeyframes.forEach(function (keyframe) {
|
|
196
303
|
if (keyframe.parsed) return;
|
|
197
304
|
keyframe.parsed = true;
|
|
198
|
-
|
|
199
305
|
_this3.emit(keyframe.type, keyframe);
|
|
200
|
-
|
|
201
306
|
if (callback) {
|
|
202
307
|
callback(keyframe.type, keyframe);
|
|
203
308
|
}
|
|
@@ -207,7 +312,6 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
207
312
|
key: "run",
|
|
208
313
|
value: function run(callback) {
|
|
209
314
|
var _this4 = this;
|
|
210
|
-
|
|
211
315
|
if (this.stopInterval) return;
|
|
212
316
|
this.stopInterval = (0, _animationFrame.requestAnimationFrameInterval)(function () {
|
|
213
317
|
return _this4.requestAnimationFrameLoop(callback);
|
|
@@ -217,33 +321,27 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
217
321
|
key: "dispose",
|
|
218
322
|
value: function dispose() {
|
|
219
323
|
this.setPlaying(false);
|
|
220
|
-
|
|
221
324
|
if (this.currentKeyframes) {
|
|
222
325
|
this.currentKeyframes.forEach(function (keyframe) {
|
|
223
326
|
return keyframe.parsed = false;
|
|
224
327
|
});
|
|
225
328
|
}
|
|
329
|
+
|
|
226
330
|
/**
|
|
227
331
|
* 清理掉数据
|
|
228
332
|
*/
|
|
229
|
-
|
|
230
|
-
|
|
231
333
|
this.vreoUnit = undefined;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.videoInstance.currentTime = 0;
|
|
334
|
+
if (this.mediaInstance) {
|
|
335
|
+
this.mediaInstance.currentTime = 0;
|
|
235
336
|
}
|
|
236
|
-
|
|
237
337
|
if (this.stopInterval) {
|
|
238
338
|
this.stopInterval();
|
|
239
339
|
this.stopInterval = undefined;
|
|
240
340
|
}
|
|
241
341
|
}
|
|
242
342
|
}]);
|
|
243
|
-
|
|
244
343
|
return Controller;
|
|
245
344
|
}(_five.Subscribe);
|
|
246
|
-
|
|
247
345
|
exports.Controller = Controller;
|
|
248
346
|
var ControllerContext = /*#__PURE__*/React.createContext(null);
|
|
249
347
|
exports.ControllerContext = ControllerContext;
|