MCPcopy
hub / github.com/bubkoo/html-to-image / cloneVideoElement

Function cloneVideoElement

src/clone-node.ts:20–35  ·  view source on GitHub ↗
(video: HTMLVideoElement, options: Options)

Source from the content-addressed store, hash-verified

18}
19
20async function cloneVideoElement(video: HTMLVideoElement, options: Options) {
21 if (video.currentSrc) {
22 const canvas = document.createElement('canvas')
23 const ctx = canvas.getContext('2d')
24 canvas.width = video.clientWidth
25 canvas.height = video.clientHeight
26 ctx?.drawImage(video, 0, 0, canvas.width, canvas.height)
27 const dataURL = canvas.toDataURL()
28 return createImage(dataURL)
29 }
30
31 const poster = video.poster
32 const contentType = getMimeType(poster)
33 const dataURL = await resourceToDataURL(poster, contentType, options)
34 return createImage(dataURL)
35}
36
37async function cloneIFrameElement(iframe: HTMLIFrameElement, options: Options) {
38 try {

Callers 1

cloneSingleNodeFunction · 0.85

Calls 3

createImageFunction · 0.90
getMimeTypeFunction · 0.90
resourceToDataURLFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…