MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / seekToStart

Function seekToStart

frontend/src/components/FloatingVideo.jsx:260–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

258 // Always start playback from the beginning of the seekable range.
259 let hasSeekedToStart = false;
260 const seekToStart = () => {
261 if (hasSeekedToStart) return;
262 try {
263 let target = 0;
264 if (video.seekable && video.seekable.length > 0) {
265 target = video.seekable.start(0);
266 }
267 // Only apply if we're not already at/near the start. Avoid
268 // setting currentTime when the video has no duration yet.
269 if (
270 Number.isFinite(target) &&
271 Math.abs((video.currentTime || 0) - target) > 0.25
272 ) {
273 video.currentTime = target;
274 }
275 hasSeekedToStart = true;
276 } catch {
277 // ignore
278 }
279 };
280
281 const handleLoadStart = () => setIsLoading(true);
282 const handleLoadedMetadata = () => {

Callers 3

handleLoadedMetadataFunction · 0.85
handleLoadedDataFunction · 0.85
handleCanPlayFunction · 0.85

Calls 1

startMethod · 0.45

Tested by

no test coverage detected