@xrift/world-components 0.21.12 → 0.22.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 (196) hide show
  1. package/dist/components/LiveVideoPlayer/components/ControlPanel/LiveIndicator.d.ts +8 -0
  2. package/dist/components/LiveVideoPlayer/components/ControlPanel/LiveIndicator.d.ts.map +1 -0
  3. package/dist/components/LiveVideoPlayer/{LiveIndicator.js → components/ControlPanel/LiveIndicator.js} +5 -5
  4. package/dist/components/LiveVideoPlayer/components/ControlPanel/LiveIndicator.js.map +1 -0
  5. package/dist/components/LiveVideoPlayer/components/ControlPanel/index.d.ts +16 -0
  6. package/dist/components/LiveVideoPlayer/components/ControlPanel/index.d.ts.map +1 -0
  7. package/dist/components/LiveVideoPlayer/components/ControlPanel/index.js +28 -0
  8. package/dist/components/LiveVideoPlayer/components/ControlPanel/index.js.map +1 -0
  9. package/dist/components/LiveVideoPlayer/components/LiveVideoTexture.d.ts +14 -0
  10. package/dist/components/LiveVideoPlayer/components/LiveVideoTexture.d.ts.map +1 -0
  11. package/dist/components/LiveVideoPlayer/components/LiveVideoTexture.js +18 -0
  12. package/dist/components/LiveVideoPlayer/components/LiveVideoTexture.js.map +1 -0
  13. package/dist/components/LiveVideoPlayer/components/index.d.ts +3 -0
  14. package/dist/components/LiveVideoPlayer/components/index.d.ts.map +1 -0
  15. package/dist/components/LiveVideoPlayer/components/index.js +3 -0
  16. package/dist/components/LiveVideoPlayer/components/index.js.map +1 -0
  17. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/__tests__/utils.test.d.ts +2 -0
  18. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/__tests__/utils.test.d.ts.map +1 -0
  19. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/__tests__/utils.test.js +196 -0
  20. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/__tests__/utils.test.js.map +1 -0
  21. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/HlsJsPlayer.d.ts +17 -0
  22. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/HlsJsPlayer.d.ts.map +1 -0
  23. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/HlsJsPlayer.js +73 -0
  24. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/HlsJsPlayer.js.map +1 -0
  25. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/NativeHlsPlayer.d.ts +14 -0
  26. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/NativeHlsPlayer.d.ts.map +1 -0
  27. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/NativeHlsPlayer.js +46 -0
  28. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/NativeHlsPlayer.js.map +1 -0
  29. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/RecoveryTracker.d.ts +21 -0
  30. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/RecoveryTracker.d.ts.map +1 -0
  31. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/RecoveryTracker.js +54 -0
  32. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/RecoveryTracker.js.map +1 -0
  33. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/HlsJsPlayer.test.d.ts +2 -0
  34. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/HlsJsPlayer.test.d.ts.map +1 -0
  35. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/HlsJsPlayer.test.js +146 -0
  36. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/HlsJsPlayer.test.js.map +1 -0
  37. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/NativeHlsPlayer.test.d.ts +2 -0
  38. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/NativeHlsPlayer.test.d.ts.map +1 -0
  39. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/NativeHlsPlayer.test.js +94 -0
  40. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/NativeHlsPlayer.test.js.map +1 -0
  41. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/RecoveryTracker.test.d.ts +2 -0
  42. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/RecoveryTracker.test.d.ts.map +1 -0
  43. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/RecoveryTracker.test.js +74 -0
  44. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/RecoveryTracker.test.js.map +1 -0
  45. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/index.d.ts +31 -0
  46. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/index.d.ts.map +1 -0
  47. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/index.js +108 -0
  48. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/index.js.map +1 -0
  49. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/types.d.ts +34 -0
  50. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/types.d.ts.map +1 -0
  51. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/types.js +2 -0
  52. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/types.js.map +1 -0
  53. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/utils.d.ts +15 -0
  54. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/utils.d.ts.map +1 -0
  55. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/utils.js +62 -0
  56. package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/utils.js.map +1 -0
  57. package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.d.ts +25 -0
  58. package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.d.ts.map +1 -0
  59. package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.js +97 -0
  60. package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.js.map +1 -0
  61. package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.d.ts +25 -0
  62. package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.d.ts.map +1 -0
  63. package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.js +97 -0
  64. package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.js.map +1 -0
  65. package/dist/components/LiveVideoPlayer/index.d.ts +20 -3
  66. package/dist/components/LiveVideoPlayer/index.d.ts.map +1 -1
  67. package/dist/components/LiveVideoPlayer/index.js +16 -133
  68. package/dist/components/LiveVideoPlayer/index.js.map +1 -1
  69. package/dist/components/LiveVideoPlayer/types.d.ts +6 -66
  70. package/dist/components/LiveVideoPlayer/types.d.ts.map +1 -1
  71. package/dist/components/Video180Sphere/EyeView.d.ts +14 -0
  72. package/dist/components/Video180Sphere/EyeView.d.ts.map +1 -0
  73. package/dist/components/Video180Sphere/EyeView.js +77 -0
  74. package/dist/components/Video180Sphere/EyeView.js.map +1 -0
  75. package/dist/components/Video180Sphere/index.d.ts +19 -0
  76. package/dist/components/Video180Sphere/index.d.ts.map +1 -0
  77. package/dist/components/Video180Sphere/index.js +90 -0
  78. package/dist/components/Video180Sphere/index.js.map +1 -0
  79. package/dist/components/Video180Sphere/types.d.ts +35 -0
  80. package/dist/components/Video180Sphere/types.d.ts.map +1 -0
  81. package/dist/components/Video180Sphere/types.js +2 -0
  82. package/dist/components/Video180Sphere/types.js.map +1 -0
  83. package/dist/components/VideoPlayer/ControlPanel.d.ts +1 -1
  84. package/dist/components/VideoPlayer/ControlPanel.d.ts.map +1 -1
  85. package/dist/components/VideoPlayer/ControlPanel.js +20 -9
  86. package/dist/components/VideoPlayer/ControlPanel.js.map +1 -1
  87. package/dist/components/VideoPlayer/ProgressBar.d.ts.map +1 -1
  88. package/dist/components/VideoPlayer/ProgressBar.js +2 -1
  89. package/dist/components/VideoPlayer/ProgressBar.js.map +1 -1
  90. package/dist/components/VideoPlayer/__tests__/utils.test.d.ts +2 -0
  91. package/dist/components/VideoPlayer/__tests__/utils.test.d.ts.map +1 -0
  92. package/dist/components/VideoPlayer/__tests__/utils.test.js +23 -0
  93. package/dist/components/VideoPlayer/__tests__/utils.test.js.map +1 -0
  94. package/dist/components/VideoPlayer/components/ControlPanel.d.ts +18 -0
  95. package/dist/components/VideoPlayer/components/ControlPanel.d.ts.map +1 -0
  96. package/dist/components/VideoPlayer/components/ControlPanel.js +34 -0
  97. package/dist/components/VideoPlayer/components/ControlPanel.js.map +1 -0
  98. package/dist/components/VideoPlayer/components/ProgressBar.d.ts +12 -0
  99. package/dist/components/VideoPlayer/components/ProgressBar.d.ts.map +1 -0
  100. package/dist/components/VideoPlayer/components/ProgressBar.js +21 -0
  101. package/dist/components/VideoPlayer/components/ProgressBar.js.map +1 -0
  102. package/dist/components/VideoPlayer/components/index.d.ts +3 -0
  103. package/dist/components/VideoPlayer/components/index.d.ts.map +1 -0
  104. package/dist/components/VideoPlayer/components/index.js +3 -0
  105. package/dist/components/VideoPlayer/components/index.js.map +1 -0
  106. package/dist/components/VideoPlayer/index.d.ts +20 -3
  107. package/dist/components/VideoPlayer/index.d.ts.map +1 -1
  108. package/dist/components/VideoPlayer/index.js +29 -89
  109. package/dist/components/VideoPlayer/index.js.map +1 -1
  110. package/dist/components/VideoPlayer/types.d.ts +1 -28
  111. package/dist/components/VideoPlayer/types.d.ts.map +1 -1
  112. package/dist/components/VideoPlayer/utils.d.ts +0 -27
  113. package/dist/components/VideoPlayer/utils.d.ts.map +1 -1
  114. package/dist/components/VideoPlayer/utils.js +0 -28
  115. package/dist/components/VideoPlayer/utils.js.map +1 -1
  116. package/dist/components/VideoPlayer/utils.test.js +1 -87
  117. package/dist/components/VideoPlayer/utils.test.js.map +1 -1
  118. package/dist/components/commons/ErrorBoundary/index.d.ts +18 -0
  119. package/dist/components/commons/ErrorBoundary/index.d.ts.map +1 -0
  120. package/dist/components/commons/ErrorBoundary/index.js +22 -0
  121. package/dist/components/commons/ErrorBoundary/index.js.map +1 -0
  122. package/dist/components/commons/IconButton/index.d.ts +23 -0
  123. package/dist/components/commons/IconButton/index.d.ts.map +1 -0
  124. package/dist/components/commons/IconButton/index.js +12 -0
  125. package/dist/components/commons/IconButton/index.js.map +1 -0
  126. package/dist/components/commons/PlaceholderScreen/index.d.ts +9 -0
  127. package/dist/components/commons/PlaceholderScreen/index.d.ts.map +1 -0
  128. package/dist/components/commons/PlaceholderScreen/index.js +6 -0
  129. package/dist/components/commons/PlaceholderScreen/index.js.map +1 -0
  130. package/dist/components/commons/VideoMesh/index.d.ts +14 -0
  131. package/dist/components/commons/VideoMesh/index.d.ts.map +1 -0
  132. package/dist/components/commons/VideoMesh/index.js +91 -0
  133. package/dist/components/commons/VideoMesh/index.js.map +1 -0
  134. package/dist/components/commons/VolumeControl/index.d.ts +9 -0
  135. package/dist/components/commons/VolumeControl/index.d.ts.map +1 -0
  136. package/dist/components/{LiveVideoPlayer/VolumeControl.js → commons/VolumeControl/index.js} +6 -3
  137. package/dist/components/commons/VolumeControl/index.js.map +1 -0
  138. package/dist/components/commons/utils.d.ts +24 -0
  139. package/dist/components/commons/utils.d.ts.map +1 -0
  140. package/dist/components/commons/utils.js +23 -0
  141. package/dist/components/commons/utils.js.map +1 -0
  142. package/dist/components/commons/utils.test.d.ts +2 -0
  143. package/dist/components/commons/utils.test.d.ts.map +1 -0
  144. package/dist/components/commons/utils.test.js +79 -0
  145. package/dist/components/commons/utils.test.js.map +1 -0
  146. package/dist/hooks/useSyncState.d.ts +8 -0
  147. package/dist/hooks/useSyncState.d.ts.map +1 -0
  148. package/dist/hooks/useSyncState.js +16 -0
  149. package/dist/hooks/useSyncState.js.map +1 -0
  150. package/dist/hooks/useVideoElement.d.ts +30 -0
  151. package/dist/hooks/useVideoElement.d.ts.map +1 -0
  152. package/dist/hooks/useVideoElement.js +182 -0
  153. package/dist/hooks/useVideoElement.js.map +1 -0
  154. package/dist/index.d.ts +3 -2
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js +3 -2
  157. package/dist/index.js.map +1 -1
  158. package/package.json +2 -1
  159. package/dist/components/LiveVideoPlayer/ControlPanel.d.ts +0 -3
  160. package/dist/components/LiveVideoPlayer/ControlPanel.d.ts.map +0 -1
  161. package/dist/components/LiveVideoPlayer/ControlPanel.js +0 -17
  162. package/dist/components/LiveVideoPlayer/ControlPanel.js.map +0 -1
  163. package/dist/components/LiveVideoPlayer/LiveIndicator.d.ts +0 -3
  164. package/dist/components/LiveVideoPlayer/LiveIndicator.d.ts.map +0 -1
  165. package/dist/components/LiveVideoPlayer/LiveIndicator.js.map +0 -1
  166. package/dist/components/LiveVideoPlayer/PlayPauseButton.d.ts +0 -3
  167. package/dist/components/LiveVideoPlayer/PlayPauseButton.d.ts.map +0 -1
  168. package/dist/components/LiveVideoPlayer/PlayPauseButton.js +0 -9
  169. package/dist/components/LiveVideoPlayer/PlayPauseButton.js.map +0 -1
  170. package/dist/components/LiveVideoPlayer/ReloadButton.d.ts +0 -3
  171. package/dist/components/LiveVideoPlayer/ReloadButton.d.ts.map +0 -1
  172. package/dist/components/LiveVideoPlayer/ReloadButton.js +0 -9
  173. package/dist/components/LiveVideoPlayer/ReloadButton.js.map +0 -1
  174. package/dist/components/LiveVideoPlayer/UrlInputButton.d.ts +0 -3
  175. package/dist/components/LiveVideoPlayer/UrlInputButton.d.ts.map +0 -1
  176. package/dist/components/LiveVideoPlayer/UrlInputButton.js +0 -23
  177. package/dist/components/LiveVideoPlayer/UrlInputButton.js.map +0 -1
  178. package/dist/components/LiveVideoPlayer/VolumeControl.d.ts +0 -3
  179. package/dist/components/LiveVideoPlayer/VolumeControl.d.ts.map +0 -1
  180. package/dist/components/LiveVideoPlayer/VolumeControl.js.map +0 -1
  181. package/dist/components/VideoPlayer/PlayPauseButton.d.ts +0 -3
  182. package/dist/components/VideoPlayer/PlayPauseButton.d.ts.map +0 -1
  183. package/dist/components/VideoPlayer/PlayPauseButton.js +0 -9
  184. package/dist/components/VideoPlayer/PlayPauseButton.js.map +0 -1
  185. package/dist/components/VideoPlayer/StopButton.d.ts +0 -3
  186. package/dist/components/VideoPlayer/StopButton.d.ts.map +0 -1
  187. package/dist/components/VideoPlayer/StopButton.js +0 -9
  188. package/dist/components/VideoPlayer/StopButton.js.map +0 -1
  189. package/dist/components/VideoPlayer/UrlInputButton.d.ts +0 -3
  190. package/dist/components/VideoPlayer/UrlInputButton.d.ts.map +0 -1
  191. package/dist/components/VideoPlayer/UrlInputButton.js +0 -23
  192. package/dist/components/VideoPlayer/UrlInputButton.js.map +0 -1
  193. package/dist/components/VideoPlayer/VolumeControl.d.ts +0 -3
  194. package/dist/components/VideoPlayer/VolumeControl.d.ts.map +0 -1
  195. package/dist/components/VideoPlayer/VolumeControl.js +0 -26
  196. package/dist/components/VideoPlayer/VolumeControl.js.map +0 -1
@@ -0,0 +1,62 @@
1
+ import { VideoTexture, SRGBColorSpace, LinearFilter } from 'three';
2
+ import { HlsJsPlayer } from './classes/HlsJsPlayer';
3
+ import { NativeHlsPlayer } from './classes/NativeHlsPlayer';
4
+ /** URLがHLSストリームかどうかを判定 */
5
+ export function isHlsUrl(url) {
6
+ return url.includes('.m3u8') || url.includes('application/vnd.apple.mpegurl');
7
+ }
8
+ /** Safari(native HLS対応ブラウザ)かどうかを判定 */
9
+ export function canPlayHlsNatively() {
10
+ if (typeof document === 'undefined')
11
+ return false;
12
+ const video = document.createElement('video');
13
+ return video.canPlayType('application/vnd.apple.mpegurl') !== '';
14
+ }
15
+ /** URLにキャッシュバスター用のキーを付与 */
16
+ export function appendCacheKey(url, cacheKey) {
17
+ return `${url}${url.includes('?') ? '&' : '?'}_ck=${cacheKey}`;
18
+ }
19
+ /** HLS再生用のvideo要素とテクスチャを作成 */
20
+ export function createVideoTexture() {
21
+ const video = document.createElement('video');
22
+ video.crossOrigin = 'anonymous';
23
+ video.playsInline = true;
24
+ video.muted = false;
25
+ const texture = new VideoTexture(video);
26
+ texture.colorSpace = SRGBColorSpace;
27
+ texture.minFilter = LinearFilter;
28
+ texture.magFilter = LinearFilter;
29
+ return { video, texture };
30
+ }
31
+ /**
32
+ * 環境に応じて適切な HLS プレイヤーを作成
33
+ * hls.js を優先し、利用できない場合はネイティブ HLS にフォールバック
34
+ */
35
+ export async function createHlsPlayer(options) {
36
+ // hls.js を優先
37
+ try {
38
+ const Hls = (await import('hls.js')).default;
39
+ if (Hls.isSupported()) {
40
+ return {
41
+ player: new HlsJsPlayer(Hls, options),
42
+ type: 'hlsjs',
43
+ };
44
+ }
45
+ }
46
+ catch (err) {
47
+ console.warn('[createHlsPlayer] Failed to load hls.js:', err);
48
+ }
49
+ // ネイティブ HLS にフォールバック
50
+ if (canPlayHlsNatively()) {
51
+ return {
52
+ player: new NativeHlsPlayer(options),
53
+ type: 'native',
54
+ };
55
+ }
56
+ return {
57
+ player: null,
58
+ type: 'unsupported',
59
+ error: new Error('HLS playback is not supported in this browser'),
60
+ };
61
+ }
62
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/components/LiveVideoPlayer/hooks/useHlsVideo/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAG3D,0BAA0B;AAC1B,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAA;AAC/E,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,kBAAkB;IAChC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,KAAK,CAAA;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,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,0CAA0C,EAAE,GAAG,CAAC,CAAA;IAC/D,CAAC;IAED,qBAAqB;IACrB,IAAI,kBAAkB,EAAE,EAAE,CAAC;QACzB,OAAO;YACL,MAAM,EAAE,IAAI,eAAe,CAAC,OAAO,CAAC;YACpC,IAAI,EAAE,QAAQ;SACf,CAAA;IACH,CAAC;IAED,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,IAAI,KAAK,CAAC,+CAA+C,CAAC;KAClE,CAAA;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type SyncMode } from "../../../../hooks/useSyncState";
2
+ import type { LiveVideoState } from "../../types";
3
+ interface UseLiveVideoPlayerOptions {
4
+ id: string;
5
+ initialUrl?: string;
6
+ initialPlaying?: boolean;
7
+ initialVolume?: number;
8
+ sync?: SyncMode;
9
+ }
10
+ export declare const useLiveVideoPlayer: ({ id, initialUrl, initialPlaying, initialVolume, sync, }: UseLiveVideoPlayerOptions) => {
11
+ videoState: LiveVideoState;
12
+ volume: number;
13
+ isBuffering: boolean;
14
+ isRetrying: boolean;
15
+ handlers: {
16
+ onUrlChange: (newUrl: string) => void;
17
+ onPlayPause: () => void;
18
+ onStop: () => void;
19
+ onVolumeChange: (newVolume: number) => void;
20
+ onBufferingChange: (buffering: boolean) => void;
21
+ onError: (error: Error) => void;
22
+ };
23
+ };
24
+ export {};
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,UAAU,yBAAyB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,GAAI,0DAMhC,yBAAyB;;;;;;8BAqCf,MAAM;;;oCA4BkC,MAAM;uCAIH,OAAO;yBASnD,KAAK;;CAoChB,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { useState, useCallback, useEffect, useRef } from "react";
2
+ import { useSyncState } from "../../../../hooks/useSyncState";
3
+ const RETRY_DELAY_MS = 2000;
4
+ export const useLiveVideoPlayer = ({ id, initialUrl, initialPlaying = false, initialVolume = 1, sync = "global", }) => {
5
+ const [videoState, setVideoState] = useSyncState(`live-video-${id}`, {
6
+ url: initialUrl,
7
+ playing: initialPlaying,
8
+ reloadKey: 0,
9
+ }, sync);
10
+ // 音量は常にローカル(個人設定)
11
+ const [volume, setVolume] = useState(initialVolume);
12
+ // バッファリング状態もローカル
13
+ const [isBuffering, setIsBuffering] = useState(false);
14
+ // リトライ状態(エラー発生時に無限自動リトライ)
15
+ const [isRetrying, setIsRetrying] = useState(false);
16
+ const retryTimeoutRef = useRef(null);
17
+ // コンポーネントのクリーンアップ時にタイマーをクリア
18
+ useEffect(() => {
19
+ return () => {
20
+ if (retryTimeoutRef.current) {
21
+ clearTimeout(retryTimeoutRef.current);
22
+ }
23
+ };
24
+ }, []);
25
+ const clearRetryState = useCallback(() => {
26
+ setIsRetrying(false);
27
+ if (retryTimeoutRef.current) {
28
+ clearTimeout(retryTimeoutRef.current);
29
+ retryTimeoutRef.current = null;
30
+ }
31
+ }, []);
32
+ const handleUrlChange = useCallback((newUrl) => {
33
+ setVideoState((prev) => ({
34
+ ...prev,
35
+ url: newUrl,
36
+ playing: !!newUrl,
37
+ }));
38
+ clearRetryState();
39
+ }, [setVideoState, clearRetryState]);
40
+ const handlePlayPause = useCallback(() => {
41
+ setVideoState((prev) => ({
42
+ ...prev,
43
+ playing: !prev.playing,
44
+ }));
45
+ }, [setVideoState]);
46
+ const handleStop = useCallback(() => {
47
+ setVideoState((prev) => ({
48
+ url: undefined,
49
+ playing: false,
50
+ reloadKey: prev.reloadKey + 1,
51
+ }));
52
+ setIsBuffering(false);
53
+ clearRetryState();
54
+ }, [setVideoState, clearRetryState]);
55
+ const handleVolumeChange = useCallback((newVolume) => {
56
+ setVolume(newVolume);
57
+ }, []);
58
+ const handleBufferingChange = useCallback((buffering) => {
59
+ setIsBuffering(buffering);
60
+ // 再生成功(バッファリング解除)時にリトライ状態をリセット
61
+ if (!buffering) {
62
+ setIsRetrying(false);
63
+ }
64
+ }, []);
65
+ const handleError = useCallback((error) => {
66
+ // リトライ中は新しいエラーを無視(タイムアウト待機中)
67
+ if (isRetrying)
68
+ return;
69
+ console.warn(`LiveVideoPlayer error, retrying...`, error.message);
70
+ // 無限リトライ(接続成功または手動停止まで)
71
+ setIsRetrying(true);
72
+ setIsBuffering(true);
73
+ // 遅延してリロード(セグメント生成を待つ)
74
+ retryTimeoutRef.current = setTimeout(() => {
75
+ setIsRetrying(false);
76
+ setVideoState((prev) => ({
77
+ ...prev,
78
+ reloadKey: prev.reloadKey + 1,
79
+ }));
80
+ }, RETRY_DELAY_MS);
81
+ }, [setVideoState, isRetrying]);
82
+ return {
83
+ videoState,
84
+ volume,
85
+ isBuffering,
86
+ isRetrying,
87
+ handlers: {
88
+ onUrlChange: handleUrlChange,
89
+ onPlayPause: handlePlayPause,
90
+ onStop: handleStop,
91
+ onVolumeChange: handleVolumeChange,
92
+ onBufferingChange: handleBufferingChange,
93
+ onError: handleError,
94
+ },
95
+ };
96
+ };
97
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MA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C,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,KAAY,EAAE,EAAE;QACf,6BAA6B;QAC7B,IAAI,UAAU;YAAE,OAAO;QAEvB,OAAO,CAAC,IAAI,CAAC,oCAAoC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAElE,wBAAwB;QACxB,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,cAAc,CAAC,IAAI,CAAC,CAAC;QAErB,uBAAuB;QACvB,eAAe,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YACxC,aAAa,CAAC,KAAK,CAAC,CAAC;YACrB,aAAa,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACvB,GAAG,IAAI;gBACP,SAAS,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC;aAC9B,CAAC,CAAC,CAAC;QACN,CAAC,EAAE,cAAc,CAAC,CAAC;IACrB,CAAC,EACD,CAAC,aAAa,EAAE,UAAU,CAAC,CAC5B,CAAC;IAEF,OAAO;QACL,UAAU;QACV,MAAM;QACN,WAAW;QACX,UAAU;QACV,QAAQ,EAAE;YACR,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,eAAe;YAC5B,MAAM,EAAE,UAAU;YAClB,cAAc,EAAE,kBAAkB;YAClC,iBAAiB,EAAE,qBAAqB;YACxC,OAAO,EAAE,WAAW;SACrB;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type SyncMode } from "../../../hooks/useSyncState";
2
+ import type { LiveVideoState } from "../types";
3
+ interface UseLiveVideoPlayerOptions {
4
+ id: string;
5
+ initialUrl?: string;
6
+ initialPlaying?: boolean;
7
+ initialVolume?: number;
8
+ sync?: SyncMode;
9
+ }
10
+ export declare const useLiveVideoPlayer: ({ id, initialUrl, initialPlaying, initialVolume, sync, }: UseLiveVideoPlayerOptions) => {
11
+ videoState: LiveVideoState;
12
+ volume: number;
13
+ isBuffering: boolean;
14
+ isRetrying: boolean;
15
+ handlers: {
16
+ onUrlChange: (newUrl: string) => void;
17
+ onPlayPause: () => void;
18
+ onStop: () => void;
19
+ onVolumeChange: (newVolume: number) => void;
20
+ onBufferingChange: (buffering: boolean) => void;
21
+ onError: (error: Error) => void;
22
+ };
23
+ };
24
+ export {};
25
+ //# sourceMappingURL=useLiveVideoPlayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLiveVideoPlayer.d.ts","sourceRoot":"","sources":["../../../../src/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C,UAAU,yBAAyB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,GAAI,0DAMhC,yBAAyB;;;;;;8BAqCf,MAAM;;;oCA4BkC,MAAM;uCAIH,OAAO;yBASnD,KAAK;;CAoChB,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { useState, useCallback, useEffect, useRef } from "react";
2
+ import { useSyncState } from "../../../hooks/useSyncState";
3
+ const RETRY_DELAY_MS = 2000;
4
+ export const useLiveVideoPlayer = ({ id, initialUrl, initialPlaying = false, initialVolume = 1, sync = "global", }) => {
5
+ const [videoState, setVideoState] = useSyncState(`live-video-${id}`, {
6
+ url: initialUrl,
7
+ playing: initialPlaying,
8
+ reloadKey: 0,
9
+ }, sync);
10
+ // 音量は常にローカル(個人設定)
11
+ const [volume, setVolume] = useState(initialVolume);
12
+ // バッファリング状態もローカル
13
+ const [isBuffering, setIsBuffering] = useState(false);
14
+ // リトライ状態(エラー発生時に無限自動リトライ)
15
+ const [isRetrying, setIsRetrying] = useState(false);
16
+ const retryTimeoutRef = useRef(null);
17
+ // コンポーネントのクリーンアップ時にタイマーをクリア
18
+ useEffect(() => {
19
+ return () => {
20
+ if (retryTimeoutRef.current) {
21
+ clearTimeout(retryTimeoutRef.current);
22
+ }
23
+ };
24
+ }, []);
25
+ const clearRetryState = useCallback(() => {
26
+ setIsRetrying(false);
27
+ if (retryTimeoutRef.current) {
28
+ clearTimeout(retryTimeoutRef.current);
29
+ retryTimeoutRef.current = null;
30
+ }
31
+ }, []);
32
+ const handleUrlChange = useCallback((newUrl) => {
33
+ setVideoState((prev) => ({
34
+ ...prev,
35
+ url: newUrl,
36
+ playing: !!newUrl,
37
+ }));
38
+ clearRetryState();
39
+ }, [setVideoState, clearRetryState]);
40
+ const handlePlayPause = useCallback(() => {
41
+ setVideoState((prev) => ({
42
+ ...prev,
43
+ playing: !prev.playing,
44
+ }));
45
+ }, [setVideoState]);
46
+ const handleStop = useCallback(() => {
47
+ setVideoState((prev) => ({
48
+ url: undefined,
49
+ playing: false,
50
+ reloadKey: prev.reloadKey + 1,
51
+ }));
52
+ setIsBuffering(false);
53
+ clearRetryState();
54
+ }, [setVideoState, clearRetryState]);
55
+ const handleVolumeChange = useCallback((newVolume) => {
56
+ setVolume(newVolume);
57
+ }, []);
58
+ const handleBufferingChange = useCallback((buffering) => {
59
+ setIsBuffering(buffering);
60
+ // 再生成功(バッファリング解除)時にリトライ状態をリセット
61
+ if (!buffering) {
62
+ setIsRetrying(false);
63
+ }
64
+ }, []);
65
+ const handleError = useCallback((error) => {
66
+ // リトライ中は新しいエラーを無視(タイムアウト待機中)
67
+ if (isRetrying)
68
+ return;
69
+ console.warn(`LiveVideoPlayer error, retrying...`, error.message);
70
+ // 無限リトライ(接続成功または手動停止まで)
71
+ setIsRetrying(true);
72
+ setIsBuffering(true);
73
+ // 遅延してリロード(セグメント生成を待つ)
74
+ retryTimeoutRef.current = setTimeout(() => {
75
+ setIsRetrying(false);
76
+ setVideoState((prev) => ({
77
+ ...prev,
78
+ reloadKey: prev.reloadKey + 1,
79
+ }));
80
+ }, RETRY_DELAY_MS);
81
+ }, [setVideoState, isRetrying]);
82
+ return {
83
+ videoState,
84
+ volume,
85
+ isBuffering,
86
+ isRetrying,
87
+ handlers: {
88
+ onUrlChange: handleUrlChange,
89
+ onPlayPause: handlePlayPause,
90
+ onStop: handleStop,
91
+ onVolumeChange: handleVolumeChange,
92
+ onBufferingChange: handleBufferingChange,
93
+ onError: handleError,
94
+ },
95
+ };
96
+ };
97
+ //# sourceMappingURL=useLiveVideoPlayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLiveVideoPlayer.js","sourceRoot":"","sources":["../../../../src/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAiB,MAAM,6BAA6B,CAAC;AAG1E,MAAM,cAAc,GAAG,IAAI,CAAC;AAU5B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,EAAE,EACF,UAAU,EACV,cAAc,GAAG,KAAK,EACtB,aAAa,GAAG,CAAC,EACjB,IAAI,GAAG,QAAQ,GACW,EAAE,EAAE;IAC9B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,YAAY,CAC9C,cAAc,EAAE,EAAE,EAClB;QACE,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,cAAc;QACvB,SAAS,EAAE,CAAC;KACb,EACD,IAAI,CACL,CAAC;IAEF,kBAAkB;IAClB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACpD,iBAAiB;IACjB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,C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IACrB,CAAC,EACD,CAAC,aAAa,EAAE,UAAU,CAAC,CAC5B,CAAC;IAEF,OAAO;QACL,UAAU;QACV,MAAM;QACN,WAAW;QACX,UAAU;QACV,QAAQ,EAAE;YACR,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,eAAe;YAC5B,MAAM,EAAE,UAAU;YAClB,cAAc,EAAE,kBAAkB;YAClC,iBAAiB,EAAE,qBAAqB;YACxC,OAAO,EAAE,WAAW;SACrB;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +1,21 @@
1
- import type { LiveVideoPlayerProps } from "./types";
2
- export type { LiveVideoPlayerProps } from "./types";
3
- export declare const LiveVideoPlayer: import("react").MemoExoticComponent<({ id, position, rotation, width, url: initialUrl, playing: initialPlaying, volume: initialVolume, onError, }: LiveVideoPlayerProps) => import("react/jsx-runtime").JSX.Element>;
1
+ interface Props {
2
+ /** スクリーンの一意なID(必須) */
3
+ id: string;
4
+ /** スクリーンの位置 */
5
+ position?: [number, number, number];
6
+ /** スクリーンの回転 */
7
+ rotation?: [number, number, number];
8
+ /** スクリーンの幅(高さは16:9で自動計算、デフォルト: 4) */
9
+ width?: number;
10
+ /** ライブストリームのURL(HLS .m3u8 形式) */
11
+ url?: string;
12
+ /** 初期再生状態(デフォルト: false) */
13
+ playing?: boolean;
14
+ /** 初期音量 0〜1(デフォルト: 1) */
15
+ volume?: number;
16
+ /** 同期モード(デフォルト: 'global') */
17
+ sync?: 'global' | 'local';
18
+ }
19
+ export declare const LiveVideoPlayer: import("react").MemoExoticComponent<({ id, position, rotation, width, url: initialUrl, playing: initialPlaying, volume: initialVolume, sync, }: Props) => import("react/jsx-runtime").JSX.Element>;
20
+ export {};
4
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LiveVideoPlayer/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA+KpD,eAAO,MAAM,eAAe,qJAUvB,oBAAoB,6CAwHxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LiveVideoPlayer/index.tsx"],"names":[],"mappings":"AAQA,UAAU,KAAK;IACb,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,eAAe;IACf,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACnC,eAAe;IACf,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACnC,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,2BAA2B;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,6BAA6B;IAC7B,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;CAC1B;AAMD,eAAO,MAAM,eAAe,kJAUvB,KAAK,6CA0GT,CAAC"}
@@ -1,141 +1,24 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { memo, Suspense, useState, useCallback, useEffect, useRef, Component, } from "react";
3
- import { useVideoTexture, Text } from "@react-three/drei";
4
- import { ControlPanel } from "./ControlPanel";
5
- import { useWebAudioVolume } from "../../hooks/useWebAudioVolume";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo, Suspense } from "react";
3
+ import { Text } from "@react-three/drei";
4
+ import { ControlPanel } from "./components/ControlPanel";
5
+ import { LiveVideoTexture } from "./components/LiveVideoTexture";
6
+ import { ErrorBoundary } from "../commons/ErrorBoundary";
7
+ import { PlaceholderScreen } from "../commons/PlaceholderScreen";
8
+ import { useLiveVideoPlayer } from "./hooks/useLiveVideoPlayer";
6
9
  const DEFAULT_POSITION = [0, 2, -5];
7
10
  const DEFAULT_ROTATION = [0, 0, 0];
8
11
  const DEFAULT_WIDTH = 4;
9
- class VideoErrorBoundary extends Component {
10
- constructor(props) {
11
- super(props);
12
- this.state = { hasError: false };
13
- }
14
- static getDerivedStateFromError() {
15
- return { hasError: true };
16
- }
17
- componentDidCatch(error) {
18
- console.error("Video load error:", error);
19
- this.props.onError?.(error);
20
- }
21
- render() {
22
- if (this.state.hasError) {
23
- return this.props.fallback;
24
- }
25
- return this.props.children;
26
- }
27
- }
28
- /** 動画テクスチャを表示するコンポーネント(Suspense内で使用) */
29
- const VideoTexture = memo(({ url, cacheKey, width, screenHeight, playing, volume, onError, onBufferingChange, }) => {
30
- // suspend-reactのキャッシュを無効化するためにURLにcacheKeyを付与
31
- const urlWithCacheKey = `${url}${url.includes("?") ? "&" : "?"}_ck=${cacheKey}`;
32
- const texture = useVideoTexture(urlWithCacheKey, {
33
- muted: false,
34
- loop: false,
35
- start: playing,
12
+ export const LiveVideoPlayer = memo(({ id, position = DEFAULT_POSITION, rotation = DEFAULT_ROTATION, width = DEFAULT_WIDTH, url: initialUrl, playing: initialPlaying = false, volume: initialVolume = 1, sync = "global", }) => {
13
+ const { videoState, volume, isBuffering, isRetrying, handlers, } = useLiveVideoPlayer({
14
+ id,
15
+ initialUrl,
16
+ initialPlaying,
17
+ initialVolume,
18
+ sync,
36
19
  });
37
- const videoRef = useRef(texture.image);
38
- useEffect(() => {
39
- videoRef.current = texture.image;
40
- }, [texture]);
41
- useEffect(() => {
42
- const video = videoRef.current;
43
- if (!video)
44
- return;
45
- if (playing) {
46
- video.play().catch((err) => {
47
- console.error("Live video play error:", err);
48
- onError?.(err);
49
- });
50
- }
51
- else {
52
- video.pause();
53
- }
54
- }, [playing, onError, texture]);
55
- // Web Audio API を使用した音量制御(iOS対応)
56
- useWebAudioVolume(videoRef.current, volume);
57
- useEffect(() => {
58
- const video = videoRef.current;
59
- if (!video)
60
- return;
61
- const handleWaiting = () => onBufferingChange(true);
62
- const handlePlaying = () => onBufferingChange(false);
63
- const handleCanPlay = () => onBufferingChange(false);
64
- const handleError = (e) => {
65
- const error = e.target.error;
66
- if (error) {
67
- console.error("Live video error:", error.message);
68
- onError?.(new Error(error.message));
69
- }
70
- };
71
- video.addEventListener("waiting", handleWaiting);
72
- video.addEventListener("playing", handlePlaying);
73
- video.addEventListener("canplay", handleCanPlay);
74
- video.addEventListener("error", handleError);
75
- return () => {
76
- video.removeEventListener("waiting", handleWaiting);
77
- video.removeEventListener("playing", handlePlaying);
78
- video.removeEventListener("canplay", handleCanPlay);
79
- video.removeEventListener("error", handleError);
80
- };
81
- }, [texture, onError, onBufferingChange]);
82
- useEffect(() => {
83
- const video = texture.image;
84
- return () => {
85
- // 再生を停止
86
- video.pause();
87
- // ソースを完全にクリア
88
- video.src = "";
89
- video.removeAttribute("src");
90
- video.srcObject = null;
91
- // MediaSourceをリリースするためにloadを呼び出し
92
- video.load();
93
- // テクスチャを破棄
94
- texture.dispose();
95
- };
96
- }, [texture]);
97
- return (_jsxs("mesh", { children: [_jsx("planeGeometry", { args: [width, screenHeight] }), _jsx("meshBasicMaterial", { map: texture, toneMapped: false })] }));
98
- });
99
- VideoTexture.displayName = "VideoTexture";
100
- /** プレースホルダー画面(読み込み中/エラー時/URL未設定時) */
101
- const PlaceholderScreen = memo(({ width, screenHeight, color, }) => (_jsxs("mesh", { children: [_jsx("planeGeometry", { args: [width, screenHeight] }), _jsx("meshBasicMaterial", { color: color })] })));
102
- PlaceholderScreen.displayName = "PlaceholderScreen";
103
- export const LiveVideoPlayer = memo(({ id, position = DEFAULT_POSITION, rotation = DEFAULT_ROTATION, width = DEFAULT_WIDTH, url: initialUrl, playing: initialPlaying = false, volume: initialVolume = 1, onError, }) => {
104
- const [currentUrl, setCurrentUrl] = useState(initialUrl);
105
- const [playing, setPlaying] = useState(initialPlaying);
106
- const [volume, setVolume] = useState(initialVolume);
107
- const [isBuffering, setIsBuffering] = useState(false);
108
- const [hasError, setHasError] = useState(false);
109
- const [reloadKey, setReloadKey] = useState(0);
110
20
  const screenHeight = width * (9 / 16);
111
- const handleUrlChange = useCallback((newUrl) => {
112
- setCurrentUrl(newUrl);
113
- setHasError(false);
114
- if (newUrl) {
115
- setPlaying(true);
116
- }
117
- }, []);
118
- const handlePlayPause = useCallback(() => {
119
- setPlaying((prev) => !prev);
120
- }, []);
121
- const handleStop = useCallback(() => {
122
- setCurrentUrl(undefined);
123
- setPlaying(false);
124
- setIsBuffering(false);
125
- setHasError(false);
126
- setReloadKey((prev) => prev + 1);
127
- }, []);
128
- const handleVolumeChange = useCallback((newVolume) => {
129
- setVolume(newVolume);
130
- }, []);
131
- const handleBufferingChange = useCallback((buffering) => {
132
- setIsBuffering(buffering);
133
- }, []);
134
- const handleError = useCallback((error) => {
135
- setHasError(true);
136
- onError?.(error);
137
- }, [onError]);
138
- return (_jsxs("group", { position: position, rotation: rotation, children: [!currentUrl || hasError ? (_jsxs(_Fragment, { children: [_jsx(PlaceholderScreen, { width: width, screenHeight: screenHeight, color: "#000000" }), !currentUrl && (_jsx(Text, { position: [0, 0, 0.01], fontSize: width * 0.05, color: "#666666", anchorX: "center", anchorY: "middle", textAlign: "center", children: `ライブストリームURLを入力\nHLS .m3u8 形式` }))] })) : (_jsx(VideoErrorBoundary, { fallback: _jsx(PlaceholderScreen, { width: width, screenHeight: screenHeight, color: "#000000" }), onError: handleError, children: _jsx(Suspense, { fallback: _jsx(PlaceholderScreen, { width: width, screenHeight: screenHeight, color: "#333333" }), children: _jsx(VideoTexture, { url: currentUrl, cacheKey: reloadKey, width: width, screenHeight: screenHeight, playing: playing, volume: volume, onError: handleError, onBufferingChange: handleBufferingChange }, `${currentUrl}-${reloadKey}`) }) })), _jsx(ControlPanel, { id: id, width: width, screenHeight: screenHeight, playing: playing, volume: volume, isBuffering: isBuffering, currentUrl: currentUrl || "", onPlayPause: handlePlayPause, onStop: handleStop, onVolumeChange: handleVolumeChange, onUrlChange: handleUrlChange })] }));
21
+ return (_jsxs("group", { position: position, rotation: rotation, children: [!videoState.url || isRetrying ? (_jsxs(_Fragment, { children: [_jsx(PlaceholderScreen, { width: width, screenHeight: screenHeight, color: "#000000" }), !videoState.url && !isRetrying && (_jsx(Text, { position: [0, 0, 0.01], fontSize: width * 0.05, color: "#666666", anchorX: "center", anchorY: "middle", textAlign: "center", children: `ライブストリームURLを入力\nHLS .m3u8 形式` }))] })) : (_jsx(ErrorBoundary, { fallback: _jsx(PlaceholderScreen, { width: width, screenHeight: screenHeight, color: "#000000" }), onError: handlers.onError, children: _jsx(Suspense, { fallback: _jsx(PlaceholderScreen, { width: width, screenHeight: screenHeight, color: "#333333" }), children: _jsx(LiveVideoTexture, { url: videoState.url, cacheKey: videoState.reloadKey, width: width, height: screenHeight, playing: videoState.playing, volume: volume, onError: handlers.onError, onBufferingChange: handlers.onBufferingChange }) }) }, `error-boundary-${videoState.url}-${videoState.reloadKey}`)), isRetrying && (_jsx(Text, { position: [0, 0, 0.02], fontSize: width * 0.04, color: "#ffcc00", anchorX: "center", anchorY: "middle", textAlign: "center", children: "\u518D\u63A5\u7D9A\u4E2D..." })), _jsx(ControlPanel, { id: id, width: width, screenHeight: screenHeight, playing: videoState.playing, volume: volume, isBuffering: isBuffering, url: videoState.url || "", onPlayPause: handlers.onPlayPause, onStop: handlers.onStop, onVolumeChange: handlers.onVolumeChange, onUrlChange: handlers.onUrlChange })] }));
139
22
  });
140
23
  LiveVideoPlayer.displayName = "LiveVideoPlayer";
141
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LiveVideoPlayer/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACN,SAAS,GAEV,MAAM,OAAO,CAAC;AACf,OAAO,EA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erProps {
2
- /** スクリーンの一意なID(必須) */
3
- id: string;
4
- /** スクリーンの位置 */
5
- position?: [number, number, number];
6
- /** スクリーンの回転 */
7
- rotation?: [number, number, number];
8
- /** スクリーンの幅(高さは16:9で自動計算、デフォルト: 4) */
9
- width?: number;
10
- /** ライブストリームのURL(HLS .m3u8 形式) */
1
+ /** LiveVideoPlayerの同期状態 */
2
+ export interface LiveVideoState {
3
+ /** 再生中のURL */
11
4
  url?: string;
12
- /** 初期再生状態(デフォルト: false) */
13
- playing?: boolean;
14
- /** 初期音量 0〜1(デフォルト: 1) */
15
- volume?: number;
16
- /** 同期モード(デフォルト: 'global') */
17
- sync?: 'global' | 'local';
18
- /** エラー発生時のコールバック */
19
- onError?: (error: Error) => void;
20
- }
21
- export interface LiveControlPanelProps {
22
- id: string;
23
- width: number;
24
- screenHeight: number;
25
- playing: boolean;
26
- volume: number;
27
- isBuffering: boolean;
28
- currentUrl: string;
29
- onPlayPause: () => void;
30
- onStop: () => void;
31
- onVolumeChange: (volume: number) => void;
32
- onUrlChange: (url: string) => void;
33
- }
34
- export interface PlayPauseButtonProps {
35
- id: string;
36
- position: [number, number, number];
37
- size: number;
5
+ /** 再生中かどうか */
38
6
  playing: boolean;
39
- onInteract: () => void;
40
- }
41
- export interface VolumeControlProps {
42
- id: string;
43
- position: [number, number, number];
44
- size: number;
45
- volume: number;
46
- onVolumeChange: (volume: number) => void;
47
- }
48
- export interface LiveIndicatorProps {
49
- position: [number, number, number];
50
- size: number;
51
- playing: boolean;
52
- }
53
- export interface LoadingSpinnerProps {
54
- position: [number, number, number];
55
- size: number;
56
- }
57
- export interface UrlInputButtonProps {
58
- id: string;
59
- position: [number, number, number];
60
- size: number;
61
- currentUrl: string;
62
- onUrlChange: (url: string) => void;
63
- }
64
- export interface StopButtonProps {
65
- id: string;
66
- position: [number, number, number];
67
- size: number;
68
- onInteract: () => void;
7
+ /** キャッシュバスター用キー */
8
+ reloadKey: number;
69
9
  }
70
10
  //# sourceMappingURL=types.d.ts.map