@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/LiveVideoPlayer/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/LiveVideoPlayer/types.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,WAAW,cAAc;IAC7B,cAAc;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,cAAc;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,mBAAmB;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface EyeViewProps {
|
|
2
|
+
video: HTMLVideoElement;
|
|
3
|
+
eye: 'left' | 'right';
|
|
4
|
+
radius: number;
|
|
5
|
+
segments: number;
|
|
6
|
+
placeholderColor: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 各目用のビューを表示する内部コンポーネント
|
|
10
|
+
* Three.jsのlayersを使用してVR時に左右の目に適切な映像を表示
|
|
11
|
+
*/
|
|
12
|
+
export declare const EyeView: ({ video, eye, radius, segments, placeholderColor }: EyeViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=EyeView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EyeView.d.ts","sourceRoot":"","sources":["../../../src/components/Video180Sphere/EyeView.tsx"],"names":[],"mappings":"AAGA,UAAU,YAAY;IACpB,KAAK,EAAE,gBAAgB,CAAA;IACvB,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,oDAAoD,YAAY,4CAiFvF,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { BackSide, Color, SRGBColorSpace, VideoTexture } from 'three';
|
|
4
|
+
/**
|
|
5
|
+
* 各目用のビューを表示する内部コンポーネント
|
|
6
|
+
* Three.jsのlayersを使用してVR時に左右の目に適切な映像を表示
|
|
7
|
+
*/
|
|
8
|
+
export const EyeView = ({ video, eye, radius, segments, placeholderColor }) => {
|
|
9
|
+
const eyeIndex = eye === 'left' ? 0 : 1;
|
|
10
|
+
const meshRef = useRef(null);
|
|
11
|
+
const texture = useMemo(() => {
|
|
12
|
+
const tex = new VideoTexture(video);
|
|
13
|
+
tex.colorSpace = SRGBColorSpace;
|
|
14
|
+
return tex;
|
|
15
|
+
}, [video]);
|
|
16
|
+
const placeholderColorVec = useMemo(() => {
|
|
17
|
+
const color = new Color(placeholderColor);
|
|
18
|
+
return [color.r, color.g, color.b];
|
|
19
|
+
}, [placeholderColor]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!meshRef.current)
|
|
22
|
+
return;
|
|
23
|
+
// layer 0 = 通常カメラ(非VR), layer 1 = 左目, layer 2 = 右目
|
|
24
|
+
// 左目のメッシュはlayer 0と1に、右目はlayer 2のみ
|
|
25
|
+
// これにより非VRモードでは左目の映像が見える
|
|
26
|
+
if (eye === 'left') {
|
|
27
|
+
meshRef.current.layers.enable(0);
|
|
28
|
+
meshRef.current.layers.enable(1);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
meshRef.current.layers.set(2);
|
|
32
|
+
}
|
|
33
|
+
}, [eye]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
return () => {
|
|
36
|
+
texture.dispose();
|
|
37
|
+
};
|
|
38
|
+
}, [texture]);
|
|
39
|
+
// X軸のスケールを反転させて正しい向きのテクスチャを表示
|
|
40
|
+
// rotation=[0, Math.PI, 0]で180度回転し、前方を向くように調整
|
|
41
|
+
return (_jsxs("mesh", { rotation: [0, Math.PI, 0], scale: [-1, 1, 1], ref: meshRef, children: [_jsx("sphereGeometry", { args: [radius, segments, segments, 0, Math.PI] }), _jsx("shaderMaterial", { uniforms: {
|
|
42
|
+
map: { value: texture },
|
|
43
|
+
eyeIndex: { value: eyeIndex },
|
|
44
|
+
placeholderColor: { value: placeholderColorVec },
|
|
45
|
+
}, side: BackSide, vertexShader: `
|
|
46
|
+
varying vec2 vUv;
|
|
47
|
+
void main() {
|
|
48
|
+
vUv = uv;
|
|
49
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
50
|
+
}
|
|
51
|
+
`, fragmentShader: `
|
|
52
|
+
uniform sampler2D map;
|
|
53
|
+
uniform int eyeIndex;
|
|
54
|
+
uniform vec3 placeholderColor;
|
|
55
|
+
varying vec2 vUv;
|
|
56
|
+
void main() {
|
|
57
|
+
vec2 uv = vUv;
|
|
58
|
+
// Side-by-Side形式のステレオ動画: 左半分が左目、右半分が右目
|
|
59
|
+
if (eyeIndex == 0) {
|
|
60
|
+
// 左目: テクスチャの左半分を使用
|
|
61
|
+
uv.x = uv.x * 0.5;
|
|
62
|
+
} else {
|
|
63
|
+
// 右目: テクスチャの右半分を使用
|
|
64
|
+
uv.x = uv.x * 0.5 + 0.5;
|
|
65
|
+
}
|
|
66
|
+
vec4 texColor = texture2D(map, uv);
|
|
67
|
+
// 動画未読み込み時(黒い画面)はプレースホルダー色を表示
|
|
68
|
+
float luminance = dot(texColor.rgb, vec3(0.299, 0.587, 0.114));
|
|
69
|
+
if (luminance < 0.01) {
|
|
70
|
+
gl_FragColor = vec4(placeholderColor, 1.0);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
gl_FragColor = texColor;
|
|
74
|
+
}
|
|
75
|
+
` })] }));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from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 180度ステレオスコピック動画を半球に表示するコンポーネント
|
|
5
|
+
*
|
|
6
|
+
* Side-by-Side形式のステレオ動画に対応。
|
|
7
|
+
* VRモードでは左目と右目に適切な映像を表示する。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Video180Sphere
|
|
12
|
+
* url="/videos/sample-180-3d.mp4"
|
|
13
|
+
* playing={true}
|
|
14
|
+
* volume={0.8}
|
|
15
|
+
* />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const Video180Sphere: import("react").MemoExoticComponent<({ url, position, rotation, scale, playing, muted, volume, radius, segments, loop, placeholderColor, onEnded, onLoadedMetadata, onProgress, }: Video180SphereProps) => import("react/jsx-runtime").JSX.Element>;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Video180Sphere/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAKlD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,qLAgBtB,mBAAmB,6CAkFvB,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, memo } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import { EyeView } from './EyeView';
|
|
5
|
+
import { useWebAudioVolume } from '../../hooks/useWebAudioVolume';
|
|
6
|
+
const DEFAULT_RADIUS = 5;
|
|
7
|
+
const DEFAULT_SEGMENTS = 64;
|
|
8
|
+
/**
|
|
9
|
+
* 180度ステレオスコピック動画を半球に表示するコンポーネント
|
|
10
|
+
*
|
|
11
|
+
* Side-by-Side形式のステレオ動画に対応。
|
|
12
|
+
* VRモードでは左目と右目に適切な映像を表示する。
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Video180Sphere
|
|
17
|
+
* url="/videos/sample-180-3d.mp4"
|
|
18
|
+
* playing={true}
|
|
19
|
+
* volume={0.8}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export const Video180Sphere = memo(({ url, position, rotation, scale, playing = false, muted = false, volume = 1, radius = DEFAULT_RADIUS, segments = DEFAULT_SEGMENTS, loop = false, placeholderColor = '#000000', onEnded, onLoadedMetadata, onProgress, }) => {
|
|
24
|
+
const videoRef = useRef(null);
|
|
25
|
+
const video = useMemo(() => {
|
|
26
|
+
const vid = document.createElement('video');
|
|
27
|
+
vid.src = url;
|
|
28
|
+
vid.currentTime = 0;
|
|
29
|
+
vid.loop = loop;
|
|
30
|
+
vid.muted = muted;
|
|
31
|
+
vid.crossOrigin = 'anonymous';
|
|
32
|
+
vid.playsInline = true;
|
|
33
|
+
return vid;
|
|
34
|
+
}, [url, loop, muted]);
|
|
35
|
+
// videoRefを更新
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
videoRef.current = video;
|
|
38
|
+
}, [video]);
|
|
39
|
+
// イベントハンドラの設定
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const handleEnded = () => {
|
|
42
|
+
onEnded?.();
|
|
43
|
+
};
|
|
44
|
+
const handleLoadedMetadata = () => {
|
|
45
|
+
onLoadedMetadata?.({ duration: video.duration });
|
|
46
|
+
};
|
|
47
|
+
const handleTimeUpdate = () => {
|
|
48
|
+
onProgress?.({ currentTime: video.currentTime });
|
|
49
|
+
};
|
|
50
|
+
video.addEventListener('ended', handleEnded);
|
|
51
|
+
video.addEventListener('loadedmetadata', handleLoadedMetadata);
|
|
52
|
+
video.addEventListener('timeupdate', handleTimeUpdate);
|
|
53
|
+
return () => {
|
|
54
|
+
video.removeEventListener('ended', handleEnded);
|
|
55
|
+
video.removeEventListener('loadedmetadata', handleLoadedMetadata);
|
|
56
|
+
video.removeEventListener('timeupdate', handleTimeUpdate);
|
|
57
|
+
};
|
|
58
|
+
}, [video, onEnded, onLoadedMetadata, onProgress]);
|
|
59
|
+
// 再生/停止の制御
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (playing) {
|
|
62
|
+
video.play().catch((err) => {
|
|
63
|
+
console.error('Video play error:', err);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
video.pause();
|
|
68
|
+
}
|
|
69
|
+
}, [video, playing]);
|
|
70
|
+
// Web Audio API を使用した音量制御(iOS対応)
|
|
71
|
+
useWebAudioVolume(videoRef.current, volume);
|
|
72
|
+
// クリーンアップ
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
return () => {
|
|
75
|
+
video.pause();
|
|
76
|
+
video.src = '';
|
|
77
|
+
video.removeAttribute('src');
|
|
78
|
+
video.srcObject = null;
|
|
79
|
+
video.load();
|
|
80
|
+
};
|
|
81
|
+
}, [video]);
|
|
82
|
+
// カメラのlayers設定(@react-three/xrのバグ対策)
|
|
83
|
+
// https://github.com/pmndrs/xr/issues/398
|
|
84
|
+
useFrame(({ camera }) => {
|
|
85
|
+
camera.layers.set(0);
|
|
86
|
+
});
|
|
87
|
+
return (_jsxs("group", { position: position, rotation: rotation, scale: scale, children: [_jsx(EyeView, { video: video, eye: "left", radius: radius, segments: segments, placeholderColor: placeholderColor }), _jsx(EyeView, { video: video, eye: "right", radius: radius, segments: segments, placeholderColor: placeholderColor })] }));
|
|
88
|
+
});
|
|
89
|
+
Video180Sphere.displayName = 'Video180Sphere';
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Video180Sphere/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SA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|
|
2
|
+
/** 動画のURL */
|
|
3
|
+
url: string;
|
|
4
|
+
/** 位置 */
|
|
5
|
+
position?: [number, number, number];
|
|
6
|
+
/** 回転 */
|
|
7
|
+
rotation?: [number, number, number];
|
|
8
|
+
/** スケール */
|
|
9
|
+
scale?: number | [number, number, number];
|
|
10
|
+
/** 再生状態 */
|
|
11
|
+
playing?: boolean;
|
|
12
|
+
/** ミュート状態(trueにするとブラウザの自動再生制限を回避できる) */
|
|
13
|
+
muted?: boolean;
|
|
14
|
+
/** 音量 (0-1) */
|
|
15
|
+
volume?: number;
|
|
16
|
+
/** 半球の半径 */
|
|
17
|
+
radius?: number;
|
|
18
|
+
/** ジオメトリの解像度(セグメント数) */
|
|
19
|
+
segments?: number;
|
|
20
|
+
/** ループ再生するか */
|
|
21
|
+
loop?: boolean;
|
|
22
|
+
/** プレースホルダーの色(動画読み込み前に表示、デフォルト: 黒) */
|
|
23
|
+
placeholderColor?: string;
|
|
24
|
+
/** 動画終了時のコールバック */
|
|
25
|
+
onEnded?: () => void;
|
|
26
|
+
/** メタデータ読み込み時のコールバック */
|
|
27
|
+
onLoadedMetadata?: (event: {
|
|
28
|
+
duration: number;
|
|
29
|
+
}) => void;
|
|
30
|
+
/** 再生進捗更新時のコールバック */
|
|
31
|
+
onProgress?: (event: {
|
|
32
|
+
currentTime: number;
|
|
33
|
+
}) => void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Video180Sphere/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,aAAa;IACb,GAAG,EAAE,MAAM,CAAA;IACX,SAAS;IACT,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACnC,SAAS;IACT,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACnC,WAAW;IACX,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,WAAW;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,wCAAwC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,eAAe;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,sCAAsC;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,wBAAwB;IACxB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACxD,qBAAqB;IACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Video180Sphere/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ControlPanelProps } from './types';
|
|
2
|
-
export declare const ControlPanel: import("react").MemoExoticComponent<({ id, width, screenHeight, playing, progress, duration, volume,
|
|
2
|
+
export declare const ControlPanel: import("react").MemoExoticComponent<({ id, width, screenHeight, playing, progress, duration, volume, url, onPlayPause, onStop, onSeek, onVolumeChange, onUrlChange, }: ControlPanelProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
//# sourceMappingURL=ControlPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ControlPanel.d.ts","sourceRoot":"","sources":["../../../src/components/VideoPlayer/ControlPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ControlPanel.d.ts","sourceRoot":"","sources":["../../../src/components/VideoPlayer/ControlPanel.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAOhD,eAAO,MAAM,YAAY,yKAepB,iBAAiB,6CA6FrB,CAAA"}
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import { memo, useCallback } from 'react';
|
|
3
3
|
import { Text } from '@react-three/drei';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { IconButton } from '../commons/IconButton';
|
|
5
|
+
import { VolumeControl } from '../commons/VolumeControl';
|
|
6
6
|
import { ProgressBar } from './ProgressBar';
|
|
7
|
-
import { VolumeControl } from './VolumeControl';
|
|
8
|
-
import { UrlInputButton } from './UrlInputButton';
|
|
9
7
|
import { formatTime } from './utils';
|
|
8
|
+
import { useTextInputContext } from '../../contexts/TextInputContext';
|
|
10
9
|
const PANEL_HEIGHT = 0.15;
|
|
11
|
-
const
|
|
10
|
+
const BUTTON_SIZE = PANEL_HEIGHT * 0.6;
|
|
12
11
|
const PROGRESS_BAR_WIDTH_RATIO = 0.5;
|
|
13
12
|
const PROGRESS_BAR_HEIGHT = 0.02;
|
|
14
|
-
export const ControlPanel = memo(({ id, width, screenHeight, playing, progress, duration, volume,
|
|
13
|
+
export const ControlPanel = memo(({ id, width, screenHeight, playing, progress, duration, volume, url, onPlayPause, onStop, onSeek, onVolumeChange, onUrlChange, }) => {
|
|
15
14
|
const panelY = -screenHeight / 2 - PANEL_HEIGHT / 2;
|
|
16
|
-
const buttonSize = PANEL_HEIGHT * BUTTON_SIZE_RATIO;
|
|
17
15
|
const progressBarWidth = width * PROGRESS_BAR_WIDTH_RATIO;
|
|
18
16
|
const currentTime = progress * duration;
|
|
19
17
|
const timeText = `${formatTime(currentTime)} / ${formatTime(duration)}`;
|
|
20
|
-
|
|
18
|
+
const { requestTextInput } = useTextInputContext();
|
|
19
|
+
const handleUrlInput = useCallback(() => {
|
|
20
|
+
requestTextInput({
|
|
21
|
+
id: `${id}-url-input`,
|
|
22
|
+
placeholder: '動画のURLを入力',
|
|
23
|
+
initialValue: url,
|
|
24
|
+
onSubmit: (value) => {
|
|
25
|
+
if (value && value.trim() !== '') {
|
|
26
|
+
onUrlChange(value.trim());
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}, [id, url, onUrlChange, requestTextInput]);
|
|
31
|
+
return (_jsxs("group", { position: [0, panelY, 0], children: [_jsxs("mesh", { position: [0, 0, 0], children: [_jsx("planeGeometry", { args: [width, PANEL_HEIGHT] }), _jsx("meshBasicMaterial", { color: "#1a1a2a", transparent: true, opacity: 0.9 })] }), _jsx(IconButton, { id: `${id}-url-input`, position: [-width * 0.45, 0, 0.01], size: BUTTON_SIZE, icon: "\uD83D\uDD17", interactionText: "URL\u5909\u66F4", onInteract: handleUrlInput }), _jsx(IconButton, { id: `${id}-play-pause`, position: [-width * 0.38, 0, 0.01], size: BUTTON_SIZE, icon: playing ? "||" : "▶", interactionText: playing ? "一時停止" : "再生", onInteract: onPlayPause }), _jsx(IconButton, { id: `${id}-stop`, position: [-width * 0.31, 0, 0.01], size: BUTTON_SIZE, icon: "\u25A0", interactionText: "\u505C\u6B62", onInteract: onStop }), _jsx(ProgressBar, { id: `${id}-progress`, position: [0, 0.01, 0.01], width: progressBarWidth, height: PROGRESS_BAR_HEIGHT, progress: progress, duration: duration, onSeek: onSeek }), _jsx(Text, { position: [0, -0.035, 0.01], fontSize: 0.025, color: "#aaaaaa", anchorX: "center", anchorY: "middle", children: timeText }), _jsx(VolumeControl, { id: `${id}-volume`, position: [width * 0.4, 0, 0.01], size: BUTTON_SIZE, volume: volume, onVolumeChange: onVolumeChange })] }));
|
|
21
32
|
});
|
|
22
33
|
ControlPanel.displayName = 'ControlPanel';
|
|
23
34
|
//# sourceMappingURL=ControlPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ControlPanel.js","sourceRoot":"","sources":["../../../src/components/VideoPlayer/ControlPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ControlPanel.js","sourceRoot":"","sources":["../../../src/components/VideoPlayer/ControlPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAGrE,MAAM,YAAY,GAAG,IAAI,CAAA;AACzB,MAAM,WAAW,GAAG,YAAY,GAAG,GAAG,CAAA;AACtC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AACpC,MAAM,mBAAmB,GAAG,IAAI,CAAA;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAC9B,CAAC,EACC,EAAE,EACF,KAAK,EACL,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,GAAG,EACH,WAAW,EACX,MAAM,EACN,MAAM,EACN,cAAc,EACd,WAAW,GACO,EAAE,EAAE;IACtB,MAAM,MAAM,GAAG,CAAC,YAAY,GAAG,CAAC,GAAG,YAAY,GAAG,CAAC,CAAA;IACnD,MAAM,gBAAgB,GAAG,KAAK,GAAG,wBAAwB,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,YAAY,CAAC,WAAW,GAAG,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../src/components/VideoPlayer/ProgressBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../src/components/VideoPlayer/ProgressBar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAI/C,eAAO,MAAM,WAAW,qGASnB,gBAAgB,6CA8CpB,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
3
|
import { Interactable } from '../Interactable';
|
|
4
|
-
import {
|
|
4
|
+
import { calculateSegments, calculateProgressBar } from '../commons/utils';
|
|
5
|
+
import { formatTime } from './utils';
|
|
5
6
|
const SEGMENTS = 20;
|
|
6
7
|
export const ProgressBar = memo(({ id, position, width, height, progress, duration, onSeek, }) => {
|
|
7
8
|
const { width: progressWidth, offset: progressOffset } = calculateProgressBar(progress, width);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../../src/components/VideoPlayer/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../../src/components/VideoPlayer/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,iBAAiB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G,IAChC,CACR,EAGA,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACzB,KAAC,YAAY,IAEX,EAAE,EAAE,GAAG,EAAE,QAAQ,OAAO,CAAC,KAAK,EAAE,EAChC,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EACvC,eAAe,EAAE,OAAO,CAAC,KAAK,YAE9B,gBAAM,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,aACtC,wBAAe,IAAI,EAAE,CAAC,YAAY,GAAG,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,GAAI,EAC1D,4BAAmB,WAAW,QAAC,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,KAAK,GAAI,IAC3D,IARF,OAAO,CAAC,KAAK,CASL,CAChB,CAAC,IACI,CACT,CAAA;AACH,CAAC,CACF,CAAA;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoPlayer/__tests__/utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { formatTime } from '../utils';
|
|
3
|
+
describe('formatTime', () => {
|
|
4
|
+
it('0秒を0:00にフォーマット', () => {
|
|
5
|
+
expect(formatTime(0)).toBe('0:00');
|
|
6
|
+
});
|
|
7
|
+
it('59秒を0:59にフォーマット', () => {
|
|
8
|
+
expect(formatTime(59)).toBe('0:59');
|
|
9
|
+
});
|
|
10
|
+
it('60秒を1:00にフォーマット', () => {
|
|
11
|
+
expect(formatTime(60)).toBe('1:00');
|
|
12
|
+
});
|
|
13
|
+
it('90秒を1:30にフォーマット', () => {
|
|
14
|
+
expect(formatTime(90)).toBe('1:30');
|
|
15
|
+
});
|
|
16
|
+
it('3661秒を61:01にフォーマット', () => {
|
|
17
|
+
expect(formatTime(3661)).toBe('61:01');
|
|
18
|
+
});
|
|
19
|
+
it('小数点以下を切り捨て', () => {
|
|
20
|
+
expect(formatTime(65.9)).toBe('1:05');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../../../../src/components/VideoPlayer/__tests__/utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;QACxB,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC5B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;QACpB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
id: string;
|
|
3
|
+
width: number;
|
|
4
|
+
screenHeight: number;
|
|
5
|
+
playing: boolean;
|
|
6
|
+
progress: number;
|
|
7
|
+
duration: number;
|
|
8
|
+
volume: number;
|
|
9
|
+
url: string;
|
|
10
|
+
onPlayPause: () => void;
|
|
11
|
+
onStop: () => void;
|
|
12
|
+
onSeek: (time: number) => void;
|
|
13
|
+
onVolumeChange: (volume: number) => void;
|
|
14
|
+
onUrlChange: (url: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const ControlPanel: import("react").MemoExoticComponent<({ id, width, screenHeight, playing, progress, duration, volume, url, onPlayPause, onStop, onSeek, onVolumeChange, onUrlChange, }: Props) => import("react/jsx-runtime").JSX.Element>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=ControlPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControlPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoPlayer/components/ControlPanel.tsx"],"names":[],"mappings":"AAQA,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC;AAOD,eAAO,MAAM,YAAY,yKAepB,KAAK,6CA6FT,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback } from 'react';
|
|
3
|
+
import { Text } from '@react-three/drei';
|
|
4
|
+
import { IconButton } from '../../commons/IconButton';
|
|
5
|
+
import { VolumeControl } from '../../commons/VolumeControl';
|
|
6
|
+
import { ProgressBar } from './ProgressBar';
|
|
7
|
+
import { formatTime } from '../utils';
|
|
8
|
+
import { useTextInputContext } from '../../../contexts/TextInputContext';
|
|
9
|
+
const PANEL_HEIGHT = 0.15;
|
|
10
|
+
const BUTTON_SIZE = PANEL_HEIGHT * 0.6;
|
|
11
|
+
const PROGRESS_BAR_WIDTH_RATIO = 0.5;
|
|
12
|
+
const PROGRESS_BAR_HEIGHT = 0.02;
|
|
13
|
+
export const ControlPanel = memo(({ id, width, screenHeight, playing, progress, duration, volume, url, onPlayPause, onStop, onSeek, onVolumeChange, onUrlChange, }) => {
|
|
14
|
+
const panelY = -screenHeight / 2 - PANEL_HEIGHT / 2;
|
|
15
|
+
const progressBarWidth = width * PROGRESS_BAR_WIDTH_RATIO;
|
|
16
|
+
const currentTime = progress * duration;
|
|
17
|
+
const timeText = `${formatTime(currentTime)} / ${formatTime(duration)}`;
|
|
18
|
+
const { requestTextInput } = useTextInputContext();
|
|
19
|
+
const handleUrlInput = useCallback(() => {
|
|
20
|
+
requestTextInput({
|
|
21
|
+
id: `${id}-url-input`,
|
|
22
|
+
placeholder: '動画のURLを入力',
|
|
23
|
+
initialValue: url,
|
|
24
|
+
onSubmit: (value) => {
|
|
25
|
+
if (value && value.trim() !== '') {
|
|
26
|
+
onUrlChange(value.trim());
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}, [id, url, onUrlChange, requestTextInput]);
|
|
31
|
+
return (_jsxs("group", { position: [0, panelY, 0], children: [_jsxs("mesh", { position: [0, 0, 0], children: [_jsx("planeGeometry", { args: [width, PANEL_HEIGHT] }), _jsx("meshBasicMaterial", { color: "#1a1a2a", transparent: true, opacity: 0.9 })] }), _jsx(IconButton, { id: `${id}-url-input`, position: [-width * 0.45, 0, 0.01], size: BUTTON_SIZE, icon: "\uD83D\uDD17", interactionText: "URL\u5909\u66F4", onInteract: handleUrlInput }), _jsx(IconButton, { id: `${id}-play-pause`, position: [-width * 0.38, 0, 0.01], size: BUTTON_SIZE, icon: playing ? "||" : "▶", interactionText: playing ? "一時停止" : "再生", onInteract: onPlayPause }), _jsx(IconButton, { id: `${id}-stop`, position: [-width * 0.31, 0, 0.01], size: BUTTON_SIZE, icon: "\u25A0", interactionText: "\u505C\u6B62", onInteract: onStop }), _jsx(ProgressBar, { id: `${id}-progress`, position: [0, 0.01, 0.01], width: progressBarWidth, height: PROGRESS_BAR_HEIGHT, progress: progress, duration: duration, onSeek: onSeek }), _jsx(Text, { position: [0, -0.035, 0.01], fontSize: 0.025, color: "#aaaaaa", anchorX: "center", anchorY: "middle", children: timeText }), _jsx(VolumeControl, { id: `${id}-volume`, position: [width * 0.4, 0, 0.01], size: BUTTON_SIZE, volume: volume, onVolumeChange: onVolumeChange })] }));
|
|
32
|
+
});
|
|
33
|
+
ControlPanel.displayName = 'ControlPanel';
|
|
34
|
+
//# sourceMappingURL=ControlPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControlPanel.js","sourceRoot":"","sources":["../../../../src/components/VideoPlayer/components/ControlPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACzC,OAA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AClC,IAAI,EAAE,WAAW,EACjB,IAAI,EAAC,QAAG,EACR,eAAe,EAAC,cAAI,EACpB,UAAU,EAAE,MAAM,GAClB,EAGF,KAAC,WAAW,IACV,EAAE,EAAE,GAAG,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EACzB,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACd,EAGF,KAAC,IAAI,IACH,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAC3B,QAAQ,EAAE,KAAK,EACf,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAC,QAAQ,YAEf,QAAQ,GACJ,EAGP,KAAC,aAAa,IACZ,EAAE,EAAE,GAAG,EAAE,SAAS,EAClB,QAAQ,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,EAChC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,GAC9B,IACI,CACT,CAAA;AACH,CAAC,CACF,CAAA;AAED,YAAY,CAAC,WAAW,GAAG,cAAc,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
id: string;
|
|
3
|
+
position: [number, number, number];
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
progress: number;
|
|
7
|
+
duration: number;
|
|
8
|
+
onSeek: (time: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const ProgressBar: import("react").MemoExoticComponent<({ id, position, width, height, progress, duration, onSeek, }: Props) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=ProgressBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoPlayer/components/ProgressBar.tsx"],"names":[],"mappings":"AAKA,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AAID,eAAO,MAAM,WAAW,qGASnB,KAAK,6CA8CT,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
import { Interactable } from '../../Interactable';
|
|
4
|
+
import { calculateSegments, calculateProgressBar } from '../../commons/utils';
|
|
5
|
+
import { formatTime } from '../utils';
|
|
6
|
+
const SEGMENTS = 20;
|
|
7
|
+
export const ProgressBar = memo(({ id, position, width, height, progress, duration, onSeek, }) => {
|
|
8
|
+
const { width: progressWidth, offset: progressOffset } = calculateProgressBar(progress, width);
|
|
9
|
+
const segmentWidth = width / SEGMENTS;
|
|
10
|
+
const segments = useMemo(() => {
|
|
11
|
+
return calculateSegments({
|
|
12
|
+
segments: SEGMENTS,
|
|
13
|
+
width,
|
|
14
|
+
maxValue: duration,
|
|
15
|
+
formatLabel: (value) => (value === 0 ? '最初に戻る' : formatTime(value)),
|
|
16
|
+
});
|
|
17
|
+
}, [duration, width]);
|
|
18
|
+
return (_jsxs("group", { position: position, children: [_jsxs("mesh", { position: [0, 0, 0], children: [_jsx("planeGeometry", { args: [width, height] }), _jsx("meshBasicMaterial", { color: "#333333" })] }), progressWidth > 0 && (_jsxs("mesh", { position: [progressOffset, 0, 0.001], children: [_jsx("planeGeometry", { args: [progressWidth, height] }), _jsx("meshBasicMaterial", { color: "#4a9eff" })] })), segments.map((segment) => (_jsx(Interactable, { id: `${id}-seg-${segment.index}`, onInteract: () => onSeek(segment.value), interactionText: segment.label, children: _jsxs("mesh", { position: [segment.xPos, 0, 0.002], children: [_jsx("planeGeometry", { args: [segmentWidth * 0.98, height * 2] }), _jsx("meshBasicMaterial", { transparent: true, opacity: 0, depthWrite: false })] }) }, segment.index)))] }));
|
|
19
|
+
});
|
|
20
|
+
ProgressBar.displayName = 'ProgressBar';
|
|
21
|
+
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../../../src/components/VideoPlayer/components/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAYrC,MAAM,QAAQ,GAAG,EAAE,CAAA;AAEnB,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAC7B,CAAC,EACC,EAAE,EACF,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,GACA,EAAE,EAAE;IACV,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAC9F,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,CAAA;IAErC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,OAAO,iBAAiB,CAAC;YACvB,QAAQ,EAAE,QAAQ;YAClB,KAAK;YACL,QAAQ,EAAE,QAAQ;Y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,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoPlayer/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/VideoPlayer/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -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 */
|
|
11
|
+
url?: string;
|
|
12
|
+
/** 初期再生状態(デフォルト: true) */
|
|
13
|
+
playing?: boolean;
|
|
14
|
+
/** 初期音量 0〜1(デフォルト: 1) */
|
|
15
|
+
volume?: number;
|
|
16
|
+
}
|
|
17
|
+
/** @public */
|
|
18
|
+
export type VideoPlayerProps = Props;
|
|
19
|
+
export declare const VideoPlayer: import("react").MemoExoticComponent<({ id, position, rotation, width, url: initialUrl, playing: initialPlaying, volume: initialVolume, }: 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/VideoPlayer/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/VideoPlayer/index.tsx"],"names":[],"mappings":"AASA,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,aAAa;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,cAAc;AACd,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAA;AA8DpC,eAAO,MAAM,WAAW,4IASnB,KAAK,6CAiHT,CAAA"}
|