@realsee/vreo 0.2.0-alpha.6 → 0.2.0-alpha.9

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 (68) hide show
  1. package/README.md +47 -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 +21 -1
  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/App.js +4 -3
  38. package/lib/Player/custom/SpatialScenePanel/index.js +86 -14
  39. package/lib/Player/index.d.ts +1 -1
  40. package/lib/Player/index.js +68 -9
  41. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +1 -0
  42. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +5 -1
  43. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +4 -1
  44. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -1
  45. package/lib/Player/modules/VideoAgent/index.d.ts +2 -0
  46. package/lib/Player/modules/VideoAgent/index.js +1 -1
  47. package/lib/Player/modules/keyframes/CameraMovement/index.js +41 -5
  48. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +23 -15
  49. package/lib/Player/typings.d.ts +6 -0
  50. package/lib/fivePlugins/CameraMovementPlugin/index.js +101 -90
  51. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +3 -2
  52. package/lib/typings/VreoUnit.d.ts +4 -3
  53. package/package.json +2 -2
  54. package/resources/PlayController/createHTMLAudioElement.ts +53 -0
  55. package/resources/PlayController/index.ts +167 -0
  56. package/resources/Player/App.tsx +2 -0
  57. package/resources/Player/custom/SpatialScenePanel/index.tsx +84 -8
  58. package/resources/Player/index.tsx +34 -2
  59. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +4 -3
  60. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +2 -2
  61. package/resources/Player/modules/VideoAgent/index.tsx +3 -2
  62. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
  63. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +20 -15
  64. package/resources/Player/typings.ts +5 -0
  65. package/resources/fivePlugins/CameraMovementPlugin/index.ts +55 -47
  66. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
  67. package/resources/typings/VreoUnit.ts +5 -4
  68. package/stylesheets/custom/SpatialScenePanel.css +14 -8
package/README.md CHANGED
@@ -477,9 +477,23 @@ const creatVideo = (): HTMLVideoElement => {
477
477
  return video
478
478
  }
479
479
 
480
+ const creatAudio = (): HTMLVideoElement => {
481
+ const audio = document.createElement('audio')
482
+
483
+ video.setAttribute('autoplay', 'true')
484
+
485
+ return audio
486
+ }
487
+
480
488
  // 提前创建 Video
489
+ // 视频特效
481
490
  const videoEffect = creatVideo()
491
+ // 视频广告
482
492
  const modelTVVideo = creatVideo()
493
+ // 视频数字人形象
494
+ const videoInstance = creatVideo()
495
+ // 无数字人,仅音频
496
+ const audioInstance = createAudio()
483
497
 
484
498
  // 微信限制:需在 WeixinJSBridgeReady 回调中触发一次
485
499
  document.addEventListener(
@@ -487,6 +501,8 @@ document.addEventListener(
487
501
  () => {
488
502
  videoEffect.play()
489
503
  modelTVVideo.play()
504
+ videoInstance.play()
505
+ audioInstance.play
490
506
  },
491
507
  false
492
508
  )
@@ -497,11 +513,42 @@ const vreoplayer = new Player(five, {
497
513
  videoEffect, // 视频特效 时依赖的 HTMLVideoElement
498
514
  modelTVVideo, // 视频广告 时依赖的 HTMLVideoElement
499
515
  },
516
+ videoAgentMeshOptions: {
517
+ videoInstance,
518
+ audioInstance,
519
+ }
500
520
  })
501
521
  ```
502
522
 
503
523
  这样,在微信浏览器或微信小程序 `WebView` 中也能正常使用自动播效果。
504
524
 
525
+ ### 性能优化
526
+
527
+ 提高播放性能目前有两个策略:降低贴图分辨率和提前预载。
528
+
529
+ #### 降低图片分辨率
530
+
531
+ 可以设置 `five.imageOptions.size` 来降低渲染引擎的贴图尺寸,这样下载速度会变快且内存占用也会降低。
532
+ 你也可以配置 **Vreo** 参数来达到类似的效果:
533
+
534
+ ```ts
535
+ const vreoplayer = new Player(five, { imageOptions: { size: 1024 } })
536
+ ```
537
+
538
+ #### 自动预载
539
+
540
+ 如果网络不稳定,可以提前预载静态资源,这样播放过程中不会卡顿:
541
+
542
+ ```ts
543
+ // 全局预载
544
+ const vreoplayer = new Player(five, { autoPreload: true })
545
+
546
+ // 针对某一份剧本数据预载
547
+ vreoplayer.load(vreoUnit, 0, true)
548
+
549
+ ```
550
+
551
+
505
552
  ## API 文档
506
553
 
507
554
  详细的 API 文档请参考:[Vreo API](https://realsee-developer.github.io/vreo/index.html) 。