@djangocfg/ui-nextjs 2.1.69 → 2.1.70
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-nextjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.70",
|
|
4
4
|
"description": "Next.js UI component library with Radix UI primitives, Tailwind CSS styling, charts, and form components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"check": "tsc --noEmit"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@djangocfg/api": "^2.1.
|
|
62
|
-
"@djangocfg/ui-core": "^2.1.
|
|
61
|
+
"@djangocfg/api": "^2.1.70",
|
|
62
|
+
"@djangocfg/ui-core": "^2.1.70",
|
|
63
63
|
"@types/react": "^19.1.0",
|
|
64
64
|
"@types/react-dom": "^19.1.0",
|
|
65
65
|
"consola": "^3.4.2",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"wavesurfer.js": "^7.12.1"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
113
|
+
"@djangocfg/typescript-config": "^2.1.70",
|
|
114
114
|
"@types/node": "^24.7.2",
|
|
115
115
|
"eslint": "^9.37.0",
|
|
116
116
|
"tailwindcss-animate": "1.0.7",
|
package/src/stores/mediaCache.ts
CHANGED
|
@@ -29,8 +29,8 @@ interface EffectConfig {
|
|
|
29
29
|
blur: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// Stream URL TTL (
|
|
33
|
-
const STREAM_URL_TTL =
|
|
32
|
+
// Stream URL TTL (30 seconds - shorter to avoid stale session/token issues)
|
|
33
|
+
const STREAM_URL_TTL = 30 * 1000;
|
|
34
34
|
|
|
35
35
|
interface MediaCacheState {
|
|
36
36
|
// Blob URL cache (shared by Image, Audio, Video)
|
|
@@ -86,15 +86,25 @@ export const StreamProvider = forwardRef<VideoPlayerRef, StreamProviderProps>(
|
|
|
86
86
|
} = useVideoCache();
|
|
87
87
|
|
|
88
88
|
// Retry function for error fallback
|
|
89
|
+
// Regenerates URL for stream sources to get fresh token/session
|
|
89
90
|
const retry = useCallback(() => {
|
|
90
91
|
setHasError(false);
|
|
91
92
|
setIsLoading(true);
|
|
92
|
-
|
|
93
|
+
|
|
94
|
+
// For stream sources, regenerate URL bypassing cache
|
|
95
|
+
if (source.type === 'stream') {
|
|
96
|
+
const streamSource = source as StreamSource;
|
|
97
|
+
const freshUrl = streamSource.getStreamUrl(streamSource.sessionId, streamSource.path);
|
|
98
|
+
setVideoUrl(freshUrl);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// For other sources, just reload
|
|
93
103
|
const video = videoRef.current;
|
|
94
104
|
if (video && videoUrl) {
|
|
95
105
|
video.load();
|
|
96
106
|
}
|
|
97
|
-
}, [videoUrl]);
|
|
107
|
+
}, [source, videoUrl]);
|
|
98
108
|
|
|
99
109
|
// Expose video element methods via ref
|
|
100
110
|
useImperativeHandle(
|
|
@@ -20,17 +20,26 @@ import { useVideoCache } from '../../../stores/mediaCache';
|
|
|
20
20
|
import type { MediaPlayerInstance } from '@vidstack/react';
|
|
21
21
|
import type { VidstackProviderProps, VideoPlayerRef, ErrorFallbackProps } from '../types';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Vidstack source type (string or object with type hint)
|
|
25
|
+
*/
|
|
26
|
+
type VidstackSrc = string | { src: string; type: string };
|
|
27
|
+
|
|
23
28
|
/**
|
|
24
29
|
* Convert source to Vidstack-compatible format
|
|
30
|
+
* Returns object with explicit type for HLS/DASH to ensure proper loader selection
|
|
25
31
|
*/
|
|
26
|
-
function getVidstackSrc(source: VidstackProviderProps['source']):
|
|
32
|
+
function getVidstackSrc(source: VidstackProviderProps['source']): VidstackSrc {
|
|
27
33
|
switch (source.type) {
|
|
28
34
|
case 'youtube':
|
|
29
35
|
return `youtube/${source.id}`;
|
|
30
36
|
case 'vimeo':
|
|
31
37
|
return `vimeo/${source.id}`;
|
|
32
38
|
case 'hls':
|
|
39
|
+
// Explicit type needed because URL may have query params that hide .m3u8 extension
|
|
40
|
+
return { src: source.url, type: 'application/x-mpegurl' };
|
|
33
41
|
case 'dash':
|
|
42
|
+
return { src: source.url, type: 'application/dash+xml' };
|
|
34
43
|
case 'url':
|
|
35
44
|
return source.url;
|
|
36
45
|
default:
|