@realsee/vreo 1.0.0-alpha.2 → 1.0.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 +6 -1
- package/README.md +46 -36
- package/lib/PlayController/index.js +1 -1
- package/lib/Player/Controller.d.ts +4 -4
- package/lib/Player/Controller.js +14 -5
- package/lib/Player/index.js +3 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +3 -3
- package/lib/Player/modules/VideoAgent/index.js +1 -1
- package/lib/Player/modules/Wave/index.js +174 -25
- package/lib/Player/modules/keyframes/BgMusic/index.js +31 -16
- package/lib/Player/modules/keyframes/PanoTag/index.js +3 -3
- package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
- package/lib/shared-utils/{AduioLike.js → AudioLike.js} +4 -6
- package/lib/typings/VreoUnit.d.ts +6 -6
- package/package.json +2 -4
- package/stylesheets/default.css +11 -4
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -78
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +0 -52
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1414
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/Player.AudioLike.html +0 -52
- package/docs/classes/Player.Controller.html +0 -54
- package/docs/classes/Player.Player-1.html +0 -50
- package/docs/classes/Player.VideoAgentMesh.html +0 -142
- package/docs/classes/Player.VideoAgentScene.html +0 -1
- package/docs/demo/assets/AppReact.d0ee843a.js +0 -1
- package/docs/demo/assets/default.63925584.js +0 -3984
- package/docs/demo/assets/default.f3f3ca8c.css +0 -1
- package/docs/demo/assets/dynamic.76506c2c.js +0 -1
- package/docs/demo/assets/examples.3d8323db.js +0 -25
- package/docs/demo/assets/examples.dac4a6fe.css +0 -1
- package/docs/demo/assets/index.7e31122c.js +0 -1
- package/docs/demo/assets/index.9331038f.css +0 -1
- package/docs/demo/assets/main.79b11b9d.js +0 -1
- package/docs/demo/assets/react.2ee8565f.css +0 -1
- package/docs/demo/assets/react.c1c07c14.js +0 -25
- package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +0 -1
- package/docs/demo/examples.html +0 -17
- package/docs/demo/index-react-dynamic.html +0 -20
- package/docs/demo/index-react.html +0 -20
- package/docs/demo/index.html +0 -19
- package/docs/enums/Player.InfoPanelStyleEnum.html +0 -1
- package/docs/enums/Player.InfoPanelTypeEnum.html +0 -3
- package/docs/enums/Player.PanoEffectEnum.html +0 -5
- package/docs/enums/Player.PanoTagEnum.html +0 -3
- package/docs/enums/Player.PanoTagStyleEnum.html +0 -7
- package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
- package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -1
- package/docs/enums/fivePlugins.Rotation.html +0 -1
- package/docs/index.html +0 -245
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -1
- package/docs/interfaces/Player.PlayerConfigs.html +0 -7
- package/docs/interfaces/Player.Vertex.html +0 -3
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -8
- package/docs/interfaces/Player.VreoKeyframe.html +0 -3
- package/docs/interfaces/Player.VreoUnit.html +0 -3
- package/docs/interfaces/Player.VreoVideo.html +0 -3
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -4
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -7
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.Vector3Position.html +0 -3
- package/docs/interfaces/react.VreoActionCallbacks.html +0 -23
- package/docs/interfaces/react.VreoProviderProps.html +0 -1
- package/docs/modules/Player.html +0 -37
- package/docs/modules/custom.html +0 -3
- package/docs/modules/fivePlugins.html +0 -6
- package/docs/modules/react.html +0 -1
- package/docs/modules.html +0 -1
- package/resources/PlayController/createHTMLAudioElement.ts +0 -53
- package/resources/PlayController/index.ts +0 -154
- package/resources/Player/App.tsx +0 -66
- package/resources/Player/Controller.ts +0 -297
- package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -264
- package/resources/Player/hooks.ts +0 -26
- package/resources/Player/index.tsx +0 -225
- package/resources/Player/modules/Drawer/index.tsx +0 -40
- package/resources/Player/modules/PopUp/index.tsx +0 -26
- package/resources/Player/modules/ResizeObserver/index.tsx +0 -23
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +0 -302
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +0 -56
- package/resources/Player/modules/VideoAgent/index.tsx +0 -53
- package/resources/Player/modules/Wave/index.tsx +0 -18
- package/resources/Player/modules/keyframes/BgMusic/index.tsx +0 -66
- package/resources/Player/modules/keyframes/CameraMovement/index.tsx +0 -37
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +0 -165
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +0 -77
- package/resources/Player/modules/keyframes/PanoEffect/index.tsx +0 -99
- package/resources/Player/modules/keyframes/PanoEffect/lineAnime.ts +0 -31
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +0 -83
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +0 -117
- package/resources/Player/modules/keyframes/Prompter/index.tsx +0 -56
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +0 -99
- package/resources/Player/modules/keyframes/VideoEffect/index.tsx +0 -115
- package/resources/Player/typings.ts +0 -49
- package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +0 -5
- package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +0 -17
- package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +0 -4
- package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +0 -254
- package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +0 -5
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +0 -226
- package/resources/fivePlugins/CameraMovementPlugin/typings.ts +0 -59
- package/resources/fivePlugins/ModelTVVideoPlugin/index.ts +0 -278
- package/resources/index.ts +0 -1
- package/resources/react/index.tsx +0 -121
- package/resources/shared-utils/AduioLike.ts +0 -109
- package/resources/shared-utils/Preloader.ts +0 -35
- package/resources/shared-utils/addResizeListener.ts +0 -46
- package/resources/shared-utils/animationFrame/BetterTween.ts +0 -33
- package/resources/shared-utils/animationFrame/index.ts +0 -48
- package/resources/shared-utils/animationFrame/tween.ts +0 -51
- package/resources/shared-utils/createTransMatrix.ts +0 -12
- package/resources/shared-utils/getFileExpandedName.ts +0 -6
- package/resources/shared-utils/getMediaInfo.ts +0 -52
- package/resources/shared-utils/setElementDataset.ts +0 -18
- package/resources/typings/VreoUnit.ts +0 -314
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
|
+
#1.0.0-alpha.19
|
|
3
|
+
- fix: 多段BgMusic可以重复播放
|
|
4
|
+
|
|
5
|
+
#1.0.0-alpha.18
|
|
6
|
+
- fix: 修复无音频版本中途播放会从头开始的问题
|
|
7
|
+
|
|
2
8
|
#1.0.0-alpha.1
|
|
3
9
|
- feat: css样式适配: 手机横竖屏, pad, pc
|
|
4
10
|
- feat: 新增两种波浪风格: 'wave' | 'solid'
|
|
5
11
|
- feat: 标签调用dna插件
|
|
6
|
-
- fix: 修复无音频版本中途播放会从头开始的问题
|
|
7
12
|
- fix: 图片/视频 弹窗UI问题
|
|
8
13
|
|
|
9
14
|
#0.2.0-alpha.25
|
package/README.md
CHANGED
|
@@ -15,20 +15,36 @@
|
|
|
15
15
|
|
|
16
16
|
## 安装说明
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
- 由于 `@realsee/vreo` 依赖 [Five](https://unpkg.com/@realsee/five/docs/index.html) 和 [React](https://reactjs.org/) ,请务必同时安装相关依赖
|
|
19
|
+
- 根据项目的包管理器来安装:
|
|
20
|
+
``` bash
|
|
21
|
+
# pnpm
|
|
22
|
+
pnpm install @realsee/vreo @realsee/five react react-dom --save
|
|
23
|
+
# npm
|
|
24
|
+
npm install @realsee/vreo @realsee/five react react-dom --save
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add @realsee/vreo @realsee/five react react-dom
|
|
27
|
+
```
|
|
25
28
|
|
|
26
29
|
## 快速上手
|
|
30
|
+
引入样式:
|
|
27
31
|
|
|
32
|
+
```css
|
|
33
|
+
/* @file xxx.css */
|
|
34
|
+
@import '@realsee/vreo/stylesheets/default.css';
|
|
35
|
+
```
|
|
36
|
+
或
|
|
28
37
|
```jsx
|
|
38
|
+
/* @file xxx.tsx | xxx.jsx */
|
|
39
|
+
import '@realsee/vreo/stylesheets/default.css';
|
|
40
|
+
```
|
|
41
|
+
examples:
|
|
42
|
+
```tsx
|
|
43
|
+
/* @file index.tsx | index.jsx */
|
|
29
44
|
import * as React from 'react'
|
|
30
45
|
import { Five } from '@realsee/five'
|
|
31
46
|
import { Player } from '@realsee/vreo'
|
|
47
|
+
import '@realsee/vreo/stylesheets/default.css';
|
|
32
48
|
|
|
33
49
|
// 创建 Five 实例
|
|
34
50
|
const five = new Five({
|
|
@@ -36,32 +52,28 @@ const five = new Five({
|
|
|
36
52
|
})
|
|
37
53
|
|
|
38
54
|
// 创建 Player 实例
|
|
39
|
-
const
|
|
55
|
+
const vreoPlayer = new Player(five)
|
|
40
56
|
|
|
41
57
|
// 异步请求剧本数据
|
|
42
58
|
const vreoUnit = await fetch('api/**/**')
|
|
43
59
|
|
|
44
60
|
// 加载剧本数据(剧本数据见下文)
|
|
45
|
-
|
|
61
|
+
vreoPlayer.load(vreoUnit)
|
|
46
62
|
|
|
47
63
|
// 播放
|
|
48
|
-
|
|
64
|
+
vreoPlayer.play()
|
|
49
65
|
|
|
50
66
|
// 暂停
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
引入样式:
|
|
55
|
-
|
|
56
|
-
```css
|
|
57
|
-
@import '@realsee/vreo/stylesheets/default.css';
|
|
67
|
+
vreoPlayer.pause()
|
|
58
68
|
```
|
|
59
69
|
|
|
60
70
|
## React Context & Hooks 模式使用
|
|
61
71
|
|
|
62
72
|
**Vreo** 支持 [React Context](https://reactjs.org/docs/context.html) 与 [Hooks](https://reactjs.org/docs/hooks-intro.html) 相配合的模式使用,简单样例如下:
|
|
63
73
|
|
|
64
|
-
```
|
|
74
|
+
```tsx
|
|
75
|
+
/* @file App.tsx */
|
|
76
|
+
|
|
65
77
|
import * as React from 'react'
|
|
66
78
|
import * as ReactDOM from 'react-dom'
|
|
67
79
|
import { Five, Work, parseWork } from '@realsee/five'
|
|
@@ -78,20 +90,21 @@ const PlayButton: React.FC = () => {
|
|
|
78
90
|
const { load, play, pause } = useVreoAction()
|
|
79
91
|
|
|
80
92
|
return (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
<>
|
|
94
|
+
<button
|
|
95
|
+
onClick={async () => {
|
|
96
|
+
// 获取讲房数据
|
|
97
|
+
const vreoUnit = await fetch('api/**/**')
|
|
98
|
+
// 载入数据
|
|
99
|
+
await load(vreoUnit)
|
|
100
|
+
// 播放
|
|
101
|
+
play()
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
讲解
|
|
105
|
+
</button>
|
|
106
|
+
<button onClick={() => pause()}>暂停</button>
|
|
107
|
+
</>
|
|
95
108
|
)
|
|
96
109
|
}
|
|
97
110
|
|
|
@@ -559,7 +572,4 @@ vreoplayer.load(vreoUnit, 0, true)
|
|
|
559
572
|
|
|
560
573
|
```
|
|
561
574
|
|
|
562
|
-
|
|
563
|
-
## API 文档
|
|
564
|
-
|
|
565
|
-
详细的 API 文档请参考:[Vreo API](https://realsee.js.org/vreo/index.html) 。
|
|
575
|
+
Enjoy it!
|
|
@@ -102,7 +102,7 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
102
102
|
if (keyframe.parsed) return;
|
|
103
103
|
keyframe.parsed = true;
|
|
104
104
|
|
|
105
|
-
_this.emit(keyframe.type, keyframe);
|
|
105
|
+
_this.emit(keyframe.type, keyframe, _this.currentTime);
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
return _this;
|
|
@@ -15,7 +15,7 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
15
15
|
playing: boolean;
|
|
16
16
|
ended: boolean;
|
|
17
17
|
loading: boolean | null;
|
|
18
|
-
containerSize
|
|
18
|
+
containerSize: {
|
|
19
19
|
width: number;
|
|
20
20
|
height: number;
|
|
21
21
|
};
|
|
@@ -23,7 +23,7 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
23
23
|
container: Element;
|
|
24
24
|
waveAppearance: WaveAppearance | null;
|
|
25
25
|
appearance: Appearance;
|
|
26
|
-
avatar
|
|
26
|
+
avatar: VreoVideo['avatar'];
|
|
27
27
|
visible: boolean;
|
|
28
28
|
get agentType(): "none" | "video" | "avatar";
|
|
29
29
|
popUp: string | JSX.Element | null;
|
|
@@ -51,11 +51,11 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
51
51
|
get ready(): boolean;
|
|
52
52
|
get currentTime(): number;
|
|
53
53
|
get currentKeyframes(): VreoKeyframe[];
|
|
54
|
-
get mediaInstance(): HTMLVideoElement | HTMLAudioElement | import("../shared-utils/
|
|
54
|
+
get mediaInstance(): HTMLVideoElement | HTMLAudioElement | import("../shared-utils/AudioLike").AudioLike | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* 逐帧任务
|
|
57
57
|
*/
|
|
58
|
-
requestAnimationFrameLoop(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe) => void): void;
|
|
58
|
+
requestAnimationFrameLoop(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe, currentTime: number) => void): void;
|
|
59
59
|
run(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe) => void): void;
|
|
60
60
|
dispose(): void;
|
|
61
61
|
}
|
package/lib/Player/Controller.js
CHANGED
|
@@ -88,12 +88,19 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
88
88
|
|
|
89
89
|
_defineProperty(_assertThisInitialized(_this), "loading", false);
|
|
90
90
|
|
|
91
|
+
_defineProperty(_assertThisInitialized(_this), "containerSize", {
|
|
92
|
+
width: 0,
|
|
93
|
+
height: 0
|
|
94
|
+
});
|
|
95
|
+
|
|
91
96
|
_defineProperty(_assertThisInitialized(_this), "waveAppearance", null);
|
|
92
97
|
|
|
93
98
|
_defineProperty(_assertThisInitialized(_this), "appearance", {
|
|
94
|
-
waveStyle: '
|
|
99
|
+
waveStyle: 'wave'
|
|
95
100
|
});
|
|
96
101
|
|
|
102
|
+
_defineProperty(_assertThisInitialized(_this), "avatar", {});
|
|
103
|
+
|
|
97
104
|
_defineProperty(_assertThisInitialized(_this), "visible", false);
|
|
98
105
|
|
|
99
106
|
_defineProperty(_assertThisInitialized(_this), "popUp", null);
|
|
@@ -111,6 +118,7 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
111
118
|
playing: _mobx.observable,
|
|
112
119
|
setPlaying: _mobx.action,
|
|
113
120
|
loading: _mobx.observable,
|
|
121
|
+
// videoAgentScene: observable.ref,
|
|
114
122
|
setLoading: _mobx.action,
|
|
115
123
|
popUp: _mobx.observable.ref,
|
|
116
124
|
openPopUp: _mobx.action,
|
|
@@ -168,7 +176,7 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
168
176
|
(0, _mobx.reaction)(function () {
|
|
169
177
|
return _this.containerSize;
|
|
170
178
|
}, function (containerSize) {
|
|
171
|
-
if (!containerSize) return;
|
|
179
|
+
if (!(containerSize !== null && containerSize !== void 0 && containerSize.width)) return;
|
|
172
180
|
var width = containerSize.width;
|
|
173
181
|
var height = containerSize.height;
|
|
174
182
|
|
|
@@ -219,7 +227,8 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
219
227
|
|
|
220
228
|
_createClass(Controller, [{
|
|
221
229
|
key: "agentType",
|
|
222
|
-
get:
|
|
230
|
+
get: // null 表示加载失败
|
|
231
|
+
function get() {
|
|
223
232
|
var _this$videoAgentScene, _this$avatar;
|
|
224
233
|
|
|
225
234
|
var type = (0, _getMediaInfo.getMediaType)((_this$videoAgentScene = this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.videoUrl);
|
|
@@ -362,10 +371,10 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
362
371
|
if (keyframe.parsed) return;
|
|
363
372
|
keyframe.parsed = true;
|
|
364
373
|
|
|
365
|
-
_this3.emit(keyframe.type, keyframe);
|
|
374
|
+
_this3.emit(keyframe.type, keyframe, _this3.currentTime);
|
|
366
375
|
|
|
367
376
|
if (callback) {
|
|
368
|
-
callback(keyframe.type, keyframe);
|
|
377
|
+
callback(keyframe.type, keyframe, _this3.currentTime);
|
|
369
378
|
}
|
|
370
379
|
});
|
|
371
380
|
}
|
package/lib/Player/index.js
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.Player = void 0;
|
|
9
9
|
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
10
12
|
var ReactDOM = _interopRequireWildcard(require("react-dom"));
|
|
11
13
|
|
|
12
14
|
var _five = require("@realsee/five");
|
|
@@ -251,7 +253,7 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
251
253
|
this.controller.setEnded(false);
|
|
252
254
|
this.play();
|
|
253
255
|
this.controller.run(function (type, keyframe) {
|
|
254
|
-
return _this2.emit(type, keyframe);
|
|
256
|
+
return _this2.emit(type, keyframe, _this2.controller.currentTime);
|
|
255
257
|
});
|
|
256
258
|
this.controller.setLoading(false);
|
|
257
259
|
return _context.abrupt("return", true);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import AudioLike from '../../../shared-utils/
|
|
2
|
+
import AudioLike from '../../../shared-utils/AudioLike';
|
|
3
3
|
export interface VideoAgentMeshOptions {
|
|
4
4
|
/**
|
|
5
5
|
* 自定义视频实例。
|
|
@@ -40,7 +40,7 @@ export declare class VideoAgentMesh extends THREE.Mesh {
|
|
|
40
40
|
private update;
|
|
41
41
|
play(videoUrl?: string, currentTime?: number, duration?: number): Promise<unknown>;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* 秒转成毫秒,保障精准度
|
|
44
44
|
*/
|
|
45
45
|
get currentTime(): number;
|
|
46
46
|
dispose(): void;
|
|
@@ -13,7 +13,7 @@ var _Preloader = require("../../../shared-utils/Preloader");
|
|
|
13
13
|
|
|
14
14
|
var _mobx = require("mobx");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _AudioLike = _interopRequireDefault(require("../../../shared-utils/AudioLike"));
|
|
17
17
|
|
|
18
18
|
var _getMediaInfo = require("../../../shared-utils/getMediaInfo");
|
|
19
19
|
|
|
@@ -136,7 +136,7 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
136
136
|
_this.audioInstance = options.audioInstance;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
_this.audioLikeInstance = new
|
|
139
|
+
_this.audioLikeInstance = new _AudioLike["default"]();
|
|
140
140
|
(0, _mobx.makeObservable)(_assertThisInitialized(_this), {
|
|
141
141
|
paused: _mobx.observable
|
|
142
142
|
});
|
|
@@ -409,7 +409,7 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
409
409
|
return play;
|
|
410
410
|
}()
|
|
411
411
|
/**
|
|
412
|
-
*
|
|
412
|
+
* 秒转成毫秒,保障精准度
|
|
413
413
|
*/
|
|
414
414
|
|
|
415
415
|
}, {
|
|
@@ -36,7 +36,7 @@ function VideoAgent(props) {
|
|
|
36
36
|
|
|
37
37
|
if (showAvatar) return false;
|
|
38
38
|
return ((_controller$videoAgen = controller.videoAgentScene) === null || _controller$videoAgen === void 0 ? void 0 : _controller$videoAgen.videoAgentMesh.mediaInstance) instanceof HTMLVideoElement;
|
|
39
|
-
}, [controller.videoAgentScene]);
|
|
39
|
+
}, [controller.videoAgentScene, showAvatar]);
|
|
40
40
|
React.useEffect(function () {
|
|
41
41
|
if (!ref.current) throw new Error('React 渲染异常,请稍后重试 ...');
|
|
42
42
|
|
|
@@ -1,51 +1,200 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.Wave = Wave;
|
|
7
9
|
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
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
|
+
|
|
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; }
|
|
15
|
+
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
|
|
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
|
+
|
|
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
9
23
|
|
|
10
|
-
function
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
+
|
|
28
|
+
var prefix = 'https://vr-public.realsee-cdn.cn/release/static/image/release/';
|
|
29
|
+
var WAVES = {
|
|
30
|
+
single: {
|
|
31
|
+
width: 766,
|
|
32
|
+
height: 60,
|
|
33
|
+
frames: 20,
|
|
34
|
+
hevc: 'vapor/static/wave-single.140d197f4838c130b69e87dfd0705479.mov',
|
|
35
|
+
vp9: 'vapor/static/wave-single.eda65de390a830193fff40d1f1255555.webm',
|
|
36
|
+
png: 'vapor/static/wave-single.f51aade2a6e1c59211698a1a24e6135f.png'
|
|
37
|
+
},
|
|
38
|
+
"double": {
|
|
39
|
+
width: 766,
|
|
40
|
+
height: 60,
|
|
41
|
+
frames: 16,
|
|
42
|
+
hevc: 'vapor/static/wave-double.3e6d73050ee6958cc3060b107ebe5f39.mov',
|
|
43
|
+
vp9: '/vapor/static/wave-double.77dfe8548ebcb3f3d336785d4fe9c7b2.webm',
|
|
44
|
+
png: '/vapor/static/wave-double.ab4fe7d8a70395109ca4f759af7bd53f.png'
|
|
45
|
+
},
|
|
46
|
+
solid: {
|
|
47
|
+
width: 1126,
|
|
48
|
+
height: 90,
|
|
49
|
+
frames: 48,
|
|
50
|
+
hevc: 'vapor/static/wave-solid.cf68912a93275d07aa6b5097ea11fdda.mov',
|
|
51
|
+
vp9: 'vapor/static/wave-solid.64438b63cbb346906d066bb7b8dc3e20.webm',
|
|
52
|
+
png: 'vapor/static/wave-solid.6969d7f3f2f44f7ac1ade30e65660cb1.png'
|
|
53
|
+
},
|
|
54
|
+
swap: {
|
|
55
|
+
width: 2250,
|
|
56
|
+
height: 180,
|
|
57
|
+
frames: 41,
|
|
58
|
+
hevc: 'vapor/static/wave-swap.b38f22e2cf84ee21e9be35f7f56c9cfc.mov',
|
|
59
|
+
vp9: 'vapor/static/wave-swap.c02e4b94cf05aecf6e7a0023bc7bb90f.webm',
|
|
60
|
+
png: 'vapor/static/wave-swap.772ba526a7210dcc01567062c6319545.png'
|
|
61
|
+
},
|
|
62
|
+
expand: {
|
|
63
|
+
width: 2250,
|
|
64
|
+
height: 180,
|
|
65
|
+
frames: 45,
|
|
66
|
+
hevc: 'vapor/static/wave-expand.9529956c5954740cd4c9d07d51e32822.mov',
|
|
67
|
+
vp9: 'vapor/static/wave-expand.a0d2a0074001cd3d4fea56818c6d3c38.webm',
|
|
68
|
+
png: 'vapor/static/wave-expand.62fcf27b445533e6eb1b17bab5eafa0d.png'
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : '';
|
|
72
|
+
var isAppleDevice = /(iPhone|iPad|iPod)/i.test(userAgent);
|
|
73
|
+
var isSafari = /safari/i.test(userAgent) && !/chrome/i.test(userAgent) && /version/i.test(userAgent);
|
|
74
|
+
var isMicroMessenger = /microMessenger/i.test(userAgent);
|
|
75
|
+
var canPlayHevc = isAppleDevice || isSafari;
|
|
76
|
+
var canPlayVp9 = typeof MediaSource !== 'undefined' && MediaSource.isTypeSupported("video/webm; codecs=vp9");
|
|
11
77
|
|
|
12
78
|
function Wave(props) {
|
|
13
|
-
var
|
|
79
|
+
var wave = _react["default"].useMemo(function () {
|
|
14
80
|
var _props$appearance;
|
|
15
81
|
|
|
16
82
|
var appearance = (_props$appearance = props === null || props === void 0 ? void 0 : props.appearance) !== null && _props$appearance !== void 0 ? _props$appearance : 'solid';
|
|
83
|
+
return WAVES[appearance];
|
|
84
|
+
}, [props === null || props === void 0 ? void 0 : props.appearance]);
|
|
17
85
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
86
|
+
var heightWidthRatio = _react["default"].useMemo(function () {
|
|
87
|
+
return wave.height / wave.width;
|
|
88
|
+
}, [wave]);
|
|
21
89
|
|
|
22
|
-
|
|
23
|
-
|
|
90
|
+
var content = null;
|
|
91
|
+
|
|
92
|
+
if (isMicroMessenger) {
|
|
93
|
+
content = /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
|
|
94
|
+
wave: wave
|
|
95
|
+
});
|
|
96
|
+
} else if (canPlayHevc) {
|
|
97
|
+
content = /*#__PURE__*/_react["default"].createElement(VideoWaveContent, {
|
|
98
|
+
format: "hevc",
|
|
99
|
+
wave: wave
|
|
100
|
+
});
|
|
101
|
+
} else if (canPlayVp9) {
|
|
102
|
+
content = /*#__PURE__*/_react["default"].createElement(VideoWaveContent, {
|
|
103
|
+
format: "vp9",
|
|
104
|
+
wave: wave
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
content = /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
|
|
108
|
+
wave: wave
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
113
|
+
className: "vreo-wave"
|
|
114
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
115
|
+
style: {
|
|
116
|
+
position: 'relative',
|
|
117
|
+
width: '100%',
|
|
118
|
+
paddingTop: "".concat(heightWidthRatio * 100, "%")
|
|
119
|
+
}
|
|
120
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
121
|
+
style: {
|
|
122
|
+
position: 'absolute',
|
|
123
|
+
width: '100%',
|
|
124
|
+
height: '100%',
|
|
125
|
+
left: 0,
|
|
126
|
+
top: 0
|
|
127
|
+
}
|
|
128
|
+
}, content)));
|
|
129
|
+
}
|
|
24
130
|
|
|
25
|
-
|
|
26
|
-
|
|
131
|
+
var VideoWaveContent = function VideoWaveContent(_ref) {
|
|
132
|
+
var wave = _ref.wave,
|
|
133
|
+
format = _ref.format;
|
|
134
|
+
var videoRef = (0, _react.useRef)(null);
|
|
27
135
|
|
|
28
|
-
|
|
29
|
-
|
|
136
|
+
var _useState = (0, _react.useState)(false),
|
|
137
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
138
|
+
canPlay = _useState2[0],
|
|
139
|
+
setCanPlay = _useState2[1];
|
|
30
140
|
|
|
31
|
-
|
|
32
|
-
|
|
141
|
+
var _useState3 = (0, _react.useState)(false),
|
|
142
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
143
|
+
errored = _useState4[0],
|
|
144
|
+
setErrored = _useState4[1];
|
|
33
145
|
|
|
34
|
-
|
|
35
|
-
|
|
146
|
+
var source = prefix + wave[format];
|
|
147
|
+
(0, _react.useEffect)(function () {
|
|
148
|
+
setCanPlay(false);
|
|
149
|
+
}, [source]);
|
|
150
|
+
var canPlayHandler = (0, _react.useCallback)(function () {
|
|
151
|
+
if (videoRef.current) {
|
|
152
|
+
videoRef.current.play();
|
|
36
153
|
}
|
|
37
|
-
|
|
154
|
+
|
|
155
|
+
setCanPlay(true);
|
|
156
|
+
}, []);
|
|
157
|
+
var errorHandler = (0, _react.useCallback)(function () {
|
|
158
|
+
setErrored(true);
|
|
159
|
+
}, []);
|
|
160
|
+
|
|
161
|
+
if (errored) {
|
|
162
|
+
return /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
|
|
163
|
+
wave: wave
|
|
164
|
+
});
|
|
165
|
+
}
|
|
38
166
|
|
|
39
167
|
return /*#__PURE__*/_react["default"].createElement("video", {
|
|
40
|
-
|
|
41
|
-
|
|
168
|
+
style: {
|
|
169
|
+
opacity: canPlay ? 1 : 0
|
|
170
|
+
},
|
|
42
171
|
preload: "auto",
|
|
43
|
-
|
|
172
|
+
ref: videoRef,
|
|
173
|
+
width: "100%",
|
|
174
|
+
height: "100%",
|
|
175
|
+
playsInline: true,
|
|
44
176
|
autoPlay: true,
|
|
177
|
+
onCanPlay: canPlayHandler,
|
|
178
|
+
onError: errorHandler,
|
|
179
|
+
muted: true,
|
|
45
180
|
loop: true,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
181
|
+
src: source
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
var KeyframeWaveContent = function KeyframeWaveContent(_ref2) {
|
|
186
|
+
var wave = _ref2.wave;
|
|
187
|
+
var source = prefix + wave.png;
|
|
188
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
189
|
+
style: {
|
|
190
|
+
width: "100%",
|
|
191
|
+
height: "100%",
|
|
192
|
+
backgroundImage: "url(".concat(source, ")"),
|
|
193
|
+
backgroundSize: "100%",
|
|
194
|
+
animationName: "vreo-wave-keyframes",
|
|
195
|
+
animationTimingFunction: "steps(".concat(wave.frames - 1, ")"),
|
|
196
|
+
animationDuration: "".concat(wave.frames / 25, "s"),
|
|
197
|
+
animationIterationCount: 'infinite'
|
|
198
|
+
}
|
|
50
199
|
});
|
|
51
|
-
}
|
|
200
|
+
};
|
|
@@ -17,6 +17,28 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
17
17
|
|
|
18
18
|
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; }
|
|
19
19
|
|
|
20
|
+
var audioList = [];
|
|
21
|
+
|
|
22
|
+
function getAudio() {
|
|
23
|
+
var src = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
24
|
+
var currentTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
25
|
+
|
|
26
|
+
var audio = function () {
|
|
27
|
+
var audio = audioList.find(function (audio) {
|
|
28
|
+
return audio.src === src && audio.paused;
|
|
29
|
+
});
|
|
30
|
+
if (audio) return audio;else {
|
|
31
|
+
var newAudio = new Audio(src);
|
|
32
|
+
audioList.push(newAudio);
|
|
33
|
+
return newAudio;
|
|
34
|
+
}
|
|
35
|
+
}();
|
|
36
|
+
|
|
37
|
+
audio.currentTime = currentTime;
|
|
38
|
+
audio.setAttribute('playsinline', 'true');
|
|
39
|
+
return audio;
|
|
40
|
+
}
|
|
41
|
+
|
|
20
42
|
function BgMusic() {
|
|
21
43
|
var controller = (0, _hooks.useController)();
|
|
22
44
|
var timeoutIdRef = React.useRef(null);
|
|
@@ -27,19 +49,13 @@ function BgMusic() {
|
|
|
27
49
|
}
|
|
28
50
|
}, []);
|
|
29
51
|
React.useEffect(function () {
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
audio.loop = true;
|
|
35
|
-
document.body.append(audio);
|
|
36
|
-
|
|
37
|
-
var callback = function callback(keyframe) {
|
|
52
|
+
var callback = function callback(keyframe, currentTime) {
|
|
53
|
+
console.log({
|
|
54
|
+
currentTime: currentTime
|
|
55
|
+
});
|
|
38
56
|
var start = keyframe.start,
|
|
39
57
|
end = keyframe.end;
|
|
40
|
-
var
|
|
41
|
-
url = _ref.url;
|
|
42
|
-
audio.src = url;
|
|
58
|
+
var audio = getAudio(keyframe.data.url, Math.max(currentTime - start, 0));
|
|
43
59
|
|
|
44
60
|
var playCallback = function playCallback() {
|
|
45
61
|
audio.play();
|
|
@@ -49,15 +65,15 @@ function BgMusic() {
|
|
|
49
65
|
cleanTimeout();
|
|
50
66
|
|
|
51
67
|
var cleanAudio = function cleanAudio() {
|
|
68
|
+
console.log('cleanAudio', keyframe.start);
|
|
69
|
+
audio.removeEventListener('canplaythrough', playCallback);
|
|
52
70
|
audio.pause();
|
|
53
|
-
audio.currentTime = 0;
|
|
54
|
-
audio.src = '';
|
|
55
71
|
cleanTimeout();
|
|
56
|
-
audio.removeEventListener('canplaythrough', playCallback);
|
|
57
72
|
};
|
|
58
73
|
|
|
59
|
-
var duration = end - start
|
|
74
|
+
var duration = end - start;
|
|
60
75
|
timeoutIdRef.current = setTimeout(function () {
|
|
76
|
+
console.log('timeout', duration);
|
|
61
77
|
cleanAudio();
|
|
62
78
|
}, duration);
|
|
63
79
|
controller.once('paused', function () {
|
|
@@ -68,7 +84,6 @@ function BgMusic() {
|
|
|
68
84
|
controller.on(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
|
|
69
85
|
return function () {
|
|
70
86
|
controller.off(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
|
|
71
|
-
document.body.removeChild(audio);
|
|
72
87
|
cleanTimeout();
|
|
73
88
|
};
|
|
74
89
|
});
|
|
@@ -53,7 +53,7 @@ function PanoTag() {
|
|
|
53
53
|
end = keyframe.end,
|
|
54
54
|
data = keyframe.data;
|
|
55
55
|
var panoTagData = data;
|
|
56
|
-
var id =
|
|
56
|
+
var id = Date.now().toString();
|
|
57
57
|
var pointType = _dnalogel.PointType.PointTag;
|
|
58
58
|
var dimensionType = _dnalogel.DimensionType.Two;
|
|
59
59
|
var position = [panoTagData.vertex.x, panoTagData.vertex.y, panoTagData.vertex.z];
|
|
@@ -95,9 +95,9 @@ function PanoTag() {
|
|
|
95
95
|
timeoutRef.current = setTimeout(function () {
|
|
96
96
|
var _tag$hooks;
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
// clear
|
|
100
99
|
var tag = panoTagPlugin.current.getTagById(id);
|
|
100
|
+
if (!tag) return;
|
|
101
101
|
|
|
102
102
|
if (tag.state) {
|
|
103
103
|
tag.state.unfolded = false;
|
|
File without changes
|