@realsee/vreo 0.1.6 → 0.2.0-alpha.3

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.
Files changed (71) hide show
  1. package/README.md +36 -13
  2. package/docs/assets/custom.css +2 -2
  3. package/docs/assets/search.js +1 -1
  4. package/docs/classes/Player.Controller.html +54 -0
  5. package/docs/classes/Player.Player-1.html +11 -11
  6. package/docs/classes/Player.VideoAgentMesh.html +142 -0
  7. package/docs/classes/Player.VideoAgentScene.html +1 -0
  8. package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
  9. package/docs/enums/Player.PanoEffectEnum.html +2 -2
  10. package/docs/enums/Player.PanoTagEnum.html +1 -1
  11. package/docs/enums/Player.VreoKeyframeEnum.html +14 -12
  12. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  13. package/docs/enums/fivePlugins.Rotation.html +1 -1
  14. package/docs/index.html +25 -16
  15. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -0
  16. package/docs/interfaces/Player.PlayerConfigs.html +4 -2
  17. package/docs/interfaces/Player.Vertex.html +1 -1
  18. package/docs/interfaces/Player.VideoAgentMeshOptions.html +1 -0
  19. package/docs/interfaces/Player.VreoKeyframe.html +1 -1
  20. package/docs/interfaces/Player.VreoUnit.html +1 -1
  21. package/docs/interfaces/Player.VreoVideo.html +1 -1
  22. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  23. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +3 -3
  24. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
  25. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  26. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  27. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  28. package/docs/interfaces/react.VreoActionCallbacks.html +7 -7
  29. package/docs/interfaces/react.VreoProviderProps.html +1 -0
  30. package/docs/modules/Player.html +13 -13
  31. package/docs/modules/custom.html +3 -0
  32. package/docs/modules/fivePlugins.html +2 -2
  33. package/docs/modules/react.html +1 -1
  34. package/docs/modules.html +1 -1
  35. package/lib/Player/App.js +6 -2
  36. package/lib/Player/custom/SpatialScenePanel/index.d.ts +22 -0
  37. package/lib/Player/custom/SpatialScenePanel/index.js +207 -0
  38. package/lib/Player/index.js +27 -8
  39. package/lib/Player/modules/Drawer/index.js +1 -1
  40. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +1 -1
  41. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +19 -5
  42. package/lib/Player/modules/keyframes/BgMusic/index.d.ts +2 -0
  43. package/lib/Player/modules/keyframes/BgMusic/index.js +76 -0
  44. package/lib/Player/modules/keyframes/InfoPanel/index.js +52 -8
  45. package/lib/Player/modules/keyframes/ModelVideo/index.js +2 -2
  46. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +58 -11
  47. package/lib/Player/typings.d.ts +13 -1
  48. package/lib/fivePlugins/CameraMovementPlugin/index.js +6 -4
  49. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +2 -2
  50. package/lib/react/index.d.ts +5 -1
  51. package/lib/react/index.js +1 -1
  52. package/lib/typings/VreoUnit.d.ts +32 -3
  53. package/lib/typings/VreoUnit.js +1 -0
  54. package/package.json +4 -3
  55. package/resources/Player/App.tsx +4 -1
  56. package/resources/Player/custom/SpatialScenePanel/index.tsx +161 -0
  57. package/resources/Player/index.tsx +16 -1
  58. package/resources/Player/modules/Drawer/index.tsx +1 -1
  59. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +1 -1
  60. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +9 -0
  61. package/resources/Player/modules/keyframes/BgMusic/index.tsx +66 -0
  62. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +59 -6
  63. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +2 -2
  64. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +65 -11
  65. package/resources/Player/typings.ts +16 -1
  66. package/resources/fivePlugins/CameraMovementPlugin/index.ts +8 -6
  67. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -2
  68. package/resources/react/index.tsx +7 -2
  69. package/resources/typings/VreoUnit.ts +40 -3
  70. package/stylesheets/custom/SpatialScenePanel.css +303 -0
  71. package/stylesheets/default.css +46 -2
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.BgMusic = BgMusic;
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _VreoUnit = require("../../../../typings/VreoUnit");
13
+
14
+ var _hooks = require("../../../hooks");
15
+
16
+ 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); }
17
+
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
+
20
+ function BgMusic() {
21
+ var controller = (0, _hooks.useController)();
22
+ var timeoutIdRef = React.useRef(null);
23
+ var cleanTimeout = React.useCallback(function () {
24
+ if (timeoutIdRef.current) {
25
+ clearTimeout(timeoutIdRef.current);
26
+ timeoutIdRef.current = null;
27
+ }
28
+ }, []);
29
+ React.useEffect(function () {
30
+ var audio = new Audio();
31
+ audio.setAttribute('id', 'vreo-singleton-bgmusic');
32
+ audio.style.display = 'none';
33
+ audio.setAttribute('playsinline', 'true');
34
+ audio.loop = true;
35
+ document.body.append(audio);
36
+
37
+ var callback = function callback(keyframe) {
38
+ var start = keyframe.start,
39
+ end = keyframe.end;
40
+ var _ref = keyframe.data,
41
+ url = _ref.url;
42
+ audio.src = url;
43
+
44
+ var playCallback = function playCallback() {
45
+ audio.play();
46
+ };
47
+
48
+ audio.addEventListener('canplaythrough', playCallback);
49
+ cleanTimeout();
50
+
51
+ var cleanAudio = function cleanAudio() {
52
+ audio.pause();
53
+ audio.currentTime = 0;
54
+ audio.src = '';
55
+ cleanTimeout();
56
+ audio.removeEventListener('canplaythrough', playCallback);
57
+ };
58
+
59
+ var duration = end - start || 5000;
60
+ timeoutIdRef.current = setTimeout(function () {
61
+ cleanAudio();
62
+ }, duration);
63
+ controller.once('paused', function () {
64
+ cleanAudio();
65
+ });
66
+ };
67
+
68
+ controller.on(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
69
+ return function () {
70
+ controller.off(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
71
+ document.body.removeChild(audio);
72
+ cleanTimeout();
73
+ };
74
+ });
75
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
76
+ }
@@ -18,27 +18,47 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
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
20
  function InfoPanelImg(_ref) {
21
- var url = _ref.url;
21
+ var url = _ref.url,
22
+ children = _ref.children;
22
23
  return /*#__PURE__*/React.createElement("div", {
23
24
  className: "vreo-infoPanel vreo-infoPanel--img"
24
- }, /*#__PURE__*/React.createElement("img", {
25
+ }, children, /*#__PURE__*/React.createElement("div", {
25
26
  className: "vreo-infoPanelImg",
26
- src: url
27
+ style: {
28
+ backgroundImage: "url(".concat(url, ")")
29
+ }
27
30
  }));
28
31
  }
29
32
 
30
33
  function InfoPanelVideo(_ref2) {
31
- var url = _ref2.url;
34
+ var url = _ref2.url,
35
+ children = _ref2.children;
32
36
  return /*#__PURE__*/React.createElement("div", {
33
37
  className: "vreo-infoPanel vreo-infoPanel--video"
38
+ }, children, /*#__PURE__*/React.createElement("div", {
39
+ className: "vreo-infoPanelWrapper"
34
40
  }, /*#__PURE__*/React.createElement("video", {
35
41
  playsInline: true,
36
42
  autoPlay: true,
37
43
  className: "vreo-infoPanelVideo",
38
44
  src: url
39
- }));
45
+ })));
40
46
  }
41
47
 
48
+ var Title = function Title(props) {
49
+ if (!props.title && !props.subTitle) {
50
+ return null;
51
+ }
52
+
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ className: "vreo-infoPanel-title"
55
+ }, /*#__PURE__*/React.createElement("div", {
56
+ className: "vreo-infoPanel-t1"
57
+ }, props.title), /*#__PURE__*/React.createElement("div", {
58
+ className: "vreo-infoPanel-t2"
59
+ }, props.subTitle));
60
+ };
61
+
42
62
  function InfoPanel() {
43
63
  var timeoutRef = React.useRef();
44
64
  var controller = (0, _hooks.useController)();
@@ -54,19 +74,27 @@ function InfoPanel() {
54
74
  end = keyframe.end,
55
75
  data = keyframe.data;
56
76
  var infoPanelData = data;
77
+ var title = infoPanelData.title,
78
+ subTitle = infoPanelData.subTitle;
57
79
 
58
80
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
59
81
  controller.openDrawer({
60
82
  content: /*#__PURE__*/React.createElement(InfoPanelImg, {
61
83
  url: infoPanelData.url
62
- }),
84
+ }, /*#__PURE__*/React.createElement(Title, {
85
+ title: title,
86
+ subTitle: subTitle
87
+ })),
63
88
  height: '60vh'
64
89
  });
65
90
  } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
66
91
  controller.openDrawer({
67
92
  content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
68
93
  url: infoPanelData.url
69
- }),
94
+ }, /*#__PURE__*/React.createElement(Title, {
95
+ title: title,
96
+ subTitle: subTitle
97
+ })),
70
98
  height: '60vh'
71
99
  });
72
100
  }
@@ -76,7 +104,23 @@ function InfoPanel() {
76
104
  }, end - start);
77
105
  };
78
106
 
79
- controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
107
+ controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback); // Object.assign(window, {
108
+ // $setInfoPanel: () => {
109
+ // controller.openDrawer({
110
+ // content: (
111
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif'>
112
+ // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
113
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
114
+ // // </InfoPanelImg>
115
+ // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
116
+ // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
117
+ // </InfoPanelVideo>
118
+ // ),
119
+ // height: '60vh',
120
+ // })
121
+ // },
122
+ // })
123
+
80
124
  return function () {
81
125
  controller.off(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
82
126
 
@@ -48,8 +48,8 @@ function ModelVideo() {
48
48
  ref.current.disable();
49
49
  _context.next = 6;
50
50
  return ref.current.load({
51
- video_src: videoSrc.replace(/https*:/, ''),
52
- video_poster_src: videoPosterSrc.replace(/https*:/, ''),
51
+ video_src: videoSrc,
52
+ video_poster_src: videoPosterSrc,
53
53
  points: [vertexs]
54
54
  }, (_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.modelTVVideo);
55
55
 
@@ -22,29 +22,76 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
22
22
  function UpdateVRPanorama() {
23
23
  var controller = (0, _hooks.useController)();
24
24
  var five = (0, _hooks.useFiveInstance)();
25
+ var rawRef = React.useRef(null);
26
+ var workRef = React.useRef(null);
27
+ var restoreCallback = React.useCallback(function () {
28
+ if (rawRef.current) {
29
+ var work = (0, _five.parseWork)(rawRef.current);
30
+ five.load(work);
31
+ }
32
+
33
+ workRef.current = null;
34
+ }, []);
35
+ var pausedCallback = React.useCallback(function () {
36
+ if (rawRef.current) {
37
+ var work = (0, _five.parseWork)(rawRef.current);
38
+ five.load(work);
39
+ }
40
+ }, []);
41
+ var playingCallback = React.useCallback(function () {
42
+ if (!workRef.current) {
43
+ return;
44
+ }
45
+
46
+ five.load(workRef.current);
47
+ }, []);
25
48
  React.useEffect(function () {
26
49
  var callback = function callback(keyframe) {
27
50
  var _five$work;
28
51
 
29
- var _ref = keyframe.data,
30
- panoIndex = _ref.panoIndex,
31
- images = _ref.images;
32
- var newWorkJSON = JSON.parse(JSON.stringify((_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.work)); // // 原Work数据不能被修改
52
+ if (!rawRef.current) {
53
+ rawRef.current = five.work.raw.works;
54
+ }
33
55
 
34
- if (newWorkJSON.panorama && newWorkJSON.panorama.list && newWorkJSON.panorama.list[panoIndex]) {
35
- Object.assign(newWorkJSON.panorama.list[panoIndex], images);
36
- } else if (newWorkJSON.observers && newWorkJSON.observers[panoIndex] && newWorkJSON.observers[panoIndex].images) {
37
- Object.assign(newWorkJSON.observers[panoIndex].images, images);
56
+ var data = keyframe.data; // 如果数据中有新 work 数据,则直接载入
57
+
58
+ if (data.work) {
59
+ workRef.current = (0, _five.parseWork)(data.work);
60
+ five.load(workRef.current);
61
+ return;
38
62
  }
39
63
 
40
- var newWork = (0, _five.parseWork)(newWorkJSON); // // 需要还原么?待定 ...
64
+ var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0]; // 动态场景:不提供完成的签名数据,需重新整理
65
+
66
+ if (data.dynamic_scene && !data.panorama) {
67
+ var lastWork = JSON.parse(lastRawWork);
68
+ var panorama = lastWork.panorama;
69
+ var index = data.dynamic_scene.images.index;
70
+ panorama.list[index] = data.dynamic_scene.images;
71
+ data.panorama = panorama;
72
+ delete data.dynamic_scene;
73
+ }
41
74
 
42
- five.load(newWork);
75
+ workRef.current = (0, _five.parseWork)([lastRawWork, data]);
76
+ five.load(workRef.current);
43
77
  };
44
78
 
45
- controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
79
+ controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback); // 离开 将之前的内容清空
80
+
81
+ controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback); // 新载入数据 将之前的内容清空
82
+
83
+ controller.on('loaded', restoreCallback); // 暂停 回到默认状态
84
+
85
+ controller.on('paused', pausedCallback); // 播放 回归暂停前状态
86
+
87
+ controller.on('playing', playingCallback);
46
88
  return function () {
89
+ // 清理事件监听
47
90
  controller.off(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
91
+ controller.off(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback);
92
+ controller.off('loaded', restoreCallback);
93
+ controller.off('paused', pausedCallback);
94
+ controller.off('playing', playingCallback);
48
95
  };
49
96
  }, [controller]);
50
97
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -1,4 +1,6 @@
1
- import { VreoKeyframeConfigMap } from '../typings/VreoUnit';
1
+ import React, { ReactNode } from 'react';
2
+ import { Subscribe, Five } from '@realsee/five';
3
+ import { VreoKeyframeConfigMap, VreoKeyframeEvent } from '../typings/VreoUnit';
2
4
  export interface PlayerConfigs {
3
5
  containter?: ReactDOM.Container;
4
6
  keyframeMap: VreoKeyframeConfigMap;
@@ -11,4 +13,14 @@ export interface PlayerConfigs {
11
13
  videoEffect?: HTMLVideoElement;
12
14
  modelTVVideo?: HTMLVideoElement;
13
15
  };
16
+ /**
17
+ * 如果需要在 底部面板添加自定义内容,可以传递个 React 组件。
18
+ */
19
+ customPanelChildren?: ReactNode;
20
+ customKeyframes?: React.FC<CustomVreoKeyframeProps>[];
21
+ }
22
+ export declare type VreoSubscribe = Pick<Subscribe<VreoKeyframeEvent>, 'on' | 'once' | 'off'>;
23
+ export interface CustomVreoKeyframeProps {
24
+ subscribe: VreoSubscribe;
25
+ five: Five;
14
26
  }
@@ -128,7 +128,7 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
128
128
  var panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
129
129
 
130
130
  if (panoIndex !== undefined) {
131
- five.moveToPano(panoIndex, Object.assign({
131
+ var movePanoOptions = {
132
132
  duration: duration,
133
133
  // 移动耗时
134
134
  moveEndCallback: function moveEndCallback() {
@@ -137,9 +137,11 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
137
137
  // 移动结束
138
138
  moveCancelCallback: function moveCancelCallback() {
139
139
  return reject(false);
140
- } // 移动开始
141
-
142
- }, args));
140
+ },
141
+ // 移动开始
142
+ effect: 'fade'
143
+ };
144
+ five.moveToPano(panoIndex, Object.assign(movePanoOptions, args));
143
145
  } else {
144
146
  reject(false);
145
147
  }
@@ -1,4 +1,4 @@
1
- import { Mode, Pose } from '@realsee/five';
1
+ import { Mode, MovePanoOptions, Pose } from '@realsee/five';
2
2
  export interface CameraMovementPluginParameterType {
3
3
  }
4
4
  export interface CameraMovementPluginExportType {
@@ -33,7 +33,7 @@ export interface CameraMovementOptsCallback {
33
33
  export declare type MoveArgs = {
34
34
  mode: Mode;
35
35
  panoIndex: number;
36
- } & Pose;
36
+ } & Pose & Pick<MovePanoOptions, 'effect'>;
37
37
  export declare type MoveOpts = {
38
38
  preload?: boolean;
39
39
  } & CameraMovementOptsCallback;
@@ -1,6 +1,10 @@
1
1
  import * as React from 'react';
2
+ import { PlayerConfigs } from '../Player/typings';
2
3
  import { VreoKeyframeEvent, VreoUnit } from '../typings/VreoUnit';
3
- export declare const VreoProvider: React.FC;
4
+ export interface VreoProviderProps {
5
+ configs?: Partial<PlayerConfigs>;
6
+ }
7
+ export declare const VreoProvider: React.FC<VreoProviderProps>;
4
8
  /**
5
9
  * VreoPlayer 命令集合。
6
10
  */
@@ -44,7 +44,7 @@ var VreoProvider = function VreoProvider(props) {
44
44
 
45
45
  var playerRef = React.useRef(null);
46
46
  React.useEffect(function () {
47
- playerRef.current = new _Player.Player(five);
47
+ playerRef.current = new _Player.Player(five, props.configs || {});
48
48
  setPlayer(playerRef.current);
49
49
  return function () {
50
50
  var _playerRef$current;
@@ -1,4 +1,4 @@
1
- import { Mode, Pose, WorkCubeImage } from '@realsee/five';
1
+ import { Mode, Pose } from '@realsee/five';
2
2
  import { CameraMovementEffect, Rotation } from '../fivePlugins/CameraMovementPlugin/typings';
3
3
  export declare enum VreoKeyframeEnum {
4
4
  /** 运镜 */
@@ -35,6 +35,10 @@ export declare enum VreoKeyframeEnum {
35
35
  * 视频特效
36
36
  */
37
37
  VideoEffect = "VideoEffect",
38
+ /**
39
+ * 背景音乐
40
+ */
41
+ BgMusic = "BgMusic",
38
42
  /**
39
43
  * 结束
40
44
  */
@@ -57,6 +61,7 @@ export declare type VreoKeyframeConfigMap = {
57
61
  * 剧本关键帧
58
62
  */
59
63
  export interface VreoKeyframe {
64
+ uuid: string;
60
65
  type: VreoKeyframeEnum;
61
66
  start: number;
62
67
  end: number;
@@ -89,8 +94,10 @@ export interface VreoUnit {
89
94
  export declare type VreoKeyframeEvent = {
90
95
  [key in VreoKeyframeEnum]: (keyframe: VreoKeyframe) => void;
91
96
  } & {
97
+ loaded: (vreoUnit: VreoUnit) => void;
92
98
  paused: () => void;
93
99
  playing: () => void;
100
+ unknownKeyframeType: (keyframe: Record<string, any>) => void;
94
101
  };
95
102
  /**
96
103
  * 相机运动
@@ -113,8 +120,22 @@ export declare type PrompterData = {
113
120
  * VR 全景切换
114
121
  */
115
122
  export declare type UpdateVRPanoramaData = {
116
- panoIndex: number;
117
- images: WorkCubeImage;
123
+ _signature: string;
124
+ allow_hosts: string[];
125
+ certificate: string;
126
+ expire_at: string;
127
+ dynamic_scene?: {
128
+ images: {
129
+ index: number;
130
+ right: string;
131
+ left: string;
132
+ up: string;
133
+ down: string;
134
+ front: string;
135
+ back: string;
136
+ };
137
+ };
138
+ [key: string]: any;
118
139
  };
119
140
  /**
120
141
  * 顶点
@@ -195,6 +216,8 @@ export declare enum InfoPanelTypeEnum {
195
216
  export declare type InfoPanelData = {
196
217
  type: InfoPanelTypeEnum;
197
218
  url: string;
219
+ title?: string;
220
+ subTitle?: string;
198
221
  };
199
222
  /**
200
223
  * 视频特效
@@ -206,5 +229,11 @@ export declare type VideoEffectData = {
206
229
  direction?: Vertex;
207
230
  vector?: Pick<Pose, 'longitude' | 'latitude'>;
208
231
  };
232
+ /**
233
+ * 背景音乐
234
+ */
235
+ export declare type BgMusicData = {
236
+ url: string;
237
+ };
209
238
  /** 自定义序列帧 */
210
239
  export declare type CustomData = Record<string, any>;
@@ -21,6 +21,7 @@ exports.VreoKeyframeEnum = VreoKeyframeEnum;
21
21
  VreoKeyframeEnum["PanoEffect"] = "PanoEffect";
22
22
  VreoKeyframeEnum["InfoPanel"] = "InfoPanel";
23
23
  VreoKeyframeEnum["VideoEffect"] = "VideoEffect";
24
+ VreoKeyframeEnum["BgMusic"] = "BgMusic";
24
25
  VreoKeyframeEnum["Exit"] = "Exit";
25
26
  VreoKeyframeEnum["Custom"] = "Custom";
26
27
  })(VreoKeyframeEnum || (exports.VreoKeyframeEnum = VreoKeyframeEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realsee/vreo",
3
- "version": "0.1.6",
3
+ "version": "0.2.0-alpha.3",
4
4
  "description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
5
5
  "keywords": [
6
6
  "realsee",
@@ -25,7 +25,7 @@
25
25
  "packages": "node ./dev-tools/build-packages.js"
26
26
  },
27
27
  "peerDependencies": {
28
- "@realsee/five": "^5.0.0-alpha.53",
28
+ "@realsee/five": "^5.0.0-alpha.103",
29
29
  "react": "^16.0.0",
30
30
  "react-dom": "^16.0.0"
31
31
  },
@@ -35,7 +35,8 @@
35
35
  "@babel/preset-env": "^7.16.4",
36
36
  "@babel/preset-react": "^7.16.0",
37
37
  "@babel/preset-typescript": "^7.16.0",
38
- "@realsee/five": "^5.0.0-alpha.80",
38
+ "@realsee/dnalogel": "^0.1.7-alpha.10",
39
+ "@realsee/five": "^5.0.0-alpha.103",
39
40
  "@types/offscreencanvas": "^2019.6.4",
40
41
  "@types/react": "^17.0.37",
41
42
  "@types/react-dom": "^17.0.11",
@@ -2,7 +2,7 @@ import * as React from 'react'
2
2
  import classNames from 'classnames'
3
3
  import { observer } from 'mobx-react'
4
4
  import { Controller } from './Controller'
5
- import { useController } from './hooks'
5
+ import { useController, useFiveInstance } from './hooks'
6
6
  import { CameraMovement } from './modules/keyframes/CameraMovement'
7
7
  import { InfoPanel } from './modules/keyframes/InfoPanel'
8
8
  import { ModelVideo } from './modules/keyframes/ModelVideo'
@@ -13,6 +13,7 @@ import { Prompter } from './modules/keyframes/Prompter'
13
13
  import { UpdateVRPanorama } from './modules/keyframes/UpdateVRPanorama'
14
14
  import { VideoEffect } from './modules/keyframes/VideoEffect'
15
15
  import { VideoAgent } from './modules/VideoAgent'
16
+ import { BgMusic } from './modules/keyframes/BgMusic'
16
17
 
17
18
  const AppView = observer(({ controller }: { controller: Controller }) => {
18
19
  return (
@@ -35,6 +36,7 @@ const AppView = observer(({ controller }: { controller: Controller }) => {
35
36
  }}
36
37
  />
37
38
  <Prompter />
39
+ {controller.configs?.customPanelChildren}
38
40
  </div>
39
41
  </div>
40
42
  )
@@ -53,6 +55,7 @@ export function App() {
53
55
  <PanoTextLabel />
54
56
  <InfoPanel />
55
57
  <PanoEffect />
58
+ <BgMusic />
56
59
  </>
57
60
  <AppView controller={controller} />
58
61
  </>