@vizor-vr/player 0.2.0

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 (344) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -0
  3. package/dist/__tests__/adapter-factory.test.d.ts +2 -0
  4. package/dist/__tests__/adapter-factory.test.d.ts.map +1 -0
  5. package/dist/__tests__/analytics-collector.test.d.ts +2 -0
  6. package/dist/__tests__/analytics-collector.test.d.ts.map +1 -0
  7. package/dist/__tests__/annotation-manager.test.d.ts +2 -0
  8. package/dist/__tests__/annotation-manager.test.d.ts.map +1 -0
  9. package/dist/__tests__/annotation-popup.test.d.ts +2 -0
  10. package/dist/__tests__/annotation-popup.test.d.ts.map +1 -0
  11. package/dist/__tests__/annotation-sprite.test.d.ts +2 -0
  12. package/dist/__tests__/annotation-sprite.test.d.ts.map +1 -0
  13. package/dist/__tests__/audio-manager.test.d.ts +2 -0
  14. package/dist/__tests__/audio-manager.test.d.ts.map +1 -0
  15. package/dist/__tests__/base-element-attrs.test.d.ts +2 -0
  16. package/dist/__tests__/base-element-attrs.test.d.ts.map +1 -0
  17. package/dist/__tests__/camera-controller.test.d.ts +2 -0
  18. package/dist/__tests__/camera-controller.test.d.ts.map +1 -0
  19. package/dist/__tests__/caption-renderer.test.d.ts +2 -0
  20. package/dist/__tests__/caption-renderer.test.d.ts.map +1 -0
  21. package/dist/__tests__/cc-button.test.d.ts +2 -0
  22. package/dist/__tests__/cc-button.test.d.ts.map +1 -0
  23. package/dist/__tests__/chat-button.test.d.ts +2 -0
  24. package/dist/__tests__/chat-button.test.d.ts.map +1 -0
  25. package/dist/__tests__/chat-panel.test.d.ts +2 -0
  26. package/dist/__tests__/chat-panel.test.d.ts.map +1 -0
  27. package/dist/__tests__/cinema-projection.test.d.ts +2 -0
  28. package/dist/__tests__/cinema-projection.test.d.ts.map +1 -0
  29. package/dist/__tests__/collab-client.test.d.ts +2 -0
  30. package/dist/__tests__/collab-client.test.d.ts.map +1 -0
  31. package/dist/__tests__/compass.test.d.ts +2 -0
  32. package/dist/__tests__/compass.test.d.ts.map +1 -0
  33. package/dist/__tests__/controls-overlay.test.d.ts +2 -0
  34. package/dist/__tests__/controls-overlay.test.d.ts.map +1 -0
  35. package/dist/__tests__/cubemap-projection.test.d.ts +2 -0
  36. package/dist/__tests__/cubemap-projection.test.d.ts.map +1 -0
  37. package/dist/__tests__/dash-adapter.test.d.ts +2 -0
  38. package/dist/__tests__/dash-adapter.test.d.ts.map +1 -0
  39. package/dist/__tests__/eac-projection.test.d.ts +2 -0
  40. package/dist/__tests__/eac-projection.test.d.ts.map +1 -0
  41. package/dist/__tests__/equirect-projection.test.d.ts +2 -0
  42. package/dist/__tests__/equirect-projection.test.d.ts.map +1 -0
  43. package/dist/__tests__/event-emitter.test.d.ts +2 -0
  44. package/dist/__tests__/event-emitter.test.d.ts.map +1 -0
  45. package/dist/__tests__/feature-gates-branding.test.d.ts +2 -0
  46. package/dist/__tests__/feature-gates-branding.test.d.ts.map +1 -0
  47. package/dist/__tests__/feature-gates.test.d.ts +2 -0
  48. package/dist/__tests__/feature-gates.test.d.ts.map +1 -0
  49. package/dist/__tests__/fisheye-projection.test.d.ts +2 -0
  50. package/dist/__tests__/fisheye-projection.test.d.ts.map +1 -0
  51. package/dist/__tests__/flat-projection.test.d.ts +2 -0
  52. package/dist/__tests__/flat-projection.test.d.ts.map +1 -0
  53. package/dist/__tests__/flat-video-integration.test.d.ts +2 -0
  54. package/dist/__tests__/flat-video-integration.test.d.ts.map +1 -0
  55. package/dist/__tests__/fullscreen-button.test.d.ts +2 -0
  56. package/dist/__tests__/fullscreen-button.test.d.ts.map +1 -0
  57. package/dist/__tests__/gaze-cursor-manager.test.d.ts +2 -0
  58. package/dist/__tests__/gaze-cursor-manager.test.d.ts.map +1 -0
  59. package/dist/__tests__/gaze-sender.test.d.ts +2 -0
  60. package/dist/__tests__/gaze-sender.test.d.ts.map +1 -0
  61. package/dist/__tests__/gaze-tracker.test.d.ts +2 -0
  62. package/dist/__tests__/gaze-tracker.test.d.ts.map +1 -0
  63. package/dist/__tests__/hls-adapter.test.d.ts +2 -0
  64. package/dist/__tests__/hls-adapter.test.d.ts.map +1 -0
  65. package/dist/__tests__/hotspot-interaction.test.d.ts +2 -0
  66. package/dist/__tests__/hotspot-interaction.test.d.ts.map +1 -0
  67. package/dist/__tests__/hotspot-manager.test.d.ts +2 -0
  68. package/dist/__tests__/hotspot-manager.test.d.ts.map +1 -0
  69. package/dist/__tests__/hotspot-renderer.test.d.ts +2 -0
  70. package/dist/__tests__/hotspot-renderer.test.d.ts.map +1 -0
  71. package/dist/__tests__/integrity.test.d.ts +2 -0
  72. package/dist/__tests__/integrity.test.d.ts.map +1 -0
  73. package/dist/__tests__/keyboard-shortcuts.test.d.ts +2 -0
  74. package/dist/__tests__/keyboard-shortcuts.test.d.ts.map +1 -0
  75. package/dist/__tests__/license-checker.test.d.ts +2 -0
  76. package/dist/__tests__/license-checker.test.d.ts.map +1 -0
  77. package/dist/__tests__/live-indicator.test.d.ts +2 -0
  78. package/dist/__tests__/live-indicator.test.d.ts.map +1 -0
  79. package/dist/__tests__/live.test.d.ts +2 -0
  80. package/dist/__tests__/live.test.d.ts.map +1 -0
  81. package/dist/__tests__/master-key.test.d.ts +2 -0
  82. package/dist/__tests__/master-key.test.d.ts.map +1 -0
  83. package/dist/__tests__/media-element.test.d.ts +2 -0
  84. package/dist/__tests__/media-element.test.d.ts.map +1 -0
  85. package/dist/__tests__/meta-config.test.d.ts +2 -0
  86. package/dist/__tests__/meta-config.test.d.ts.map +1 -0
  87. package/dist/__tests__/play-button.test.d.ts +2 -0
  88. package/dist/__tests__/play-button.test.d.ts.map +1 -0
  89. package/dist/__tests__/player-exports.test.d.ts +2 -0
  90. package/dist/__tests__/player-exports.test.d.ts.map +1 -0
  91. package/dist/__tests__/player-state.test.d.ts +2 -0
  92. package/dist/__tests__/player-state.test.d.ts.map +1 -0
  93. package/dist/__tests__/playlist-controls.test.d.ts +2 -0
  94. package/dist/__tests__/playlist-controls.test.d.ts.map +1 -0
  95. package/dist/__tests__/playlist-panel.test.d.ts +2 -0
  96. package/dist/__tests__/playlist-panel.test.d.ts.map +1 -0
  97. package/dist/__tests__/playlist.test.d.ts +2 -0
  98. package/dist/__tests__/playlist.test.d.ts.map +1 -0
  99. package/dist/__tests__/progressive-adapter.test.d.ts +2 -0
  100. package/dist/__tests__/progressive-adapter.test.d.ts.map +1 -0
  101. package/dist/__tests__/quality-selector.test.d.ts +2 -0
  102. package/dist/__tests__/quality-selector.test.d.ts.map +1 -0
  103. package/dist/__tests__/renderer.test.d.ts +2 -0
  104. package/dist/__tests__/renderer.test.d.ts.map +1 -0
  105. package/dist/__tests__/security/license-key-exposure.test.d.ts +2 -0
  106. package/dist/__tests__/security/license-key-exposure.test.d.ts.map +1 -0
  107. package/dist/__tests__/security/sanitize-xss.test.d.ts +2 -0
  108. package/dist/__tests__/security/sanitize-xss.test.d.ts.map +1 -0
  109. package/dist/__tests__/security/sri-generation.test.d.ts +2 -0
  110. package/dist/__tests__/security/sri-generation.test.d.ts.map +1 -0
  111. package/dist/__tests__/security/xss-annotations.test.d.ts +2 -0
  112. package/dist/__tests__/security/xss-annotations.test.d.ts.map +1 -0
  113. package/dist/__tests__/security/xss-captions.test.d.ts +2 -0
  114. package/dist/__tests__/security/xss-captions.test.d.ts.map +1 -0
  115. package/dist/__tests__/seek-bar.test.d.ts +2 -0
  116. package/dist/__tests__/seek-bar.test.d.ts.map +1 -0
  117. package/dist/__tests__/source-manager.test.d.ts +2 -0
  118. package/dist/__tests__/source-manager.test.d.ts.map +1 -0
  119. package/dist/__tests__/sprint1-memory-disposal.test.d.ts +10 -0
  120. package/dist/__tests__/sprint1-memory-disposal.test.d.ts.map +1 -0
  121. package/dist/__tests__/sprint3-frustum-adaptive.test.d.ts +9 -0
  122. package/dist/__tests__/sprint3-frustum-adaptive.test.d.ts.map +1 -0
  123. package/dist/__tests__/sprint5-bundle-memory.test.d.ts +18 -0
  124. package/dist/__tests__/sprint5-bundle-memory.test.d.ts.map +1 -0
  125. package/dist/__tests__/voice-button.test.d.ts +2 -0
  126. package/dist/__tests__/voice-button.test.d.ts.map +1 -0
  127. package/dist/__tests__/voice-manager.test.d.ts +2 -0
  128. package/dist/__tests__/voice-manager.test.d.ts.map +1 -0
  129. package/dist/__tests__/volume-control.test.d.ts +2 -0
  130. package/dist/__tests__/volume-control.test.d.ts.map +1 -0
  131. package/dist/__tests__/vr-button.test.d.ts +2 -0
  132. package/dist/__tests__/vr-button.test.d.ts.map +1 -0
  133. package/dist/__tests__/vz-cinema-element.test.d.ts +2 -0
  134. package/dist/__tests__/vz-cinema-element.test.d.ts.map +1 -0
  135. package/dist/__tests__/vz-img-element.test.d.ts +2 -0
  136. package/dist/__tests__/vz-img-element.test.d.ts.map +1 -0
  137. package/dist/__tests__/vz-playlist-element.test.d.ts +2 -0
  138. package/dist/__tests__/vz-playlist-element.test.d.ts.map +1 -0
  139. package/dist/__tests__/vz-tour-element.test.d.ts +2 -0
  140. package/dist/__tests__/vz-tour-element.test.d.ts.map +1 -0
  141. package/dist/__tests__/vz-tour-img.test.d.ts +2 -0
  142. package/dist/__tests__/vz-tour-img.test.d.ts.map +1 -0
  143. package/dist/__tests__/vz-tour-portal.test.d.ts +2 -0
  144. package/dist/__tests__/vz-tour-portal.test.d.ts.map +1 -0
  145. package/dist/__tests__/vz-video-element.test.d.ts +2 -0
  146. package/dist/__tests__/vz-video-element.test.d.ts.map +1 -0
  147. package/dist/__tests__/watermark-guard.test.d.ts +2 -0
  148. package/dist/__tests__/watermark-guard.test.d.ts.map +1 -0
  149. package/dist/__tests__/watermark.test.d.ts +2 -0
  150. package/dist/__tests__/watermark.test.d.ts.map +1 -0
  151. package/dist/__tests__/webvtt-parser.test.d.ts +2 -0
  152. package/dist/__tests__/webvtt-parser.test.d.ts.map +1 -0
  153. package/dist/__tests__/xr-controller.test.d.ts +2 -0
  154. package/dist/__tests__/xr-controller.test.d.ts.map +1 -0
  155. package/dist/__tests__/xr-manager.test.d.ts +2 -0
  156. package/dist/__tests__/xr-manager.test.d.ts.map +1 -0
  157. package/dist/analytics/analytics-collector.d.ts +29 -0
  158. package/dist/analytics/analytics-collector.d.ts.map +1 -0
  159. package/dist/analytics/gaze-tracker.d.ts +44 -0
  160. package/dist/analytics/gaze-tracker.d.ts.map +1 -0
  161. package/dist/analytics/index.d.ts +32 -0
  162. package/dist/analytics/index.d.ts.map +1 -0
  163. package/dist/annotations/annotation-manager.d.ts +31 -0
  164. package/dist/annotations/annotation-manager.d.ts.map +1 -0
  165. package/dist/annotations/annotation-popup.d.ts +21 -0
  166. package/dist/annotations/annotation-popup.d.ts.map +1 -0
  167. package/dist/annotations/annotation-sprite.d.ts +10 -0
  168. package/dist/annotations/annotation-sprite.d.ts.map +1 -0
  169. package/dist/annotations/index.d.ts +4 -0
  170. package/dist/annotations/index.d.ts.map +1 -0
  171. package/dist/annotations-C0ugfCn4.js +2158 -0
  172. package/dist/annotations-C0ugfCn4.js.map +1 -0
  173. package/dist/audio/ambisonic-renderer.d.ts +36 -0
  174. package/dist/audio/ambisonic-renderer.d.ts.map +1 -0
  175. package/dist/audio/audio-manager.d.ts +44 -0
  176. package/dist/audio/audio-manager.d.ts.map +1 -0
  177. package/dist/captions/caption-renderer.d.ts +57 -0
  178. package/dist/captions/caption-renderer.d.ts.map +1 -0
  179. package/dist/captions/index.d.ts +3 -0
  180. package/dist/captions/index.d.ts.map +1 -0
  181. package/dist/captions/webvtt-parser.d.ts +31 -0
  182. package/dist/captions/webvtt-parser.d.ts.map +1 -0
  183. package/dist/captions-BP0H2E03.js +274 -0
  184. package/dist/captions-BP0H2E03.js.map +1 -0
  185. package/dist/collab-BXPomrS0.js +978 -0
  186. package/dist/collab-BXPomrS0.js.map +1 -0
  187. package/dist/collaborative/chat-button.d.ts +22 -0
  188. package/dist/collaborative/chat-button.d.ts.map +1 -0
  189. package/dist/collaborative/chat-panel.d.ts +46 -0
  190. package/dist/collaborative/chat-panel.d.ts.map +1 -0
  191. package/dist/collaborative/collab-client.d.ts +73 -0
  192. package/dist/collaborative/collab-client.d.ts.map +1 -0
  193. package/dist/collaborative/gaze-cursor-manager.d.ts +29 -0
  194. package/dist/collaborative/gaze-cursor-manager.d.ts.map +1 -0
  195. package/dist/collaborative/gaze-sender.d.ts +29 -0
  196. package/dist/collaborative/gaze-sender.d.ts.map +1 -0
  197. package/dist/collaborative/voice-button.d.ts +25 -0
  198. package/dist/collaborative/voice-button.d.ts.map +1 -0
  199. package/dist/collaborative/voice-manager.d.ts +45 -0
  200. package/dist/collaborative/voice-manager.d.ts.map +1 -0
  201. package/dist/config/format-registry.d.ts +2 -0
  202. package/dist/config/format-registry.d.ts.map +1 -0
  203. package/dist/config/meta-config.d.ts +14 -0
  204. package/dist/config/meta-config.d.ts.map +1 -0
  205. package/dist/controls/cc-button.d.ts +24 -0
  206. package/dist/controls/cc-button.d.ts.map +1 -0
  207. package/dist/controls/compass.d.ts +15 -0
  208. package/dist/controls/compass.d.ts.map +1 -0
  209. package/dist/controls/controls-overlay.d.ts +46 -0
  210. package/dist/controls/controls-overlay.d.ts.map +1 -0
  211. package/dist/controls/fullscreen-button.d.ts +16 -0
  212. package/dist/controls/fullscreen-button.d.ts.map +1 -0
  213. package/dist/controls/icons.d.ts +23 -0
  214. package/dist/controls/icons.d.ts.map +1 -0
  215. package/dist/controls/keyboard-shortcuts.d.ts +21 -0
  216. package/dist/controls/keyboard-shortcuts.d.ts.map +1 -0
  217. package/dist/controls/live-indicator.d.ts +17 -0
  218. package/dist/controls/live-indicator.d.ts.map +1 -0
  219. package/dist/controls/play-button.d.ts +14 -0
  220. package/dist/controls/play-button.d.ts.map +1 -0
  221. package/dist/controls/playlist-controls.d.ts +18 -0
  222. package/dist/controls/playlist-controls.d.ts.map +1 -0
  223. package/dist/controls/playlist-panel.d.ts +27 -0
  224. package/dist/controls/playlist-panel.d.ts.map +1 -0
  225. package/dist/controls/quality-menu.d.ts +17 -0
  226. package/dist/controls/quality-menu.d.ts.map +1 -0
  227. package/dist/controls/seek-bar.d.ts +23 -0
  228. package/dist/controls/seek-bar.d.ts.map +1 -0
  229. package/dist/controls/volume-control.d.ts +14 -0
  230. package/dist/controls/volume-control.d.ts.map +1 -0
  231. package/dist/controls/vr-button.d.ts +14 -0
  232. package/dist/controls/vr-button.d.ts.map +1 -0
  233. package/dist/core/base-element.d.ts +53 -0
  234. package/dist/core/base-element.d.ts.map +1 -0
  235. package/dist/core/event-emitter.d.ts +23 -0
  236. package/dist/core/event-emitter.d.ts.map +1 -0
  237. package/dist/core/html-element.d.ts +13 -0
  238. package/dist/core/html-element.d.ts.map +1 -0
  239. package/dist/core/media-element.d.ts +86 -0
  240. package/dist/core/media-element.d.ts.map +1 -0
  241. package/dist/core/player-state.d.ts +63 -0
  242. package/dist/core/player-state.d.ts.map +1 -0
  243. package/dist/dash-adapter-tid9ZyhO.js +75 -0
  244. package/dist/dash-adapter-tid9ZyhO.js.map +1 -0
  245. package/dist/elements/vz-annotation.d.ts +26 -0
  246. package/dist/elements/vz-annotation.d.ts.map +1 -0
  247. package/dist/elements/vz-cinema.d.ts +28 -0
  248. package/dist/elements/vz-cinema.d.ts.map +1 -0
  249. package/dist/elements/vz-img.d.ts +27 -0
  250. package/dist/elements/vz-img.d.ts.map +1 -0
  251. package/dist/elements/vz-live.d.ts +36 -0
  252. package/dist/elements/vz-live.d.ts.map +1 -0
  253. package/dist/elements/vz-playlist.d.ts +74 -0
  254. package/dist/elements/vz-playlist.d.ts.map +1 -0
  255. package/dist/elements/vz-tour-img.d.ts +21 -0
  256. package/dist/elements/vz-tour-img.d.ts.map +1 -0
  257. package/dist/elements/vz-tour-portal.d.ts +19 -0
  258. package/dist/elements/vz-tour-portal.d.ts.map +1 -0
  259. package/dist/elements/vz-tour.d.ts +49 -0
  260. package/dist/elements/vz-tour.d.ts.map +1 -0
  261. package/dist/elements/vz-video.d.ts +21 -0
  262. package/dist/elements/vz-video.d.ts.map +1 -0
  263. package/dist/hls-adapter-BivH46L_.js +97 -0
  264. package/dist/hls-adapter-BivH46L_.js.map +1 -0
  265. package/dist/hotspots/hotspot-interaction.d.ts +23 -0
  266. package/dist/hotspots/hotspot-interaction.d.ts.map +1 -0
  267. package/dist/hotspots/hotspot-manager.d.ts +18 -0
  268. package/dist/hotspots/hotspot-manager.d.ts.map +1 -0
  269. package/dist/hotspots/hotspot-renderer.d.ts +26 -0
  270. package/dist/hotspots/hotspot-renderer.d.ts.map +1 -0
  271. package/dist/index.d.ts +48 -0
  272. package/dist/index.d.ts.map +1 -0
  273. package/dist/license/feature-gates.d.ts +6 -0
  274. package/dist/license/feature-gates.d.ts.map +1 -0
  275. package/dist/license/integrity.d.ts +33 -0
  276. package/dist/license/integrity.d.ts.map +1 -0
  277. package/dist/license/license-checker.d.ts +18 -0
  278. package/dist/license/license-checker.d.ts.map +1 -0
  279. package/dist/license/master-key.d.ts +14 -0
  280. package/dist/license/master-key.d.ts.map +1 -0
  281. package/dist/license/watermark-guard.d.ts +24 -0
  282. package/dist/license/watermark-guard.d.ts.map +1 -0
  283. package/dist/license/watermark.d.ts +19 -0
  284. package/dist/license/watermark.d.ts.map +1 -0
  285. package/dist/register-CwnmiGEs.js +5740 -0
  286. package/dist/register-CwnmiGEs.js.map +1 -0
  287. package/dist/register.d.ts +6 -0
  288. package/dist/register.d.ts.map +1 -0
  289. package/dist/register.js +5 -0
  290. package/dist/register.js.map +1 -0
  291. package/dist/renderer/camera-controller.d.ts +75 -0
  292. package/dist/renderer/camera-controller.d.ts.map +1 -0
  293. package/dist/renderer/projections/cinema-projection.d.ts +32 -0
  294. package/dist/renderer/projections/cinema-projection.d.ts.map +1 -0
  295. package/dist/renderer/projections/cubemap-projection.d.ts +34 -0
  296. package/dist/renderer/projections/cubemap-projection.d.ts.map +1 -0
  297. package/dist/renderer/projections/eac-projection.d.ts +35 -0
  298. package/dist/renderer/projections/eac-projection.d.ts.map +1 -0
  299. package/dist/renderer/projections/equirect-projection.d.ts +27 -0
  300. package/dist/renderer/projections/equirect-projection.d.ts.map +1 -0
  301. package/dist/renderer/projections/fisheye-projection.d.ts +28 -0
  302. package/dist/renderer/projections/fisheye-projection.d.ts.map +1 -0
  303. package/dist/renderer/projections/flat-projection.d.ts +32 -0
  304. package/dist/renderer/projections/flat-projection.d.ts.map +1 -0
  305. package/dist/renderer/projections/projection.d.ts +18 -0
  306. package/dist/renderer/projections/projection.d.ts.map +1 -0
  307. package/dist/renderer/renderer.d.ts +72 -0
  308. package/dist/renderer/renderer.d.ts.map +1 -0
  309. package/dist/renderer/shaders/eac.glsl.d.ts +12 -0
  310. package/dist/renderer/shaders/eac.glsl.d.ts.map +1 -0
  311. package/dist/renderer/shaders/fisheye.glsl.d.ts +22 -0
  312. package/dist/renderer/shaders/fisheye.glsl.d.ts.map +1 -0
  313. package/dist/spatial-BeadwNJA.js +146 -0
  314. package/dist/spatial-BeadwNJA.js.map +1 -0
  315. package/dist/sri.json +12 -0
  316. package/dist/streaming/adapter-factory.d.ts +8 -0
  317. package/dist/streaming/adapter-factory.d.ts.map +1 -0
  318. package/dist/streaming/dash-adapter.d.ts +21 -0
  319. package/dist/streaming/dash-adapter.d.ts.map +1 -0
  320. package/dist/streaming/hls-adapter.d.ts +26 -0
  321. package/dist/streaming/hls-adapter.d.ts.map +1 -0
  322. package/dist/streaming/progressive-adapter.d.ts +18 -0
  323. package/dist/streaming/progressive-adapter.d.ts.map +1 -0
  324. package/dist/streaming/quality-selector.d.ts +25 -0
  325. package/dist/streaming/quality-selector.d.ts.map +1 -0
  326. package/dist/streaming/source-manager.d.ts +46 -0
  327. package/dist/streaming/source-manager.d.ts.map +1 -0
  328. package/dist/streaming/types.d.ts +25 -0
  329. package/dist/streaming/types.d.ts.map +1 -0
  330. package/dist/styles/controls.d.ts +15 -0
  331. package/dist/styles/controls.d.ts.map +1 -0
  332. package/dist/three-Bci7aSeI.js +20078 -0
  333. package/dist/three-Bci7aSeI.js.map +1 -0
  334. package/dist/utils/fullscreen.d.ts +6 -0
  335. package/dist/utils/fullscreen.d.ts.map +1 -0
  336. package/dist/utils/sanitize.d.ts +19 -0
  337. package/dist/utils/sanitize.d.ts.map +1 -0
  338. package/dist/vizor.js +113 -0
  339. package/dist/vizor.js.map +1 -0
  340. package/dist/xr/xr-controller.d.ts +27 -0
  341. package/dist/xr/xr-controller.d.ts.map +1 -0
  342. package/dist/xr/xr-manager.d.ts +43 -0
  343. package/dist/xr/xr-manager.d.ts.map +1 -0
  344. package/package.json +94 -0
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Auto-register all Vizor custom elements.
3
+ * Used by the CDN script tag build.
4
+ */
5
+ export declare function registerAll(): void;
6
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAYlC"}
@@ -0,0 +1,5 @@
1
+ import { r } from "./register-CwnmiGEs.js";
2
+ export {
3
+ r as registerAll
4
+ };
5
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,75 @@
1
+ import { PerspectiveCamera } from 'three';
2
+ import type { PlayerState } from '../core/player-state.js';
3
+ interface CameraConfig {
4
+ startLat: number;
5
+ startLon: number;
6
+ focalLength: number;
7
+ minFocalLength: number;
8
+ maxFocalLength: number;
9
+ isPanoramic: boolean;
10
+ fovH?: number;
11
+ }
12
+ /**
13
+ * Unified camera controller for the VR player.
14
+ *
15
+ * Handles:
16
+ * - Mouse drag (desktop)
17
+ * - Touch drag (mobile)
18
+ * - Device orientation / gyroscope (mobile magic window)
19
+ * - Keyboard arrow keys
20
+ * - FOV zoom (scroll wheel / pinch)
21
+ *
22
+ * WebXR head tracking is handled by Three.js WebXRManager directly.
23
+ */
24
+ export declare class CameraController {
25
+ private camera;
26
+ private state;
27
+ private domElement;
28
+ private lat;
29
+ private lon;
30
+ private targetLat;
31
+ private targetLon;
32
+ private fov;
33
+ private isPanoramic;
34
+ private minFov;
35
+ private maxFov;
36
+ private fovH;
37
+ private enabled;
38
+ private isDragging;
39
+ private lastPointer;
40
+ private deviceOrientationEnabled;
41
+ private deviceAlpha;
42
+ private deviceBeta;
43
+ private deviceGamma;
44
+ private boundHandlers;
45
+ constructor(camera: PerspectiveCamera, domElement: HTMLElement, state: PlayerState, config: CameraConfig);
46
+ /** Enable or disable input processing (disabled during WebXR) */
47
+ setEnabled(enabled: boolean): void;
48
+ /** Switch panoramic mode at runtime (e.g. cinema overrides flat → panoramic) */
49
+ setPanoramic(panoramic: boolean): void;
50
+ /** Call per frame in animation loop */
51
+ update(): void;
52
+ /** Get current orientation */
53
+ getOrientation(): {
54
+ lat: number;
55
+ lon: number;
56
+ fov: number;
57
+ };
58
+ /** Set orientation programmatically */
59
+ setOrientation(lat: number, lon: number, snap?: boolean): void;
60
+ /** Enable device orientation (gyroscope) */
61
+ enableDeviceOrientation(): void;
62
+ /** Dispose all event listeners */
63
+ dispose(): void;
64
+ private attachListeners;
65
+ private addHandler;
66
+ private onPointerDown;
67
+ private onPointerMove;
68
+ private onPointerUp;
69
+ private onWheel;
70
+ private onKeyDown;
71
+ private applyDeviceOrientation;
72
+ private updateCamera;
73
+ }
74
+ export {};
75
+ //# sourceMappingURL=camera-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camera-controller.d.ts","sourceRoot":"","sources":["../../src/renderer/camera-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA8B,MAAM,OAAO,CAAC;AAGtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,C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GAAG,EAAE,MAAM,EAAE,IAAI,UAAQ,GAAG,IAAI;IAU5D,4CAA4C;IAC5C,uBAAuB,IAAI,IAAI;IAe/B,kCAAkC;IAClC,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,OAAO;IAaf,OAAO,CAAC,SAAS;IAuBjB,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,YAAY;CAarB"}
@@ -0,0 +1,32 @@
1
+ import { Mesh } from 'three';
2
+ import type { PerspectiveCamera, Texture } from 'three';
3
+ import type { StereoMode } from '@vizor-vr/shared';
4
+ import type { IProjection } from './projection.js';
5
+ export interface CinemaConfig {
6
+ screenWidth: number;
7
+ screenHeight: number;
8
+ screenDistance: number;
9
+ screenOffsetY: number;
10
+ }
11
+ /**
12
+ * Cinema projection: flat video screen inside a panoramic room.
13
+ *
14
+ * Composes two geometries:
15
+ * - Inverted sphere for the room environment (equirectangular)
16
+ * - Flat plane for the video screen positioned at configurable distance/size
17
+ */
18
+ export declare class CinemaProjection implements IProjection {
19
+ private meshes;
20
+ private roomMesh;
21
+ private config;
22
+ constructor(config?: Partial<CinemaConfig>);
23
+ createMeshes(videoTexture: Texture, stereoMode: StereoMode): Mesh[];
24
+ /** Set the room equirectangular texture */
25
+ setRoomTexture(texture: Texture): void;
26
+ configureCamera(camera: PerspectiveCamera): void;
27
+ update(_camera: PerspectiveCamera, _time: number): void;
28
+ dispose(): void;
29
+ private remapUVsHorizontal;
30
+ private remapUVsVertical;
31
+ }
32
+ //# sourceMappingURL=cinema-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cinema-projection.d.ts","sourceRoot":"","sources":["../../../src/renderer/projections/cinema-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EACL,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AASD;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAClD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;IAI1C,YAAY,CAAC,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,EAAE;IAkDnE,2CAA2C;IAC3C,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQtC,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAQhD,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvD,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,gBAAgB;CAQzB"}
@@ -0,0 +1,34 @@
1
+ import { Mesh } from 'three';
2
+ import type { PerspectiveCamera, Texture } from 'three';
3
+ import type { StereoMode } from '@vizor-vr/shared';
4
+ import type { IProjection } from './projection.js';
5
+ /**
6
+ * Cubemap projection for standard 3x2 atlas cubemap content.
7
+ * Creates an inverted box with each face's UVs remapped to the
8
+ * corresponding tile in the atlas texture.
9
+ * For stereo content, creates two boxes on different Three.js layers
10
+ * with UV remapping for side-by-side or top-bottom layouts.
11
+ */
12
+ export declare class CubemapProjection implements IProjection {
13
+ private meshes;
14
+ createMeshes(texture: Texture, stereoMode: StereoMode): Mesh[];
15
+ configureCamera(camera: PerspectiveCamera): void;
16
+ update(_camera: PerspectiveCamera, _time: number): void;
17
+ dispose(): void;
18
+ private createBox;
19
+ /**
20
+ * Remap UV coordinates for cubemap atlas layout, with optional stereo offset.
21
+ *
22
+ * BoxGeometry has 6 faces, each with 4 vertices (indices faceIndex*4 .. faceIndex*4+3).
23
+ * Default UVs for each face span [0,1] in both U and V.
24
+ * We remap each face to its tile in the 3x2 atlas, then apply stereo compression
25
+ * if needed.
26
+ *
27
+ * For TB stereo the entire atlas occupies either the top or bottom half of the
28
+ * texture, so V coordinates are compressed to half and offset accordingly.
29
+ * For SBS stereo the atlas occupies either the left or right half, so U
30
+ * coordinates are compressed to half and offset accordingly.
31
+ */
32
+ private remapFaceUVs;
33
+ }
34
+ //# sourceMappingURL=cubemap-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cubemap-projection.d.ts","sourceRoot":"","sources":["../../../src/renderer/projections/cubemap-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EACL,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAmB,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAwBnD;;;;;;GAMG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACnD,OAAO,CAAC,MAAM,CAAc;IAE5B,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,EAAE;IA2B9D,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAQhD,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvD,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,SAAS;IAajB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,YAAY;CA+DrB"}
@@ -0,0 +1,35 @@
1
+ import { Mesh } from 'three';
2
+ import type { PerspectiveCamera, Texture } from 'three';
3
+ import type { StereoMode } from '@vizor-vr/shared';
4
+ import type { IProjection } from './projection.js';
5
+ /**
6
+ * Equi-Angular Cubemap (EAC) projection for 3x2 atlas cubemap content.
7
+ * Uses the same box geometry and UV atlas layout as CubemapProjection,
8
+ * but applies a ShaderMaterial with tan() angular correction in the
9
+ * fragment shader to correct for the equi-angular sampling distortion.
10
+ *
11
+ * For stereo content, creates two boxes on different Three.js layers
12
+ * with UV remapping for side-by-side or top-bottom layouts.
13
+ */
14
+ export declare class EacProjection implements IProjection {
15
+ private meshes;
16
+ createMeshes(texture: Texture, stereoMode: StereoMode): Mesh[];
17
+ configureCamera(camera: PerspectiveCamera): void;
18
+ update(_camera: PerspectiveCamera, _time: number): void;
19
+ dispose(): void;
20
+ private createBox;
21
+ /**
22
+ * Provide each face's atlas tile as a per-vertex `faceRegion` attribute
23
+ * (xy = tile origin, zw = tile size), leaving geometry.uv as the default
24
+ * face-local [0,1] coordinates. The fragment shader applies the equi-angular
25
+ * correction in that face-local space and then maps the result into the tile
26
+ * — applying the correction in atlas space (the previous approach) is wrong
27
+ * because the tan() distortion is per-face.
28
+ *
29
+ * BoxGeometry has 6 faces, each with 4 vertices (indices face*4 .. face*4+3).
30
+ * For TB stereo the atlas occupies the top or bottom half of the texture (V
31
+ * compressed/offset); for SBS, the left or right half (U compressed/offset).
32
+ */
33
+ private setupFaceAtlas;
34
+ }
35
+ //# sourceMappingURL=eac-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eac-projection.d.ts","sourceRoot":"","sources":["../../../src/renderer/projections/eac-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAGL,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAyBnD;;;;;;;;GAQG;AACH,qBAAa,aAAc,YAAW,WAAW;IAC/C,OAAO,CAAC,MAAM,CAAc;IAE5B,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,EAAE;IA2B9D,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAQhD,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvD,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,SAAS;IAgBjB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,cAAc;CAkDvB"}
@@ -0,0 +1,27 @@
1
+ import { Mesh } from 'three';
2
+ import type { PerspectiveCamera, Texture } from 'three';
3
+ import type { StereoMode } from '@vizor-vr/shared';
4
+ import type { IProjection } from './projection.js';
5
+ /**
6
+ * Equirectangular projection for 360 and 180 content.
7
+ * Creates an inverted sphere with the texture mapped on the inside.
8
+ * For stereo content, creates two spheres on different Three.js layers
9
+ * with UV remapping for side-by-side or top-bottom layouts.
10
+ */
11
+ export declare class EquirectProjection implements IProjection {
12
+ private meshes;
13
+ private fovH;
14
+ constructor(fovH?: number);
15
+ createMeshes(texture: Texture, stereoMode: StereoMode): Mesh[];
16
+ configureCamera(camera: PerspectiveCamera): void;
17
+ update(_camera: PerspectiveCamera, _time: number): void;
18
+ dispose(): void;
19
+ private createSphere;
20
+ /**
21
+ * Remap UV coordinates for stereo content.
22
+ * SBS: left eye uses left half (u: 0-0.5), right eye uses right half (u: 0.5-1)
23
+ * TB: left eye uses top half (v: 0.5-1), right eye uses bottom half (v: 0-0.5)
24
+ */
25
+ private remapUVs;
26
+ }
27
+ //# sourceMappingURL=equirect-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equirect-projection.d.ts","sourceRoot":"","sources":["../../../src/renderer/projections/equirect-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EACL,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IACpD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,IAAI,CAAS;gBAET,IAAI,GAAE,MAAY;IAI9B,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,EAAE;IAwB9D,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAQhD,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvD,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,YAAY;IAyBpB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;CAwBjB"}
@@ -0,0 +1,28 @@
1
+ import { Mesh } from 'three';
2
+ import type { PerspectiveCamera, Texture } from 'three';
3
+ import type { StereoMode } from '@vizor-vr/shared';
4
+ import type { IProjection } from './projection.js';
5
+ /**
6
+ * Dual fisheye projection for 360 content captured with dual-fisheye cameras
7
+ * (e.g. Ricoh Theta, Insta360).
8
+ *
9
+ * The texture contains two circular fisheye images side by side:
10
+ * - Left circle: front hemisphere (z >= 0)
11
+ * - Right circle: back hemisphere (z < 0)
12
+ *
13
+ * Uses a full inverted SphereGeometry (like equirectangular) but with a
14
+ * ShaderMaterial that computes fisheye UV mapping from world-space direction
15
+ * vectors rather than relying on geometry UVs.
16
+ *
17
+ * For stereo content, two spheres are created on separate Three.js layers
18
+ * with shader uniforms selecting the appropriate texture sub-region per eye.
19
+ */
20
+ export declare class FisheyeProjection implements IProjection {
21
+ private meshes;
22
+ createMeshes(texture: Texture, stereoMode: StereoMode): Mesh[];
23
+ configureCamera(camera: PerspectiveCamera): void;
24
+ update(_camera: PerspectiveCamera, _time: number): void;
25
+ dispose(): void;
26
+ private createSphere;
27
+ }
28
+ //# sourceMappingURL=fisheye-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fisheye-projection.d.ts","sourceRoot":"","sources":["../../../src/renderer/projections/fisheye-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAEL,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAgDnD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACnD,OAAO,CAAC,MAAM,CAAc;IAE5B,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,EAAE;IAuB9D,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAQhD,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvD,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,YAAY;CA8BrB"}
@@ -0,0 +1,32 @@
1
+ import { Mesh } from 'three';
2
+ import type { PerspectiveCamera, Texture } from 'three';
3
+ import type { StereoMode } from '@vizor-vr/shared';
4
+ import type { IProjection } from './projection.js';
5
+ /**
6
+ * Flat projection for standard 2D and 3D (SBS/TB) video.
7
+ *
8
+ * Behaves like `object-fit: contain` — the plane preserves the video's
9
+ * native aspect ratio and scales to fit as large as possible within the
10
+ * viewport. Letterbox / pillarbox bars appear only when the video and
11
+ * container aspect ratios differ.
12
+ */
13
+ export declare class FlatProjection implements IProjection {
14
+ private meshes;
15
+ /** Video aspect ratio (accounts for stereo layout). */
16
+ private videoAspect;
17
+ private stereoMode;
18
+ createMeshes(texture: Texture, stereoMode: StereoMode): Mesh[];
19
+ configureCamera(camera: PerspectiveCamera): void;
20
+ /**
21
+ * Scale the plane every frame to fit inside the camera frustum
22
+ * while preserving the video's native aspect ratio (`object-fit: contain`).
23
+ *
24
+ * Also re-reads the video dimensions so the aspect ratio updates if
25
+ * the source changes (e.g. adaptive streaming resolution switch).
26
+ */
27
+ update(camera: PerspectiveCamera, _time: number): void;
28
+ dispose(): void;
29
+ private createPlane;
30
+ private remapUVs;
31
+ }
32
+ //# sourceMappingURL=flat-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flat-projection.d.ts","sourceRoot":"","sources":["../../../src/renderer/projections/flat-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,IAAI,EAAa,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKnD;;;;;;;GAOG;AACH,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,MAAM,CAAc;IAC5B,uDAAuD;IACvD,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,UAAU,CAAsB;IAExC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,EAAE;IAsC9D,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAShD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAuCtD,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,QAAQ;CAmBjB"}
@@ -0,0 +1,18 @@
1
+ import type { PerspectiveCamera, Mesh, Texture } from 'three';
2
+ import type { StereoMode } from '@vizor-vr/shared';
3
+ /**
4
+ * Interface for projection strategies.
5
+ * Each VzFormat maps to a specific projection that knows
6
+ * how to create geometry, materials, and meshes for rendering.
7
+ */
8
+ export interface IProjection {
9
+ /** Create meshes for the scene. Returns [mono] or [left, right] for stereo. */
10
+ createMeshes(texture: Texture, stereoMode: StereoMode): Mesh[];
11
+ /** Configure camera FOV and constraints for this projection type */
12
+ configureCamera(camera: PerspectiveCamera): void;
13
+ /** Per-frame update (e.g., shader uniforms). Called in animation loop. */
14
+ update(camera: PerspectiveCamera, time: number): void;
15
+ /** Clean up GPU resources */
16
+ dispose(): void;
17
+ }
18
+ //# sourceMappingURL=projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../src/renderer/projections/projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAA4B,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,EAAE,CAAC;IAE/D,oEAAoE;IACpE,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAEjD,0EAA0E;IAC1E,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtD,6BAA6B;IAC7B,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1,72 @@
1
+ import { Scene, WebGLRenderer, PerspectiveCamera } from 'three';
2
+ import type { Texture } from 'three';
3
+ import type { VzFormat } from '@vizor-vr/shared';
4
+ import type { PlayerConfig } from '@vizor-vr/shared';
5
+ import type { PlayerState } from '../core/player-state.js';
6
+ import type { StereoMode } from '@vizor-vr/shared';
7
+ import type { IProjection } from './projections/projection.js';
8
+ import { CameraController } from './camera-controller.js';
9
+ import type { AudioManager } from '../audio/audio-manager.js';
10
+ /**
11
+ * Main renderer facade.
12
+ * Manages the Three.js scene, camera, projection, and animation loop.
13
+ */
14
+ export declare class VzRenderer {
15
+ private scene;
16
+ private renderer;
17
+ private camera;
18
+ private cameraController;
19
+ private projection;
20
+ private videoTexture;
21
+ private audioManager;
22
+ private state;
23
+ private config;
24
+ private canvas;
25
+ private isRunning;
26
+ private containerEl;
27
+ private intersectionObserver;
28
+ private isVisible;
29
+ private fpsHistory;
30
+ private lastFrameTime;
31
+ constructor(shadowRoot: ShadowRoot, containerEl: HTMLElement, state: PlayerState, config: PlayerConfig);
32
+ /** Set up the projection and texture for a video element */
33
+ setupVideo(videoElement: HTMLVideoElement, format: VzFormat): void;
34
+ /** Set up the projection and texture for an image */
35
+ setupImage(texture: Texture, format: VzFormat): void;
36
+ /**
37
+ * Load a compressed KTX2 texture (optional, GPU-compressed).
38
+ * Falls back gracefully if KTX2Loader is not available.
39
+ */
40
+ loadCompressedTexture(url: string, format: VzFormat): Promise<void>;
41
+ /** Start the animation loop */
42
+ start(): void;
43
+ /** Stop the animation loop */
44
+ stop(): void;
45
+ /** Handle container resize */
46
+ resize(): void;
47
+ /** Get the WebGL renderer (for WebXR integration) */
48
+ getThreeRenderer(): WebGLRenderer;
49
+ /** Get the camera (for WebXR integration) */
50
+ getCamera(): PerspectiveCamera;
51
+ /** Get the camera controller */
52
+ getCameraController(): CameraController;
53
+ /** Get the Three.js scene (for hotspot integration) */
54
+ getScene(): Scene;
55
+ /** Set the audio manager for spatial audio orientation updates */
56
+ setAudioManager(manager: AudioManager): void;
57
+ /** Clean up all GPU resources */
58
+ dispose(): void;
59
+ /** Set a custom projection (for cinema mode) */
60
+ setCustomProjection(projection: IProjection, texture: Texture, stereoMode: StereoMode): void;
61
+ /** Dispose all meshes, materials, and textures in the scene */
62
+ private disposeSceneChildren;
63
+ private setProjection;
64
+ private createProjection;
65
+ private tick;
66
+ /**
67
+ * Adaptive quality: adjust pixel ratio based on recent FPS.
68
+ * Drop at <30fps, increase at >55fps. Checked every 60 frames.
69
+ */
70
+ private adaptPixelRatio;
71
+ }
72
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/renderer/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,aAAa,EACb,iBAAiB,EAMlB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAM/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,MAAM,CAA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ACH,OAAO,CAAC,eAAe;CAuBxB"}
@@ -0,0 +1,12 @@
1
+ /** EAC vertex shader — passes the face-local UV and the face's atlas tile region. */
2
+ export declare const eacVertexShader = "\nattribute vec4 faceRegion;\nvarying vec2 vUv;\nvarying vec4 vFaceRegion;\n\nvoid main() {\n vUv = uv;\n vFaceRegion = faceRegion;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
3
+ /**
4
+ * EAC fragment shader. The equi-angular (tan) correction must be applied in each
5
+ * cube face's LOCAL 0..1 space, not in atlas space — so `vUv` is the face-local
6
+ * coordinate and `vFaceRegion` (xy = tile origin, zw = tile size) maps the
7
+ * corrected coordinate into the face's tile in the 3x2 atlas. The face edges
8
+ * (uv 0 and 1) map to themselves and the centre stays centred, so face
9
+ * orientation is preserved while interior samples are redistributed correctly.
10
+ */
11
+ export declare const eacFragmentShader = "\nuniform sampler2D map;\nvarying vec2 vUv;\nvarying vec4 vFaceRegion;\n\nconst float PI = 3.14159265359;\n\nvoid main() {\n // Equi-angular correction in face-local space: 0..1 -> -1..1 -> tan -> 0..1.\n vec2 ndc = vUv * 2.0 - 1.0;\n ndc = tan(ndc * PI / 4.0);\n vec2 faceUv = clamp(ndc * 0.5 + 0.5, 0.0, 1.0);\n\n // Map the corrected face-local UV into this face's atlas tile.\n vec2 atlasUv = vFaceRegion.xy + faceUv * vFaceRegion.zw;\n\n gl_FragColor = texture2D(map, atlasUv);\n}\n";
12
+ //# sourceMappingURL=eac.glsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eac.glsl.d.ts","sourceRoot":"","sources":["../../../src/renderer/shaders/eac.glsl.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,eAAO,MAAM,eAAe,0NAU3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,mfAkB7B,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * GLSL shaders for dual fisheye projection.
3
+ *
4
+ * A dual fisheye texture contains two circular fisheye images side by side:
5
+ * - Left circle: front hemisphere (z >= 0)
6
+ * - Right circle: back hemisphere (z < 0)
7
+ *
8
+ * For stereo content (SBS or TB), the entire dual-fisheye pair is packed
9
+ * into a sub-region of the texture. Uniforms uScaleX/uScaleY/uOffsetX/uOffsetY
10
+ * select the appropriate region per eye.
11
+ */
12
+ /** Fisheye vertex shader -- passes world position to fragment shader */
13
+ export declare const fisheyeVertexShader = "\nvarying vec3 vWorldPosition;\n\nvoid main() {\n vec4 worldPos = modelMatrix * vec4(position, 1.0);\n vWorldPosition = worldPos.xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
14
+ /**
15
+ * Dual fisheye fragment shader -- maps sphere surface to circular fisheye UV.
16
+ *
17
+ * Stereo uniforms allow selecting a sub-region of the texture:
18
+ * - uScaleX / uScaleY: scale factor applied to the final UV (1.0 = full, 0.5 = half)
19
+ * - uOffsetX / uOffsetY: offset added after scaling (0.0 or 0.5 for stereo halves)
20
+ */
21
+ export declare const fisheyeFragmentShader = "\nuniform sampler2D map;\nuniform float uScaleX;\nuniform float uScaleY;\nuniform float uOffsetX;\nuniform float uOffsetY;\n\nvarying vec3 vWorldPosition;\n\nconst float PI = 3.14159265359;\n\nvoid main() {\n vec3 dir = normalize(vWorldPosition);\n\n // Determine which hemisphere: front (z >= 0) or back (z < 0)\n bool isFront = dir.z >= 0.0;\n float faceSign = isFront ? 1.0 : -1.0;\n\n // Polar angle from the hemisphere pole (0 at pole, PI/2 at equator)\n float theta = acos(clamp(abs(dir.z), -1.0, 1.0));\n\n // Azimuthal angle around the hemisphere pole\n float phi = atan(dir.y, dir.x * faceSign);\n\n // Map to circular fisheye UV using equidistant projection\n // r ranges from 0 (pole) to 1 (equator)\n float r = theta / (PI * 0.5);\n\n // Convert polar (r, phi) to cartesian circle coordinates, centered at (0.5, 0.5)\n vec2 circleUV = vec2(r * cos(phi), r * sin(phi)) * 0.5 + 0.5;\n\n // Place front hemisphere in left half of the dual-fisheye region,\n // back hemisphere in right half\n float xOffset = isFront ? 0.0 : 0.5;\n vec2 uv = vec2(circleUV.x * 0.5 + xOffset, circleUV.y);\n\n // Apply stereo region selection\n uv = vec2(uv.x * uScaleX + uOffsetX, uv.y * uScaleY + uOffsetY);\n\n gl_FragColor = texture2D(map, uv);\n}\n";
22
+ //# sourceMappingURL=fisheye.glsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fisheye.glsl.d.ts","sourceRoot":"","sources":["../../../src/renderer/shaders/fisheye.glsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,4NAQ/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,ovCAyCjC,CAAC"}
@@ -0,0 +1,146 @@
1
+ import { M as Matrix4 } from "./three-Bci7aSeI.js";
2
+ class AmbisonicRenderer {
3
+ foaRenderer = null;
4
+ context = null;
5
+ rotationMatrix = new Matrix4();
6
+ /**
7
+ * Initialize the FOA decoder and connect the audio graph.
8
+ *
9
+ * @param context - The AudioContext
10
+ * @param sourceNode - MediaElementAudioSourceNode from the video element
11
+ */
12
+ async init(context, sourceNode) {
13
+ this.context = context;
14
+ const Omnitone = await this.loadOmnitone();
15
+ this.foaRenderer = Omnitone.createFOARenderer(context, {
16
+ // AmbiX channel ordering (ACN) with SN3D normalization
17
+ channelMap: [0, 1, 2, 3]
18
+ });
19
+ await this.foaRenderer.initialize();
20
+ sourceNode.connect(this.foaRenderer.input);
21
+ this.foaRenderer.output.connect(context.destination);
22
+ this.foaRenderer.setRenderingMode("ambisonic");
23
+ }
24
+ /**
25
+ * Update the soundfield rotation from the camera's world matrix.
26
+ * Called each frame from the renderer tick loop.
27
+ */
28
+ updateOrientation(camera) {
29
+ if (!this.foaRenderer) return;
30
+ camera.updateMatrixWorld();
31
+ this.rotationMatrix.extractRotation(camera.matrixWorld);
32
+ this.foaRenderer.setRotationMatrix4(
33
+ Array.from(this.rotationMatrix.elements)
34
+ );
35
+ }
36
+ /** Dispose audio resources */
37
+ dispose() {
38
+ if (this.foaRenderer) {
39
+ this.foaRenderer.setRenderingMode("off");
40
+ }
41
+ this.foaRenderer = null;
42
+ this.context = null;
43
+ }
44
+ /**
45
+ * Dynamically import Omnitone.
46
+ * Falls back to window.Omnitone if a CDN script tag is used.
47
+ */
48
+ async loadOmnitone() {
49
+ try {
50
+ const mod = await import("omnitone");
51
+ return mod;
52
+ } catch {
53
+ const global = globalThis.Omnitone;
54
+ if (global) return global;
55
+ throw new Error(
56
+ "[Vizor] Omnitone not found. Install with `npm install omnitone` or include via CDN script tag."
57
+ );
58
+ }
59
+ }
60
+ }
61
+ class AudioManager {
62
+ constructor(state, events) {
63
+ this.state = state;
64
+ this.events = events;
65
+ this.audioFormat = "stereo";
66
+ }
67
+ audioContext = null;
68
+ sourceNode = null;
69
+ ambisonicRenderer = null;
70
+ audioFormat;
71
+ videoElement = null;
72
+ initialized = false;
73
+ /**
74
+ * Initialize audio processing for a video element.
75
+ * Must be called after a user gesture (click/play) to satisfy autoplay policy.
76
+ */
77
+ async init(videoElement, audioFormat = "stereo") {
78
+ if (this.initialized) return;
79
+ this.videoElement = videoElement;
80
+ this.audioFormat = audioFormat;
81
+ this.audioContext = new AudioContext();
82
+ this.sourceNode = this.audioContext.createMediaElementSource(videoElement);
83
+ if (audioFormat === "ambix") {
84
+ this.ambisonicRenderer = new AmbisonicRenderer();
85
+ try {
86
+ await this.ambisonicRenderer.init(this.audioContext, this.sourceNode);
87
+ } catch (err) {
88
+ console.warn("[Vizor] Ambisonic init failed, falling back to stereo:", err);
89
+ this.events.emit("vz-error", {
90
+ code: "AUDIO_AMBISONIC_FAILED",
91
+ message: "Ambisonic audio failed, using stereo fallback"
92
+ });
93
+ this.ambisonicRenderer = null;
94
+ this.sourceNode.connect(this.audioContext.destination);
95
+ }
96
+ } else {
97
+ this.sourceNode.connect(this.audioContext.destination);
98
+ }
99
+ this.initialized = true;
100
+ }
101
+ /**
102
+ * Resume AudioContext after user gesture.
103
+ * Browsers require a user interaction before AudioContext can play.
104
+ */
105
+ async resume() {
106
+ if (this.audioContext && this.audioContext.state === "suspended") {
107
+ await this.audioContext.resume();
108
+ }
109
+ }
110
+ /**
111
+ * Update listener orientation from camera.
112
+ * Called each frame from the renderer tick loop.
113
+ */
114
+ updateOrientation(camera) {
115
+ if (!this.ambisonicRenderer || !this.initialized) return;
116
+ this.ambisonicRenderer.updateOrientation(camera);
117
+ }
118
+ /** Get the audio format */
119
+ getAudioFormat() {
120
+ return this.audioFormat;
121
+ }
122
+ /** Check if initialized */
123
+ isInitialized() {
124
+ return this.initialized;
125
+ }
126
+ /** Dispose all audio resources */
127
+ dispose() {
128
+ this.ambisonicRenderer?.dispose();
129
+ this.ambisonicRenderer = null;
130
+ if (this.sourceNode) {
131
+ this.sourceNode.disconnect();
132
+ this.sourceNode = null;
133
+ }
134
+ if (this.audioContext && this.audioContext.state !== "closed") {
135
+ this.audioContext.close().catch(() => {
136
+ });
137
+ }
138
+ this.audioContext = null;
139
+ this.videoElement = null;
140
+ this.initialized = false;
141
+ }
142
+ }
143
+ export {
144
+ AudioManager as A
145
+ };
146
+ //# sourceMappingURL=spatial-BeadwNJA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spatial-BeadwNJA.js","sources":["../src/audio/ambisonic-renderer.ts","../src/audio/audio-manager.ts"],"sourcesContent":["import type { PerspectiveCamera } from 'three';\nimport { Matrix4 } from 'three';\n\n/**\n * Omnitone FOARenderer types (dynamically imported).\n * We define a minimal interface to avoid a hard dependency.\n */\ninterface OmnitoneFOARenderer {\n input: AudioNode;\n output: AudioNode;\n initialize(): Promise<void>;\n setRenderingMode(mode: 'ambisonic' | 'bypass' | 'off'): void;\n setRotationMatrix4(matrix: number[]): void;\n}\n\ninterface OmnitoneModule {\n createFOARenderer(context: AudioContext, options?: Record<string, unknown>): OmnitoneFOARenderer;\n}\n\n/**\n * Decodes first-order ambisonic (FOA) AmbiX audio to binaural stereo.\n *\n * Uses Omnitone (Google Chrome Labs) for spatial audio decoding.\n * The soundfield rotation is updated each frame from the Three.js camera's\n * world matrix, keeping audio orientation in sync with the visual scene.\n *\n * Audio graph:\n * MediaElementSource → FOARenderer.input → FOARenderer.output → AudioContext.destination\n */\nexport class AmbisonicRenderer {\n private foaRenderer: OmnitoneFOARenderer | null = null;\n private context: AudioContext | null = null;\n private rotationMatrix = new Matrix4();\n\n /**\n * Initialize the FOA decoder and connect the audio graph.\n *\n * @param context - The AudioContext\n * @param sourceNode - MediaElementAudioSourceNode from the video element\n */\n async init(context: AudioContext, sourceNode: MediaElementAudioSourceNode): Promise<void> {\n this.context = context;\n\n // Dynamic import — omnitone is an optional dependency\n const Omnitone = await this.loadOmnitone();\n\n this.foaRenderer = Omnitone.createFOARenderer(context, {\n // AmbiX channel ordering (ACN) with SN3D normalization\n channelMap: [0, 1, 2, 3],\n });\n\n await this.foaRenderer.initialize();\n\n // Connect: source → FOA decoder → speakers\n sourceNode.connect(this.foaRenderer.input);\n this.foaRenderer.output.connect(context.destination);\n\n this.foaRenderer.setRenderingMode('ambisonic');\n }\n\n /**\n * Update the soundfield rotation from the camera's world matrix.\n * Called each frame from the renderer tick loop.\n */\n updateOrientation(camera: PerspectiveCamera): void {\n if (!this.foaRenderer) return;\n\n // Extract the rotation matrix from the camera's world matrix.\n // Camera.matrixWorld is automatically updated by Three.js each frame.\n // We need the inverse rotation — Omnitone expects the listener's rotation\n // (where the listener is looking), which is the camera's rotation inverted\n // because the soundfield should rotate opposite to the head movement.\n camera.updateMatrixWorld();\n this.rotationMatrix.extractRotation(camera.matrixWorld);\n\n // Omnitone expects a column-major Float32Array/number[]\n // Three.js Matrix4.elements is already column-major\n this.foaRenderer.setRotationMatrix4(\n Array.from(this.rotationMatrix.elements),\n );\n }\n\n /** Dispose audio resources */\n dispose(): void {\n if (this.foaRenderer) {\n this.foaRenderer.setRenderingMode('off');\n }\n this.foaRenderer = null;\n this.context = null;\n }\n\n /**\n * Dynamically import Omnitone.\n * Falls back to window.Omnitone if a CDN script tag is used.\n */\n private async loadOmnitone(): Promise<OmnitoneModule> {\n try {\n // Try ES module import first (npm install omnitone)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore — omnitone has no type declarations; we define our own interface above\n const mod = await import('omnitone');\n return mod as unknown as OmnitoneModule;\n } catch {\n // Fall back to global (CDN script tag)\n const global = (globalThis as Record<string, unknown>).Omnitone as OmnitoneModule | undefined;\n if (global) return global;\n throw new Error(\n '[Vizor] Omnitone not found. Install with `npm install omnitone` or include via CDN script tag.',\n );\n }\n }\n}\n","import type { PerspectiveCamera } from 'three';\nimport type { PlayerState } from '../core/player-state.js';\nimport type { VzEventEmitter } from '../core/event-emitter.js';\nimport { AmbisonicRenderer } from './ambisonic-renderer.js';\n\nexport type AudioFormat = 'ambix' | 'stereo';\n\n/**\n * Manages audio playback and spatial audio decoding.\n *\n * For standard stereo audio: passes through unchanged.\n * For AmbiX FOA audio: decodes 4-channel ambisonic stream to binaural stereo,\n * rotating the soundfield to match camera orientation each frame.\n */\nexport class AudioManager {\n private audioContext: AudioContext | null = null;\n private sourceNode: MediaElementAudioSourceNode | null = null;\n private ambisonicRenderer: AmbisonicRenderer | null = null;\n private audioFormat: AudioFormat;\n private videoElement: HTMLVideoElement | null = null;\n private initialized = false;\n\n constructor(\n private state: PlayerState,\n private events: VzEventEmitter,\n ) {\n this.audioFormat = 'stereo';\n }\n\n /**\n * Initialize audio processing for a video element.\n * Must be called after a user gesture (click/play) to satisfy autoplay policy.\n */\n async init(videoElement: HTMLVideoElement, audioFormat: AudioFormat = 'stereo'): Promise<void> {\n if (this.initialized) return;\n\n this.videoElement = videoElement;\n this.audioFormat = audioFormat;\n\n // Create AudioContext (lazy — created on first init to avoid autoplay issues)\n this.audioContext = new AudioContext();\n\n // Create source node from the video element\n this.sourceNode = this.audioContext.createMediaElementSource(videoElement);\n\n if (audioFormat === 'ambix') {\n // Dynamic import of ambisonic renderer\n this.ambisonicRenderer = new AmbisonicRenderer();\n try {\n await this.ambisonicRenderer.init(this.audioContext, this.sourceNode);\n } catch (err) {\n console.warn('[Vizor] Ambisonic init failed, falling back to stereo:', err);\n this.events.emit('vz-error', {\n code: 'AUDIO_AMBISONIC_FAILED',\n message: 'Ambisonic audio failed, using stereo fallback',\n });\n // Fall back to stereo passthrough\n this.ambisonicRenderer = null;\n this.sourceNode.connect(this.audioContext.destination);\n }\n } else {\n // Stereo passthrough — connect source directly to destination\n this.sourceNode.connect(this.audioContext.destination);\n }\n\n this.initialized = true;\n }\n\n /**\n * Resume AudioContext after user gesture.\n * Browsers require a user interaction before AudioContext can play.\n */\n async resume(): Promise<void> {\n if (this.audioContext && this.audioContext.state === 'suspended') {\n await this.audioContext.resume();\n }\n }\n\n /**\n * Update listener orientation from camera.\n * Called each frame from the renderer tick loop.\n */\n updateOrientation(camera: PerspectiveCamera): void {\n if (!this.ambisonicRenderer || !this.initialized) return;\n this.ambisonicRenderer.updateOrientation(camera);\n }\n\n /** Get the audio format */\n getAudioFormat(): AudioFormat {\n return this.audioFormat;\n }\n\n /** Check if initialized */\n isInitialized(): boolean {\n return this.initialized;\n }\n\n /** Dispose all audio resources */\n dispose(): void {\n this.ambisonicRenderer?.dispose();\n this.ambisonicRenderer = null;\n\n if (this.sourceNode) {\n this.sourceNode.disconnect();\n this.sourceNode = null;\n }\n\n if (this.audioContext && this.audioContext.state !== 'closed') {\n this.audioContext.close().catch(() => {});\n }\n this.audioContext = null;\n this.videoElement = null;\n this.initialized = false;\n }\n}\n"],"names":[],"mappings":";AA6BO,MAAM,kBAAkB;AAAA,EACrB,cAA0C;AAAA,EAC1C,UAA+B;AAAA,EAC/B,iBAAiB,IAAI,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,KAAK,SAAuB,YAAwD;AACxF,SAAK,UAAU;AAGf,UAAM,WAAW,MAAM,KAAK,aAAA;AAE5B,SAAK,cAA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