@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.
- package/dist/components/LiveVideoPlayer/components/ControlPanel/LiveIndicator.d.ts +8 -0
- package/dist/components/LiveVideoPlayer/components/ControlPanel/LiveIndicator.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/{LiveIndicator.js → components/ControlPanel/LiveIndicator.js} +5 -5
- package/dist/components/LiveVideoPlayer/components/ControlPanel/LiveIndicator.js.map +1 -0
- package/dist/components/LiveVideoPlayer/components/ControlPanel/index.d.ts +16 -0
- package/dist/components/LiveVideoPlayer/components/ControlPanel/index.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/components/ControlPanel/index.js +28 -0
- package/dist/components/LiveVideoPlayer/components/ControlPanel/index.js.map +1 -0
- package/dist/components/LiveVideoPlayer/components/LiveVideoTexture.d.ts +14 -0
- package/dist/components/LiveVideoPlayer/components/LiveVideoTexture.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/components/LiveVideoTexture.js +18 -0
- package/dist/components/LiveVideoPlayer/components/LiveVideoTexture.js.map +1 -0
- package/dist/components/LiveVideoPlayer/components/index.d.ts +3 -0
- package/dist/components/LiveVideoPlayer/components/index.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/components/index.js +3 -0
- package/dist/components/LiveVideoPlayer/components/index.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/__tests__/utils.test.d.ts +2 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/__tests__/utils.test.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/__tests__/utils.test.js +196 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/__tests__/utils.test.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/HlsJsPlayer.d.ts +17 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/HlsJsPlayer.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/HlsJsPlayer.js +73 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/HlsJsPlayer.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/NativeHlsPlayer.d.ts +14 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/NativeHlsPlayer.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/NativeHlsPlayer.js +46 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/NativeHlsPlayer.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/RecoveryTracker.d.ts +21 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/RecoveryTracker.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/RecoveryTracker.js +54 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/RecoveryTracker.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/HlsJsPlayer.test.d.ts +2 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/HlsJsPlayer.test.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/HlsJsPlayer.test.js +146 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/HlsJsPlayer.test.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/NativeHlsPlayer.test.d.ts +2 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/NativeHlsPlayer.test.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/NativeHlsPlayer.test.js +94 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/NativeHlsPlayer.test.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/RecoveryTracker.test.d.ts +2 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/RecoveryTracker.test.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/RecoveryTracker.test.js +74 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/classes/__tests__/RecoveryTracker.test.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/index.d.ts +31 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/index.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/index.js +108 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/index.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/types.d.ts +34 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/types.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/types.js +2 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/types.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/utils.d.ts +15 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/utils.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/utils.js +62 -0
- package/dist/components/LiveVideoPlayer/hooks/useHlsVideo/utils.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.d.ts +25 -0
- package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.js +97 -0
- package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer/index.js.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.d.ts +25 -0
- package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.d.ts.map +1 -0
- package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.js +97 -0
- package/dist/components/LiveVideoPlayer/hooks/useLiveVideoPlayer.js.map +1 -0
- package/dist/components/LiveVideoPlayer/index.d.ts +20 -3
- package/dist/components/LiveVideoPlayer/index.d.ts.map +1 -1
- package/dist/components/LiveVideoPlayer/index.js +16 -133
- package/dist/components/LiveVideoPlayer/index.js.map +1 -1
- package/dist/components/LiveVideoPlayer/types.d.ts +6 -66
- package/dist/components/LiveVideoPlayer/types.d.ts.map +1 -1
- package/dist/components/Video180Sphere/EyeView.d.ts +14 -0
- package/dist/components/Video180Sphere/EyeView.d.ts.map +1 -0
- package/dist/components/Video180Sphere/EyeView.js +77 -0
- package/dist/components/Video180Sphere/EyeView.js.map +1 -0
- package/dist/components/Video180Sphere/index.d.ts +19 -0
- package/dist/components/Video180Sphere/index.d.ts.map +1 -0
- package/dist/components/Video180Sphere/index.js +90 -0
- package/dist/components/Video180Sphere/index.js.map +1 -0
- package/dist/components/Video180Sphere/types.d.ts +35 -0
- package/dist/components/Video180Sphere/types.d.ts.map +1 -0
- package/dist/components/Video180Sphere/types.js +2 -0
- package/dist/components/Video180Sphere/types.js.map +1 -0
- package/dist/components/VideoPlayer/ControlPanel.d.ts +1 -1
- package/dist/components/VideoPlayer/ControlPanel.d.ts.map +1 -1
- package/dist/components/VideoPlayer/ControlPanel.js +20 -9
- package/dist/components/VideoPlayer/ControlPanel.js.map +1 -1
- package/dist/components/VideoPlayer/ProgressBar.d.ts.map +1 -1
- package/dist/components/VideoPlayer/ProgressBar.js +2 -1
- package/dist/components/VideoPlayer/ProgressBar.js.map +1 -1
- package/dist/components/VideoPlayer/__tests__/utils.test.d.ts +2 -0
- package/dist/components/VideoPlayer/__tests__/utils.test.d.ts.map +1 -0
- package/dist/components/VideoPlayer/__tests__/utils.test.js +23 -0
- package/dist/components/VideoPlayer/__tests__/utils.test.js.map +1 -0
- package/dist/components/VideoPlayer/components/ControlPanel.d.ts +18 -0
- package/dist/components/VideoPlayer/components/ControlPanel.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/ControlPanel.js +34 -0
- package/dist/components/VideoPlayer/components/ControlPanel.js.map +1 -0
- package/dist/components/VideoPlayer/components/ProgressBar.d.ts +12 -0
- package/dist/components/VideoPlayer/components/ProgressBar.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/ProgressBar.js +21 -0
- package/dist/components/VideoPlayer/components/ProgressBar.js.map +1 -0
- package/dist/components/VideoPlayer/components/index.d.ts +3 -0
- package/dist/components/VideoPlayer/components/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/index.js +3 -0
- package/dist/components/VideoPlayer/components/index.js.map +1 -0
- package/dist/components/VideoPlayer/index.d.ts +20 -3
- package/dist/components/VideoPlayer/index.d.ts.map +1 -1
- package/dist/components/VideoPlayer/index.js +29 -89
- package/dist/components/VideoPlayer/index.js.map +1 -1
- package/dist/components/VideoPlayer/types.d.ts +1 -28
- package/dist/components/VideoPlayer/types.d.ts.map +1 -1
- package/dist/components/VideoPlayer/utils.d.ts +0 -27
- package/dist/components/VideoPlayer/utils.d.ts.map +1 -1
- package/dist/components/VideoPlayer/utils.js +0 -28
- package/dist/components/VideoPlayer/utils.js.map +1 -1
- package/dist/components/VideoPlayer/utils.test.js +1 -87
- package/dist/components/VideoPlayer/utils.test.js.map +1 -1
- package/dist/components/commons/ErrorBoundary/index.d.ts +18 -0
- package/dist/components/commons/ErrorBoundary/index.d.ts.map +1 -0
- package/dist/components/commons/ErrorBoundary/index.js +22 -0
- package/dist/components/commons/ErrorBoundary/index.js.map +1 -0
- package/dist/components/commons/IconButton/index.d.ts +23 -0
- package/dist/components/commons/IconButton/index.d.ts.map +1 -0
- package/dist/components/commons/IconButton/index.js +12 -0
- package/dist/components/commons/IconButton/index.js.map +1 -0
- package/dist/components/commons/PlaceholderScreen/index.d.ts +9 -0
- package/dist/components/commons/PlaceholderScreen/index.d.ts.map +1 -0
- package/dist/components/commons/PlaceholderScreen/index.js +6 -0
- package/dist/components/commons/PlaceholderScreen/index.js.map +1 -0
- package/dist/components/commons/VideoMesh/index.d.ts +14 -0
- package/dist/components/commons/VideoMesh/index.d.ts.map +1 -0
- package/dist/components/commons/VideoMesh/index.js +91 -0
- package/dist/components/commons/VideoMesh/index.js.map +1 -0
- package/dist/components/commons/VolumeControl/index.d.ts +9 -0
- package/dist/components/commons/VolumeControl/index.d.ts.map +1 -0
- package/dist/components/{LiveVideoPlayer/VolumeControl.js → commons/VolumeControl/index.js} +6 -3
- package/dist/components/commons/VolumeControl/index.js.map +1 -0
- package/dist/components/commons/utils.d.ts +24 -0
- package/dist/components/commons/utils.d.ts.map +1 -0
- package/dist/components/commons/utils.js +23 -0
- package/dist/components/commons/utils.js.map +1 -0
- package/dist/components/commons/utils.test.d.ts +2 -0
- package/dist/components/commons/utils.test.d.ts.map +1 -0
- package/dist/components/commons/utils.test.js +79 -0
- package/dist/components/commons/utils.test.js.map +1 -0
- package/dist/hooks/useSyncState.d.ts +8 -0
- package/dist/hooks/useSyncState.d.ts.map +1 -0
- package/dist/hooks/useSyncState.js +16 -0
- package/dist/hooks/useSyncState.js.map +1 -0
- package/dist/hooks/useVideoElement.d.ts +30 -0
- package/dist/hooks/useVideoElement.d.ts.map +1 -0
- package/dist/hooks/useVideoElement.js +182 -0
- package/dist/hooks/useVideoElement.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/components/LiveVideoPlayer/ControlPanel.d.ts +0 -3
- package/dist/components/LiveVideoPlayer/ControlPanel.d.ts.map +0 -1
- package/dist/components/LiveVideoPlayer/ControlPanel.js +0 -17
- package/dist/components/LiveVideoPlayer/ControlPanel.js.map +0 -1
- package/dist/components/LiveVideoPlayer/LiveIndicator.d.ts +0 -3
- package/dist/components/LiveVideoPlayer/LiveIndicator.d.ts.map +0 -1
- package/dist/components/LiveVideoPlayer/LiveIndicator.js.map +0 -1
- package/dist/components/LiveVideoPlayer/PlayPauseButton.d.ts +0 -3
- package/dist/components/LiveVideoPlayer/PlayPauseButton.d.ts.map +0 -1
- package/dist/components/LiveVideoPlayer/PlayPauseButton.js +0 -9
- package/dist/components/LiveVideoPlayer/PlayPauseButton.js.map +0 -1
- package/dist/components/LiveVideoPlayer/ReloadButton.d.ts +0 -3
- package/dist/components/LiveVideoPlayer/ReloadButton.d.ts.map +0 -1
- package/dist/components/LiveVideoPlayer/ReloadButton.js +0 -9
- package/dist/components/LiveVideoPlayer/ReloadButton.js.map +0 -1
- package/dist/components/LiveVideoPlayer/UrlInputButton.d.ts +0 -3
- package/dist/components/LiveVideoPlayer/UrlInputButton.d.ts.map +0 -1
- package/dist/components/LiveVideoPlayer/UrlInputButton.js +0 -23
- package/dist/components/LiveVideoPlayer/UrlInputButton.js.map +0 -1
- package/dist/components/LiveVideoPlayer/VolumeControl.d.ts +0 -3
- package/dist/components/LiveVideoPlayer/VolumeControl.d.ts.map +0 -1
- package/dist/components/LiveVideoPlayer/VolumeControl.js.map +0 -1
- package/dist/components/VideoPlayer/PlayPauseButton.d.ts +0 -3
- package/dist/components/VideoPlayer/PlayPauseButton.d.ts.map +0 -1
- package/dist/components/VideoPlayer/PlayPauseButton.js +0 -9
- package/dist/components/VideoPlayer/PlayPauseButton.js.map +0 -1
- package/dist/components/VideoPlayer/StopButton.d.ts +0 -3
- package/dist/components/VideoPlayer/StopButton.d.ts.map +0 -1
- package/dist/components/VideoPlayer/StopButton.js +0 -9
- package/dist/components/VideoPlayer/StopButton.js.map +0 -1
- package/dist/components/VideoPlayer/UrlInputButton.d.ts +0 -3
- package/dist/components/VideoPlayer/UrlInputButton.d.ts.map +0 -1
- package/dist/components/VideoPlayer/UrlInputButton.js +0 -23
- package/dist/components/VideoPlayer/UrlInputButton.js.map +0 -1
- package/dist/components/VideoPlayer/VolumeControl.d.ts +0 -3
- package/dist/components/VideoPlayer/VolumeControl.d.ts.map +0 -1
- package/dist/components/VideoPlayer/VolumeControl.js +0 -26
- 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;IACjD,MAAM,KAAK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,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,MAAM,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAiB,MAAM,gCAAgC,CAAC;AAG7E,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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,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;AAC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C;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"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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":"
|
|
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,
|
|
2
|
-
import { memo, Suspense
|
|
3
|
-
import {
|
|
4
|
-
import { ControlPanel } from "./ControlPanel";
|
|
5
|
-
import {
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LiveVideoPlayer/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAqBhE,MAAM,gBAAgB,GAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9D,MAAM,gBAAgB,GAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7D,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CACjC,CAAC,EACC,EAAE,EACF,QAAQ,GAAG,gBAAgB,EAC3B,QAAQ,GAAG,gBAAgB,EAC3B,KAAK,GAAG,aAAa,EACrB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,cAAc,GAAG,KAAK,EAC/B,MAAM,EAAE,aAAa,GAAG,CAAC,EACzB,IAAI,GAAG,QAAQ,GACT,EAAE,EAAE;IACV,MAAM,EACJ,UAAU,EACV,MAAM,EACN,WAAW,EACX,UAAU,EACV,QAAQ,GACT,GAAG,kBAAkB,CAAC;QACrB,EAAE;QACF,UAAU;QACV,cA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AE,QAAQ,CAAC,iBAAiB,GAC7C,GACO,IA7BN,kBAAkB,UAAU,CAAC,GAAG,IAAI,UAAU,CAAC,SAAS,EAAE,CA8BjD,CACjB,EAGA,UAAU,IAAI,CACb,KAAC,IAAI,IACH,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EACtB,QAAQ,EAAE,KAAK,GAAG,IAAI,EACtB,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAC,QAAQ,EAChB,SAAS,EAAC,QAAQ,4CAGb,CACR,EAGD,KAAC,YAAY,IACX,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,UAAU,CAAC,OAAO,EAC3B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,EAAE,EACzB,WAAW,EAAE,QAAQ,CAAC,WAAW,EACjC,MAAM,EAAE,QAAQ,CAAC,MAAM,EACvB,cAAc,EAAE,QAAQ,CAAC,cAAc,EACvC,WAAW,EAAE,QAAQ,CAAC,WAAW,GACjC,IACI,CACT,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC"}
|
|
@@ -1,70 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
/**
|
|
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
|
-
|
|
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
|