@realsee/vreo 0.2.0-alpha.9 → 1.0.0-alpha.2

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 (156) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +16 -5
  3. package/docs/assets/highlight.css +1 -1
  4. package/docs/assets/main.js +2 -2
  5. package/docs/assets/search.js +1 -1
  6. package/docs/assets/style.css +28 -2
  7. package/docs/classes/Player.AudioLike.html +52 -0
  8. package/docs/classes/Player.Controller.html +13 -13
  9. package/docs/classes/Player.Player-1.html +11 -11
  10. package/docs/classes/Player.VideoAgentMesh.html +53 -53
  11. package/docs/classes/Player.VideoAgentScene.html +1 -1
  12. package/docs/demo/assets/AppReact.d0ee843a.js +1 -0
  13. package/docs/demo/assets/default.63925584.js +3984 -0
  14. package/docs/demo/assets/default.f3f3ca8c.css +1 -0
  15. package/docs/demo/assets/dynamic.76506c2c.js +1 -0
  16. package/docs/demo/assets/examples.3d8323db.js +25 -0
  17. package/docs/demo/assets/examples.dac4a6fe.css +1 -0
  18. package/docs/demo/assets/index.7e31122c.js +1 -0
  19. package/docs/demo/assets/index.9331038f.css +1 -0
  20. package/docs/demo/assets/main.79b11b9d.js +1 -0
  21. package/docs/demo/assets/react.2ee8565f.css +1 -0
  22. package/docs/demo/assets/react.c1c07c14.js +25 -0
  23. package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +1 -0
  24. package/docs/demo/examples.html +17 -0
  25. package/docs/demo/index-react-dynamic.html +20 -0
  26. package/docs/demo/index-react.html +20 -0
  27. package/docs/demo/index.html +19 -0
  28. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
  29. package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
  30. package/docs/enums/Player.PanoEffectEnum.html +2 -2
  31. package/docs/enums/Player.PanoTagEnum.html +2 -2
  32. package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
  33. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  34. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  35. package/docs/enums/fivePlugins.Rotation.html +1 -1
  36. package/docs/index.html +13 -6
  37. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  38. package/docs/interfaces/Player.PlayerConfigs.html +4 -3
  39. package/docs/interfaces/Player.Vertex.html +2 -2
  40. package/docs/interfaces/Player.VideoAgentMeshOptions.html +8 -1
  41. package/docs/interfaces/Player.VreoKeyframe.html +2 -2
  42. package/docs/interfaces/Player.VreoUnit.html +2 -2
  43. package/docs/interfaces/Player.VreoVideo.html +2 -2
  44. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +4 -0
  45. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  46. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  47. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
  48. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  49. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  50. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  51. package/docs/interfaces/fivePlugins.Vector3Position.html +3 -0
  52. package/docs/interfaces/react.VreoActionCallbacks.html +15 -7
  53. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  54. package/docs/modules/Player.html +21 -15
  55. package/docs/modules/custom.html +1 -1
  56. package/docs/modules/fivePlugins.html +5 -2
  57. package/docs/modules/react.html +1 -1
  58. package/docs/modules.html +1 -1
  59. package/lib/PlayController/index.js +4 -5
  60. package/lib/Player/App.js +9 -7
  61. package/lib/Player/Controller.d.ts +29 -8
  62. package/lib/Player/Controller.js +193 -27
  63. package/lib/Player/custom/SpatialScenePanel/index.js +5 -4
  64. package/lib/Player/hooks.js +2 -2
  65. package/lib/Player/index.d.ts +5 -3
  66. package/lib/Player/index.js +97 -53
  67. package/lib/Player/modules/Drawer/index.js +1 -1
  68. package/lib/Player/modules/PopUp/index.js +1 -1
  69. package/lib/Player/modules/ResizeObserver/index.d.ts +2 -0
  70. package/lib/Player/modules/ResizeObserver/index.js +37 -0
  71. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +16 -2
  72. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +132 -59
  73. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +3 -6
  74. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +31 -36
  75. package/lib/Player/modules/VideoAgent/index.js +53 -12
  76. package/lib/Player/modules/Wave/index.d.ts +5 -0
  77. package/lib/Player/modules/Wave/index.js +51 -0
  78. package/lib/Player/modules/keyframes/BgMusic/index.js +1 -1
  79. package/lib/Player/modules/keyframes/CameraMovement/index.js +1 -1
  80. package/lib/Player/modules/keyframes/InfoPanel/index.js +22 -10
  81. package/lib/Player/modules/keyframes/ModelVideo/index.js +46 -9
  82. package/lib/Player/modules/keyframes/PanoEffect/index.js +1 -1
  83. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -1
  84. package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -2
  85. package/lib/Player/modules/keyframes/PanoTag/index.js +79 -119
  86. package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +3 -0
  87. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +96 -44
  88. package/lib/Player/modules/keyframes/Prompter/index.js +10 -23
  89. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +10 -6
  90. package/lib/Player/modules/keyframes/VideoEffect/index.js +1 -1
  91. package/lib/Player/typings.d.ts +12 -1
  92. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -0
  93. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +12 -0
  94. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +7 -0
  95. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +32 -0
  96. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +3 -0
  97. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +11 -0
  98. package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +56 -0
  99. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +275 -0
  100. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +7 -0
  101. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +18 -0
  102. package/lib/fivePlugins/CameraMovementPlugin/index.js +13 -12
  103. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +1 -1
  104. package/lib/react/index.d.ts +8 -4
  105. package/lib/react/index.js +3 -3
  106. package/lib/shared-utils/AduioLike.d.ts +37 -0
  107. package/lib/shared-utils/AduioLike.js +166 -0
  108. package/lib/shared-utils/addResizeListener.d.ts +4 -0
  109. package/lib/shared-utils/addResizeListener.js +51 -0
  110. package/lib/shared-utils/animationFrame/BetterTween.js +7 -3
  111. package/lib/shared-utils/animationFrame/tween.js +1 -1
  112. package/lib/shared-utils/createTransMatrix.d.ts +1 -0
  113. package/lib/shared-utils/createTransMatrix.js +43 -0
  114. package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
  115. package/lib/shared-utils/getFileExpandedName.js +13 -0
  116. package/lib/shared-utils/getMediaInfo.d.ts +9 -0
  117. package/lib/shared-utils/getMediaInfo.js +75 -0
  118. package/lib/shared-utils/setElementDataset.d.ts +1 -0
  119. package/lib/shared-utils/setElementDataset.js +24 -0
  120. package/lib/typings/VreoUnit.d.ts +37 -2
  121. package/lib/typings/VreoUnit.js +13 -1
  122. package/package.json +10 -10
  123. package/resources/PlayController/index.ts +0 -13
  124. package/resources/Player/App.tsx +5 -4
  125. package/resources/Player/Controller.ts +277 -146
  126. package/resources/Player/custom/SpatialScenePanel/index.tsx +5 -5
  127. package/resources/Player/hooks.ts +3 -5
  128. package/resources/Player/index.tsx +189 -141
  129. package/resources/Player/modules/ResizeObserver/index.tsx +23 -0
  130. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +87 -31
  131. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +27 -24
  132. package/resources/Player/modules/VideoAgent/index.tsx +28 -12
  133. package/resources/Player/modules/Wave/index.tsx +18 -0
  134. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +26 -11
  135. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
  136. package/resources/Player/modules/keyframes/PanoTag/index.tsx +53 -97
  137. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +86 -34
  138. package/resources/Player/modules/keyframes/Prompter/index.tsx +6 -16
  139. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +6 -2
  140. package/resources/Player/typings.ts +15 -1
  141. package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +5 -0
  142. package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +17 -0
  143. package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +4 -0
  144. package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +254 -0
  145. package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +5 -0
  146. package/resources/fivePlugins/CameraMovementPlugin/index.ts +19 -12
  147. package/resources/react/index.tsx +7 -3
  148. package/resources/shared-utils/AduioLike.ts +109 -0
  149. package/resources/shared-utils/addResizeListener.ts +46 -0
  150. package/resources/shared-utils/createTransMatrix.ts +12 -0
  151. package/resources/shared-utils/getFileExpandedName.ts +6 -0
  152. package/resources/shared-utils/getMediaInfo.ts +52 -0
  153. package/resources/shared-utils/setElementDataset.ts +18 -0
  154. package/resources/typings/VreoUnit.ts +41 -3
  155. package/stylesheets/custom/SpatialScenePanel.css +2 -1
  156. package/stylesheets/default.css +348 -84
@@ -0,0 +1,52 @@
1
+ import getFileExpandedName from './getFileExpandedName'
2
+
3
+ export default function getMediaInfo(fileUrl: string): Promise<{
4
+ duration?: number | undefined
5
+ type?: 'video' | 'audio' | 'image' | 'unknown' | undefined
6
+ error?: string | undefined
7
+ }> {
8
+ const type = getMediaType(fileUrl)
9
+ if (!type) return Promise.resolve({ error: '未知的文件类型: ' + fileUrl })
10
+ const mediaElement = (() => {
11
+ if (type === 'video') return document.createElement('video')
12
+ if (type === 'audio') return document.createElement('audio')
13
+ })()
14
+ if (!mediaElement) return Promise.resolve({ error: 'Unknown media element' })
15
+ mediaElement.src = fileUrl
16
+ return new Promise<{ duration?: number; type?: 'video' | 'audio' | 'image' | 'unknown'; error?: string }>((resolve) => {
17
+ mediaElement.onerror = () => resolve({ error: 'onerror' })
18
+ mediaElement.onloadedmetadata = () => {
19
+ resolve({ duration: mediaElement.duration * 1000, type }) // s => ms
20
+ }
21
+ })
22
+ }
23
+
24
+ export function getMediaType(url?: string) {
25
+ const fileExpandedName = getFileExpandedName(url)
26
+ const type = getMediaTypeByExpandedName(fileExpandedName)
27
+ return type
28
+ }
29
+
30
+ export function getMediaTypeByExpandedName(fileExpandedName?: string | null) {
31
+ if (!fileExpandedName) return 'unknown'
32
+ if (/jpg|jpeg|png$/.test(fileExpandedName)) return 'image'
33
+ if (/mp3|wav$/.test(fileExpandedName)) return 'audio'
34
+ if (/avi|wmv|mpeg|mp4|m4v|mov|asf|flv|f4v|rmvb|rm|3gp|vob$/.test(fileExpandedName)) return 'video'
35
+ return 'unknown'
36
+ }
37
+
38
+ export function getMediaTypeByUrl(fileUrl?: string | null) {
39
+ if (!fileUrl) return
40
+ const fileExpandedName = getFileExpandedName(fileUrl)
41
+ return getMediaTypeByExpandedName(fileExpandedName)
42
+ }
43
+
44
+ export function getFileName(fileUrl?: string) {
45
+ if (!fileUrl) return ''
46
+ const index1 = fileUrl.lastIndexOf('/')
47
+ const index2 = fileUrl.lastIndexOf('\\')
48
+ const index3 = fileUrl.lastIndexOf('\\\\')
49
+ const index = Math.max(index1, index2, index3)
50
+ const ext = fileUrl.substring(index + 1)
51
+ return ext
52
+ }
@@ -0,0 +1,18 @@
1
+ export default function setElementDataset(element: any, dataset: Record<string, string | number>) {
2
+ if (element) {
3
+ Object.keys(dataset).forEach((key) => {
4
+
5
+ const value = dataset[key].toString()
6
+
7
+ if (element instanceof Element) {
8
+ element.setAttribute(`data-${key}`, value)
9
+ } else if (element instanceof Document) {
10
+ element.documentElement.setAttribute(`data-${key}`, value)
11
+ } else if (element instanceof HTMLElement) {
12
+ element.dataset[key] = value
13
+ } else {
14
+ (element as any).setAttribute(`data-${key}`, value)
15
+ }
16
+ })
17
+ }
18
+ }
@@ -1,4 +1,4 @@
1
- import { Mode, MovePanoOptions, Pose } from '@realsee/five'
1
+ import { Mode, Pose } from '@realsee/five'
2
2
  import { CameraMovementEffect, Rotation } from '../fivePlugins/CameraMovementPlugin/typings'
3
3
 
4
4
  export enum VreoKeyframeEnum {
@@ -81,6 +81,10 @@ export interface VreoVideo {
81
81
  start: number
82
82
  end: number
83
83
  url: string
84
+ avatar?: {
85
+ url: string
86
+ force?: true
87
+ }
84
88
  }
85
89
 
86
90
  /**
@@ -109,6 +113,8 @@ export type VreoKeyframeEvent = { [key in VreoKeyframeEnum]: (keyframe: VreoKeyf
109
113
  playing: () => void
110
114
  // 未知的 剧本帧类型
111
115
  unknownKeyframeType: (keyframe: Record<string, any>) => void
116
+ // 一次播放完成(试用,只抛事件不做任何额外的逻辑处理)
117
+ ended: () => void
112
118
  }
113
119
 
114
120
  /**
@@ -164,9 +170,13 @@ export interface Vertex {
164
170
  }
165
171
 
166
172
  /**
167
- * 四个顶点元组
173
+ * 矩形顶点
168
174
  */
169
175
  export type QuadrangleVertexs = [Vertex, Vertex, Vertex, Vertex]
176
+ /**
177
+ * 顶点数组
178
+ */
179
+ export type Vertexs = Vertex[]
170
180
 
171
181
  /**
172
182
  * 视频广告
@@ -183,7 +193,18 @@ export type ModelVideoData = {
183
193
  /**
184
194
  * 视频映射在模型中的顶点
185
195
  */
186
- vertexs: QuadrangleVertexs
196
+ vertexs: QuadrangleVertexs | Vertexs
197
+ matrixWorld?: number[]
198
+ }
199
+
200
+ /**
201
+ * 四元数
202
+ */
203
+ export type Quaternion = {
204
+ x: number,
205
+ y: number,
206
+ z: number,
207
+ w: number
187
208
  }
188
209
 
189
210
  /**
@@ -192,6 +213,8 @@ export type ModelVideoData = {
192
213
  export type PanoTextLabelData = {
193
214
  text: string
194
215
  vertex: Vertex
216
+ normal?: Vertex
217
+ quaternion?: Quaternion
195
218
  fontSize?: number
196
219
  }
197
220
 
@@ -203,8 +226,23 @@ export enum PanoTagEnum {
203
226
  Image = 'Image',
204
227
  }
205
228
 
229
+ /**
230
+ * 标签样式种类
231
+ */
232
+ export enum PanoTagStyleEnum {
233
+ /**
234
+ * 生长动画:默认值
235
+ */
236
+ Growth = 'Growth',
237
+ /**
238
+ * 展开动画
239
+ */
240
+ Expand = 'Expand',
241
+ }
242
+
206
243
  export type PanoTagData = {
207
244
  type: PanoTagEnum
245
+ style: PanoTagStyleEnum
208
246
  text: string
209
247
  vertex: Vertex
210
248
  imgUrl?: string
@@ -46,7 +46,8 @@
46
46
  top: 0;
47
47
  left: 0;
48
48
  pointer-events: none;
49
- user-select: none
49
+ -webkit-user-select: none;
50
+ user-select: none;
50
51
  }
51
52
 
52
53
  .SpatialScenePanel {