MCPcopy Create free account
hub / github.com/Moebytes/Frame-Player / getThumbnail

Function getThumbnail

components/VideoPlayer.tsx:396–408  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394
395 useEffect(() => {
396 const getThumbnail = async () => {
397 if (!originalSrc) return
398 if (functions.isVideo(originalSrc)) {
399 const thumb = await functions.videoThumbnail(originalSrc)
400 setBackFrame(thumb)
401 } else if (functions.isAnimation(originalSrc)) {
402 setBackFrame(originalSrc)
403 } else if (functions.isZip(originalSrc)) {
404 const buffer = await fetch(originalSrc!).then((r) => r.arrayBuffer())
405 const frames = await functions.extractUgoiraFrames(buffer, true)
406 setBackFrame(frames[0].frame.toDataURL())
407 }
408 }
409 if (originalSrc) getThumbnail()
410 }, [originalSrc])
411

Callers 1

VideoPlayerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected