Skip to content

Commit 91365b0

Browse files
committed
fix: fix missing getServerSnapshot error in ssr
1 parent 63d1026 commit 91365b0

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/hooks/useAudioControl.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ export function useAudioControl(options: CreateAudioElementOptions) {
137137
},
138138
[audioElementRef]
139139
),
140-
() => audioElementRef.current?.volume
140+
() => audioElementRef.current?.volume,
141+
() => undefined
141142
);
142143

143144
const muted = useSyncExternalStore(
@@ -157,7 +158,8 @@ export function useAudioControl(options: CreateAudioElementOptions) {
157158
},
158159
[audioElementRef]
159160
),
160-
() => audioElementRef.current?.muted
161+
() => audioElementRef.current?.muted,
162+
() => undefined
161163
);
162164

163165
const currentTime = useSyncExternalStore(
@@ -174,7 +176,8 @@ export function useAudioControl(options: CreateAudioElementOptions) {
174176
},
175177
[audioElementRef]
176178
),
177-
() => audioElementRef.current?.currentTime
179+
() => audioElementRef.current?.currentTime,
180+
() => undefined
178181
);
179182

180183
const duration = useSyncExternalStore(
@@ -194,7 +197,8 @@ export function useAudioControl(options: CreateAudioElementOptions) {
194197
},
195198
[audioElementRef]
196199
),
197-
() => audioElementRef.current?.duration
200+
() => audioElementRef.current?.duration,
201+
() => undefined
198202
);
199203

200204
const bufferedSeconds = useSyncExternalStore(
@@ -220,7 +224,8 @@ export function useAudioControl(options: CreateAudioElementOptions) {
220224
return audio.buffered.end(audio.buffered.length - 1);
221225
}
222226
return 0;
223-
}
227+
},
228+
() => undefined
224229
);
225230

226231
const isPlaying = useSyncExternalStore(
@@ -239,7 +244,8 @@ export function useAudioControl(options: CreateAudioElementOptions) {
239244
() => {
240245
const audio = audioElementRef.current;
241246
return audio ? !audio.paused : false;
242-
}
247+
},
248+
() => undefined
243249
);
244250

245251
const isLoading = useSyncExternalStore(
@@ -265,7 +271,8 @@ export function useAudioControl(options: CreateAudioElementOptions) {
265271
const audio = audioElementRef.current;
266272
if (!audio) return false;
267273
return audio.networkState === audio.NETWORK_LOADING;
268-
}
274+
},
275+
() => undefined
269276
);
270277

271278
return {

0 commit comments

Comments
 (0)