@realsee/vreo 0.2.0-alpha.2 → 0.2.0-alpha.20
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 +5 -0
- package/README.md +80 -5
- package/docs/assets/custom.css +2 -2
- 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.ec0a6e82.js +1 -0
- package/docs/demo/assets/default.55c3f308.css +1 -0
- package/docs/demo/assets/default.a5d6dd99.js +3952 -0
- package/docs/demo/assets/dynamic.8c30b7ae.js +1 -0
- package/docs/demo/assets/examples.dac4a6fe.css +1 -0
- package/docs/demo/assets/examples.ddb41c97.js +25 -0
- package/docs/demo/assets/index.a7bafdff.css +1 -0
- package/docs/demo/assets/index.fc42be2b.js +1 -0
- package/docs/demo/assets/main.d119ebf7.js +1 -0
- package/docs/demo/assets/react.2d403aee.js +25 -0
- package/docs/demo/assets/react.855b3d23.css +1 -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 -0
- 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 +37 -6
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
- package/docs/interfaces/Player.PlayerConfigs.html +3 -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.d.ts +1 -0
- package/lib/PlayController/createHTMLAudioElement.js +47 -0
- package/lib/PlayController/index.d.ts +38 -0
- package/lib/PlayController/index.js +300 -0
- package/lib/Player/App.js +5 -4
- package/lib/Player/Controller.d.ts +5 -1
- package/lib/Player/Controller.js +38 -5
- package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
- package/lib/Player/custom/SpatialScenePanel/index.js +98 -26
- package/lib/Player/index.d.ts +3 -2
- package/lib/Player/index.js +116 -24
- package/lib/Player/modules/Drawer/index.js +1 -1
- package/lib/Player/modules/PopUp/index.d.ts +2 -0
- package/lib/Player/modules/PopUp/index.js +43 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +17 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +113 -37
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +5 -1
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +9 -4
- package/lib/Player/modules/VideoAgent/index.d.ts +2 -0
- package/lib/Player/modules/VideoAgent/index.js +2 -2
- package/lib/Player/modules/keyframes/BgMusic/index.js +1 -1
- package/lib/Player/modules/keyframes/CameraMovement/index.js +42 -6
- package/lib/Player/modules/keyframes/InfoPanel/index.js +74 -36
- package/lib/Player/modules/keyframes/ModelVideo/index.js +46 -9
- package/lib/Player/modules/keyframes/PanoEffect/index.js +1 -1
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -1
- package/lib/Player/modules/keyframes/PanoTag/index.js +20 -7
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +3 -0
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +96 -51
- package/lib/Player/modules/keyframes/Prompter/index.js +5 -19
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +31 -19
- package/lib/Player/modules/keyframes/VideoEffect/index.js +1 -1
- package/lib/Player/typings.d.ts +6 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +12 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +7 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +32 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +3 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +11 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +56 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +275 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +7 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +18 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.js +104 -90
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +1 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +1 -1
- package/lib/react/index.d.ts +7 -3
- package/lib/react/index.js +3 -3
- package/lib/shared-utils/AduioLike.d.ts +37 -0
- package/lib/shared-utils/AduioLike.js +165 -0
- package/lib/shared-utils/animationFrame/BetterTween.js +7 -3
- package/lib/shared-utils/animationFrame/tween.js +1 -1
- package/lib/shared-utils/createTransMatrix.d.ts +1 -0
- package/lib/shared-utils/createTransMatrix.js +43 -0
- package/lib/typings/VreoUnit.d.ts +42 -5
- package/lib/typings/VreoUnit.js +26 -6
- package/package.json +8 -8
- package/resources/PlayController/createHTMLAudioElement.ts +53 -0
- package/resources/PlayController/index.ts +167 -0
- package/resources/Player/App.tsx +2 -0
- package/resources/Player/Controller.ts +155 -121
- package/resources/Player/custom/SpatialScenePanel/index.tsx +148 -45
- package/resources/Player/index.tsx +186 -110
- package/resources/Player/modules/PopUp/index.tsx +26 -0
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +66 -14
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +3 -3
- package/resources/Player/modules/VideoAgent/index.tsx +3 -2
- package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +79 -34
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +31 -12
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +87 -34
- package/resources/Player/modules/keyframes/Prompter/index.tsx +5 -15
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +25 -16
- package/resources/Player/typings.ts +5 -0
- 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 +59 -48
- package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
- package/resources/react/index.tsx +7 -3
- package/resources/shared-utils/AduioLike.ts +108 -0
- package/resources/shared-utils/createTransMatrix.ts +12 -0
- package/resources/typings/VreoUnit.ts +46 -5
- package/stylesheets/custom/SpatialScenePanel.css +14 -8
- package/stylesheets/default.css +116 -12
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.PlayController = void 0;
|
|
9
|
+
|
|
10
|
+
var _five = require("@realsee/five");
|
|
11
|
+
|
|
12
|
+
var _animationFrame = require("../shared-utils/animationFrame");
|
|
13
|
+
|
|
14
|
+
var _createHTMLAudioElement = require("./createHTMLAudioElement");
|
|
15
|
+
|
|
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); } }
|
|
17
|
+
|
|
18
|
+
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); }); }; }
|
|
19
|
+
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
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); } }
|
|
23
|
+
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
+
|
|
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); }; }
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
+
|
|
36
|
+
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; } }
|
|
37
|
+
|
|
38
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
var closures = {};
|
|
43
|
+
|
|
44
|
+
var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
45
|
+
_inherits(PlayController, _Subscribe);
|
|
46
|
+
|
|
47
|
+
var _super = _createSuper(PlayController);
|
|
48
|
+
|
|
49
|
+
function PlayController() {
|
|
50
|
+
var _this;
|
|
51
|
+
|
|
52
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
53
|
+
|
|
54
|
+
_classCallCheck(this, PlayController);
|
|
55
|
+
|
|
56
|
+
_this = _super.call(this);
|
|
57
|
+
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "config", {});
|
|
59
|
+
|
|
60
|
+
if (!config.audio) {
|
|
61
|
+
config.audio = (0, _createHTMLAudioElement.createHTMLAudioElement)();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_this.config = Object.assign(_this.config, config);
|
|
65
|
+
|
|
66
|
+
closures.onPlaying = function () {
|
|
67
|
+
return _this.emit('playing');
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
closures.onPaused = function () {
|
|
71
|
+
return _this.emit('paused');
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
closures.onEnded = function () {
|
|
75
|
+
return _this.emit('paused', true);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
_this.audioInstance.addEventListener('play', closures.onPlaying);
|
|
79
|
+
|
|
80
|
+
_this.audioInstance.addEventListener('pause', closures.onPaused);
|
|
81
|
+
|
|
82
|
+
_this.audioInstance.addEventListener('ended', closures.onEnded);
|
|
83
|
+
|
|
84
|
+
_this.stopInterval = (0, _animationFrame.requestAnimationFrameInterval)(function () {
|
|
85
|
+
if (_this.audioInstance.paused) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!_this.vreoUnit) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var keyframes = _this.vreoUnit.keyframes;
|
|
94
|
+
var currentTime = _this.currentTime; // 没有被解析过且开始时间低于当前时间戳 100ms
|
|
95
|
+
|
|
96
|
+
var currentKeyframes = keyframes.filter(function (keyframe) {
|
|
97
|
+
if (keyframe.parsed) return false;
|
|
98
|
+
var dur = currentTime - keyframe.start;
|
|
99
|
+
return dur <= 60 && dur >= 0;
|
|
100
|
+
});
|
|
101
|
+
currentKeyframes.forEach(function (keyframe) {
|
|
102
|
+
if (keyframe.parsed) return;
|
|
103
|
+
keyframe.parsed = true;
|
|
104
|
+
|
|
105
|
+
_this.emit(keyframe.type, keyframe);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
return _this;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 载入数据
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
_createClass(PlayController, [{
|
|
116
|
+
key: "paused",
|
|
117
|
+
get: function get() {
|
|
118
|
+
return this.audioInstance.paused;
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "audioInstance",
|
|
122
|
+
get: function get() {
|
|
123
|
+
return this.config.audio;
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "currentTime",
|
|
127
|
+
get: function get() {
|
|
128
|
+
return this.audioInstance.currentTime * 1000;
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
key: "currentKeyframes",
|
|
132
|
+
get: function get() {
|
|
133
|
+
var _this2 = this;
|
|
134
|
+
|
|
135
|
+
if (!this.vreoUnit) return [];
|
|
136
|
+
var keyframes = this.vreoUnit.keyframes; // 没有被解析过且开始时间低于当前时间戳 100ms
|
|
137
|
+
|
|
138
|
+
return keyframes.filter(function (keyframe) {
|
|
139
|
+
if (keyframe.parsed) return false;
|
|
140
|
+
var dur = _this2.currentTime - keyframe.start;
|
|
141
|
+
return dur <= 100 && dur >= 0;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 音频时长 不一定能获取得到,建议以 VreoUnit 配置的时长为准。
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
}, {
|
|
149
|
+
key: "duration",
|
|
150
|
+
get: function get() {
|
|
151
|
+
return this.audioInstance.duration * 1000;
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "load",
|
|
155
|
+
value: function () {
|
|
156
|
+
var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(vreoUnit) {
|
|
157
|
+
var _this3 = this;
|
|
158
|
+
|
|
159
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
160
|
+
while (1) {
|
|
161
|
+
switch (_context.prev = _context.next) {
|
|
162
|
+
case 0:
|
|
163
|
+
this.vreoUnit = vreoUnit;
|
|
164
|
+
_context.next = 3;
|
|
165
|
+
return this.pause();
|
|
166
|
+
|
|
167
|
+
case 3:
|
|
168
|
+
_context.next = 5;
|
|
169
|
+
return new Promise(function (resolve, reject) {
|
|
170
|
+
if (vreoUnit.video.url === _this3.audioInstance.src) {
|
|
171
|
+
return resolve(true);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
_this3.audioInstance.src = vreoUnit.video.url;
|
|
175
|
+
|
|
176
|
+
var canplaythrough = function canplaythrough() {
|
|
177
|
+
resolve(true);
|
|
178
|
+
|
|
179
|
+
_this3.audioInstance.removeEventListener('canplaythrough', canplaythrough);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
var error = function error(err) {
|
|
183
|
+
reject(err);
|
|
184
|
+
|
|
185
|
+
_this3.audioInstance.removeEventListener('error', error);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
_this3.audioInstance.addEventListener('canplaythrough', canplaythrough);
|
|
189
|
+
|
|
190
|
+
_this3.audioInstance.addEventListener('error', error);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
case 5:
|
|
194
|
+
return _context.abrupt("return", _context.sent);
|
|
195
|
+
|
|
196
|
+
case 6:
|
|
197
|
+
case "end":
|
|
198
|
+
return _context.stop();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}, _callee, this);
|
|
202
|
+
}));
|
|
203
|
+
|
|
204
|
+
function load(_x) {
|
|
205
|
+
return _load.apply(this, arguments);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return load;
|
|
209
|
+
}()
|
|
210
|
+
/**
|
|
211
|
+
* 播放
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
}, {
|
|
215
|
+
key: "play",
|
|
216
|
+
value: function () {
|
|
217
|
+
var _play = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
218
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
219
|
+
while (1) {
|
|
220
|
+
switch (_context2.prev = _context2.next) {
|
|
221
|
+
case 0:
|
|
222
|
+
closures.playPromise = this.audioInstance.play();
|
|
223
|
+
|
|
224
|
+
case 1:
|
|
225
|
+
case "end":
|
|
226
|
+
return _context2.stop();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}, _callee2, this);
|
|
230
|
+
}));
|
|
231
|
+
|
|
232
|
+
function play() {
|
|
233
|
+
return _play.apply(this, arguments);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return play;
|
|
237
|
+
}()
|
|
238
|
+
/**
|
|
239
|
+
* 暂停
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
}, {
|
|
243
|
+
key: "pause",
|
|
244
|
+
value: function () {
|
|
245
|
+
var _pause = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
246
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
247
|
+
while (1) {
|
|
248
|
+
switch (_context3.prev = _context3.next) {
|
|
249
|
+
case 0:
|
|
250
|
+
if (!closures.playPromise) {
|
|
251
|
+
_context3.next = 3;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
_context3.next = 3;
|
|
256
|
+
return closures.playPromise;
|
|
257
|
+
|
|
258
|
+
case 3:
|
|
259
|
+
this.audioInstance.pause();
|
|
260
|
+
|
|
261
|
+
case 4:
|
|
262
|
+
case "end":
|
|
263
|
+
return _context3.stop();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}, _callee3, this);
|
|
267
|
+
}));
|
|
268
|
+
|
|
269
|
+
function pause() {
|
|
270
|
+
return _pause.apply(this, arguments);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return pause;
|
|
274
|
+
}()
|
|
275
|
+
/**
|
|
276
|
+
* 销毁资源
|
|
277
|
+
* @notice 一旦销毁,创建的实例将不可用:需重新创建实例。
|
|
278
|
+
*
|
|
279
|
+
* @deprecated **慎重执行**
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
}, {
|
|
283
|
+
key: "dispose",
|
|
284
|
+
value: function dispose() {
|
|
285
|
+
// 清理事件监听
|
|
286
|
+
this.audioInstance.removeEventListener('play', closures.onPlaying);
|
|
287
|
+
this.audioInstance.removeEventListener('pasue', closures.onPaused);
|
|
288
|
+
this.audioInstance.removeEventListener('ended', closures.onEnded);
|
|
289
|
+
|
|
290
|
+
if (this.stopInterval) {
|
|
291
|
+
this.stopInterval();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}]);
|
|
295
|
+
|
|
296
|
+
return PlayController;
|
|
297
|
+
}(_five.Subscribe);
|
|
298
|
+
|
|
299
|
+
exports.PlayController = PlayController;
|
|
300
|
+
console.log("\n\n\u250F\u2501\u2501\u2501\u2513\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u250F\u2513\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2503\u250F\u2501\u2513\u2503\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2503\u2503\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2503\u2517\u2501\u251B\u2503\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\u2501\u2503\u2503\u2501\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\n\u2503\u250F\u2513\u250F\u251B\u2503\u250F\u2513\u2503\u2517\u2501\u2513\u2503\u2501\u2503\u2503\u2501\u2503\u2501\u2501\u252B\u2503\u250F\u2513\u2503\u2503\u250F\u2513\u2503\n\u2503\u2503\u2503\u2517\u2513\u2503\u2503\u2501\u252B\u2503\u2517\u251B\u2517\u2513\u2503\u2517\u2513\u2523\u2501\u2501\u2503\u2503\u2503\u2501\u252B\u2503\u2503\u2501\u252B\n\u2517\u251B\u2517\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u251B\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 \n\n");
|
package/lib/Player/App.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -44,7 +44,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
44
44
|
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; }
|
|
45
45
|
|
|
46
46
|
var AppView = (0, _mobxReact.observer)(function (_ref) {
|
|
47
|
-
var _controller$configs;
|
|
47
|
+
var _controller$configs, _controller$configs2;
|
|
48
48
|
|
|
49
49
|
var controller = _ref.controller;
|
|
50
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -64,8 +64,9 @@ var AppView = (0, _mobxReact.observer)(function (_ref) {
|
|
|
64
64
|
} else {
|
|
65
65
|
controller.setPlaying(true);
|
|
66
66
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
67
|
+
},
|
|
68
|
+
options: ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.videoAgentMeshOptions) || {}
|
|
69
|
+
}), /*#__PURE__*/React.createElement(_Prompter.Prompter, null), (_controller$configs2 = controller.configs) === null || _controller$configs2 === void 0 ? void 0 : _controller$configs2.customPanelChildren));
|
|
69
70
|
});
|
|
70
71
|
|
|
71
72
|
function App() {
|
|
@@ -13,14 +13,18 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
13
13
|
vreoUnit?: VreoUnit;
|
|
14
14
|
stopInterval?: () => void;
|
|
15
15
|
playing: boolean;
|
|
16
|
+
ended: boolean;
|
|
16
17
|
visible: boolean;
|
|
17
18
|
get isAudio(): boolean;
|
|
19
|
+
popUp: string | JSX.Element | null;
|
|
20
|
+
openPopUp(popUp: string | JSX.Element | false): void;
|
|
18
21
|
drawerConfig: {
|
|
19
22
|
content: string | JSX.Element;
|
|
20
23
|
height?: number | string;
|
|
21
24
|
} | null;
|
|
22
25
|
setVisible(v: boolean): void;
|
|
23
26
|
setPlaying(playing: boolean): void;
|
|
27
|
+
setEnded(ended: boolean): void;
|
|
24
28
|
openDrawer(drawerConfig?: false | {
|
|
25
29
|
content: string | JSX.Element;
|
|
26
30
|
height?: number | string;
|
|
@@ -29,7 +33,7 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
29
33
|
get ready(): boolean;
|
|
30
34
|
get currentTime(): number;
|
|
31
35
|
get currentKeyframes(): VreoKeyframe[];
|
|
32
|
-
get videoInstance(): HTMLAudioElement | undefined;
|
|
36
|
+
get videoInstance(): HTMLAudioElement | import("../shared-utils/AduioLike").AudioLike | undefined;
|
|
33
37
|
/**
|
|
34
38
|
* 逐帧任务
|
|
35
39
|
*/
|
package/lib/Player/Controller.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -23,9 +23,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
23
23
|
|
|
24
24
|
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
25
|
|
|
26
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
26
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
27
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); }
|
|
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
29
|
|
|
30
30
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
31
|
|
|
@@ -58,8 +58,12 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
58
58
|
|
|
59
59
|
_defineProperty(_assertThisInitialized(_this), "playing", false);
|
|
60
60
|
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "ended", false);
|
|
62
|
+
|
|
61
63
|
_defineProperty(_assertThisInitialized(_this), "visible", false);
|
|
62
64
|
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "popUp", null);
|
|
66
|
+
|
|
63
67
|
_defineProperty(_assertThisInitialized(_this), "drawerConfig", null);
|
|
64
68
|
|
|
65
69
|
(0, _mobx.makeObservable)(_assertThisInitialized(_this), {
|
|
@@ -67,14 +71,27 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
67
71
|
setVisible: _mobx.action,
|
|
68
72
|
playing: _mobx.observable,
|
|
69
73
|
setPlaying: _mobx.action,
|
|
74
|
+
popUp: _mobx.observable.ref,
|
|
75
|
+
openPopUp: _mobx.action,
|
|
70
76
|
drawerConfig: _mobx.observable.ref,
|
|
71
|
-
openDrawer: _mobx.action
|
|
77
|
+
openDrawer: _mobx.action,
|
|
78
|
+
ended: _mobx.observable,
|
|
79
|
+
setEnded: _mobx.action
|
|
72
80
|
}); // 监听播放情况:抛出触发时机
|
|
73
81
|
|
|
82
|
+
(0, _mobx.reaction)(function () {
|
|
83
|
+
return _this.ended;
|
|
84
|
+
}, function (ended) {
|
|
85
|
+
if (ended) {
|
|
86
|
+
_this.emit('paused', true);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
74
89
|
(0, _mobx.reaction)(function () {
|
|
75
90
|
return _this.playing;
|
|
76
91
|
}, function (playing) {
|
|
77
|
-
_this.
|
|
92
|
+
if (!_this.ended) {
|
|
93
|
+
_this.emit(playing ? 'playing' : 'paused');
|
|
94
|
+
}
|
|
78
95
|
});
|
|
79
96
|
return _this;
|
|
80
97
|
}
|
|
@@ -86,6 +103,16 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
86
103
|
|
|
87
104
|
return !((_this$videoAgentScene = this.videoAgentScene) !== null && _this$videoAgentScene !== void 0 && (_this$videoAgentScene2 = _this$videoAgentScene.videoAgentMesh.videoUrl) !== null && _this$videoAgentScene2 !== void 0 && _this$videoAgentScene2.endsWith('.mp4'));
|
|
88
105
|
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "openPopUp",
|
|
108
|
+
value: function openPopUp(popUp) {
|
|
109
|
+
if (!popUp) {
|
|
110
|
+
this.popUp = null;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
this.popUp = popUp;
|
|
115
|
+
}
|
|
89
116
|
}, {
|
|
90
117
|
key: "setVisible",
|
|
91
118
|
value: function setVisible(v) {
|
|
@@ -96,6 +123,11 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
96
123
|
value: function setPlaying(playing) {
|
|
97
124
|
this.playing = playing;
|
|
98
125
|
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "setEnded",
|
|
128
|
+
value: function setEnded(ended) {
|
|
129
|
+
this.ended = ended;
|
|
130
|
+
}
|
|
99
131
|
}, {
|
|
100
132
|
key: "openDrawer",
|
|
101
133
|
value: function openDrawer(drawerConfig) {
|
|
@@ -156,6 +188,7 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
156
188
|
_this3 = this;
|
|
157
189
|
|
|
158
190
|
if ((_this$videoInstance = this.videoInstance) !== null && _this$videoInstance !== void 0 && _this$videoInstance.ended) {
|
|
191
|
+
this.setEnded(true);
|
|
159
192
|
this.setPlaying(false);
|
|
160
193
|
this.videoInstance.pause();
|
|
161
194
|
return;
|
|
@@ -8,12 +8,12 @@ export interface SpatialScenePanelData {
|
|
|
8
8
|
text: string;
|
|
9
9
|
icon: string;
|
|
10
10
|
}[];
|
|
11
|
-
position
|
|
11
|
+
position?: {
|
|
12
12
|
x: number;
|
|
13
13
|
y: number;
|
|
14
14
|
z: number;
|
|
15
15
|
};
|
|
16
|
-
quaternion
|
|
16
|
+
quaternion?: [number, number, number, number];
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* 空间场景面板
|