@realsee/vreo 0.2.0-alpha.7 → 0.2.0-alpha.8

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 (56) hide show
  1. package/README.md +27 -0
  2. package/docs/assets/search.js +1 -1
  3. package/docs/classes/Player.Controller.html +3 -3
  4. package/docs/classes/Player.Player-1.html +3 -3
  5. package/docs/classes/Player.VideoAgentMesh.html +11 -11
  6. package/docs/classes/Player.VideoAgentScene.html +1 -1
  7. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
  8. package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
  9. package/docs/enums/Player.PanoEffectEnum.html +1 -1
  10. package/docs/enums/Player.PanoTagEnum.html +1 -1
  11. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  12. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  13. package/docs/enums/fivePlugins.Rotation.html +1 -1
  14. package/docs/index.html +20 -0
  15. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  16. package/docs/interfaces/Player.PlayerConfigs.html +3 -3
  17. package/docs/interfaces/Player.Vertex.html +1 -1
  18. package/docs/interfaces/Player.VideoAgentMeshOptions.html +1 -1
  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 +2 -2
  24. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  25. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  26. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  27. package/docs/interfaces/react.VreoActionCallbacks.html +6 -6
  28. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  29. package/docs/modules/Player.html +13 -13
  30. package/docs/modules/custom.html +1 -1
  31. package/docs/modules/fivePlugins.html +2 -2
  32. package/docs/modules/react.html +1 -1
  33. package/lib/PlayController/createHTMLAudioElement.d.ts +1 -0
  34. package/lib/PlayController/createHTMLAudioElement.js +47 -0
  35. package/lib/PlayController/index.d.ts +38 -0
  36. package/lib/PlayController/index.js +300 -0
  37. package/lib/Player/custom/SpatialScenePanel/index.js +0 -1
  38. package/lib/Player/index.d.ts +1 -1
  39. package/lib/Player/index.js +68 -9
  40. package/lib/Player/modules/keyframes/CameraMovement/index.js +41 -5
  41. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +23 -15
  42. package/lib/Player/typings.d.ts +4 -0
  43. package/lib/fivePlugins/CameraMovementPlugin/index.js +101 -90
  44. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +3 -2
  45. package/lib/typings/VreoUnit.d.ts +4 -3
  46. package/package.json +1 -1
  47. package/resources/PlayController/createHTMLAudioElement.ts +53 -0
  48. package/resources/PlayController/index.ts +167 -0
  49. package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -1
  50. package/resources/Player/index.tsx +34 -2
  51. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
  52. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +20 -15
  53. package/resources/Player/typings.ts +2 -0
  54. package/resources/fivePlugins/CameraMovementPlugin/index.ts +55 -47
  55. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
  56. package/resources/typings/VreoUnit.ts +5 -4
@@ -50,65 +50,73 @@ function progressNumber(from: number, to: number, pst: number) {
50
50
  export const CameraMovementPlugin: FivePlugin<CameraMovementPluginParameterType, CameraMovementPluginExportType> = (
51
51
  five: Five,
52
52
  ) => {
53
- const move = async (args: Partial<MoveArgs>, duration: number, opts: MoveOpts = { preload: true }) => {
54
- if (opts.asyncStartCallback) {
55
- opts.asyncStartCallback()
56
- }
53
+ const move = (args: Partial<MoveArgs>, duration: number, opts: MoveOpts = { preload: true }) => {
54
+ return new Promise<boolean>(async (resolve, reject) => {
55
+
56
+ if (opts.asyncStartCallback) {
57
+ opts.asyncStartCallback()
58
+ }
59
+
60
+ if (five.panoIndex === undefined) {
61
+ return reject(false)
62
+ }
57
63
 
58
- if (args.mode && args.mode !== five.currentMode) {
59
- await new Promise((resolve) => {
60
- if (!args.mode) return
61
- five.once('modeChange', (mode) => {
62
- five.once('initAnimationEnded', () => {
63
- if (mode === args.mode) {
64
- resolve(true)
65
- }
64
+ if (args.mode && args.mode !== five.currentMode) {
65
+ await new Promise((resolve) => {
66
+ if (!args.mode) return
67
+ five.once('modeChange', (mode) => {
68
+ five.once('initAnimationEnded', () => {
69
+ if (mode === args.mode) {
70
+ resolve(true)
71
+ }
72
+ })
73
+ })
74
+ five.changeMode(args.mode, {
75
+ fov: args.fov || undefined,
76
+ latitude: args.latitude || undefined,
77
+ longitude: args.longitude || undefined,
78
+ panoIndex: args.panoIndex || undefined,
66
79
  })
67
80
  })
68
- five.changeMode(args.mode, {
69
- fov: args.fov || undefined,
70
- latitude: args.latitude || undefined,
71
- longitude: args.longitude || undefined,
72
- panoIndex: args.panoIndex || undefined,
73
- })
74
- })
75
- }
81
+ }
76
82
 
77
- if (args.mode === Five.Mode.Floorplan) {
78
- return true
79
- }
83
+ if (args.mode === Five.Mode.Floorplan) {
84
+ return resolve(true)
85
+ }
80
86
 
81
- if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
82
- await five.preloadPano(args.panoIndex)
83
- }
87
+ if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
88
+ await five.preloadPano(args.panoIndex)
89
+ }
90
+
91
+ if (opts.asyncEndCallback) {
92
+ opts.asyncEndCallback()
93
+ }
94
+
95
+ if (
96
+ args.panoIndex === undefined &&
97
+ args.fov === undefined &&
98
+ args.latitude === undefined &&
99
+ args.longitude === undefined
100
+ ) {
101
+ return resolve(true)
102
+ }
84
103
 
85
- if (opts.asyncEndCallback) {
86
- opts.asyncEndCallback()
87
- }
88
104
 
89
- if (
90
- args.panoIndex === undefined &&
91
- args.fov === undefined &&
92
- args.latitude === undefined &&
93
- args.longitude === undefined
94
- ) {
95
- return true
96
- }
97
- return await new Promise<boolean>((resolve, reject) => {
98
105
  const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex
106
+
99
107
  if (panoIndex !== undefined) {
100
- const movePanoOptions: MovePanoOptions = {
108
+ const movePanoOptions: MovePanoOptions = Object.assign(args, {
101
109
  duration, // 移动耗时
102
110
  moveEndCallback: () => resolve(true), // 移动结束
103
- moveCancelCallback: () => reject(false), // 移动开始
104
- effect: 'fade',
105
- }
106
- five.moveToPano(
111
+ moveCancelCallback: () => {
112
+ resolve(true)
113
+ }, // 移动开始
114
+ // effect: args.transEffect || 'fade',
115
+ })
116
+
117
+ await five.moveToPano(
107
118
  panoIndex,
108
- Object.assign(
109
- movePanoOptions,
110
- args,
111
- ),
119
+ movePanoOptions,
112
120
  )
113
121
  } else {
114
122
  reject(false)
@@ -39,7 +39,8 @@ export interface CameraMovementOptsCallback {
39
39
  export type MoveArgs = {
40
40
  mode: Mode
41
41
  panoIndex: number
42
- } & Pose & Pick<MovePanoOptions, 'effect'>
42
+ transEffect?: "fly" | "fade" | "instant"
43
+ } & Pose
43
44
 
44
45
  export type MoveOpts = {
45
46
  preload?: boolean
@@ -1,4 +1,4 @@
1
- import { Mode, Pose } from '@realsee/five'
1
+ import { Mode, MovePanoOptions, Pose } from '@realsee/five'
2
2
  import { CameraMovementEffect, Rotation } from '../fivePlugins/CameraMovementPlugin/typings'
3
3
 
4
4
  export enum VreoKeyframeEnum {
@@ -65,7 +65,7 @@ export type VreoKeyframeConfigMap = {
65
65
  * 剧本关键帧
66
66
  */
67
67
  export interface VreoKeyframe {
68
- uuid: string
68
+ uuid?: string
69
69
  type: VreoKeyframeEnum
70
70
  start: number
71
71
  end: number
@@ -104,7 +104,7 @@ export type VreoKeyframeEvent = { [key in VreoKeyframeEnum]: (keyframe: VreoKeyf
104
104
  // 新数据载入完成
105
105
  loaded: (vreoUnit: VreoUnit) => void
106
106
  // 语音状态 播放 -> 暂停
107
- paused: () => void
107
+ paused: (ended?: boolean) => void
108
108
  // 语音状态 暂停 -> 播放
109
109
  playing: () => void
110
110
  // 未知的 剧本帧类型
@@ -115,7 +115,8 @@ export type VreoKeyframeEvent = { [key in VreoKeyframeEnum]: (keyframe: VreoKeyf
115
115
  * 相机运动
116
116
  */
117
117
  export type CameraMovementData = {
118
- effect: CameraMovementEffect
118
+ effect?: CameraMovementEffect
119
+ transEffect?: "fly" | "fade" | "instant"
119
120
  mode: Mode
120
121
  panoIndex: number
121
122
  loop?: boolean