(video: HTMLVideoElement, options: Options)
| 18 | } |
| 19 | |
| 20 | async 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 | |
| 37 | async function cloneIFrameElement(iframe: HTMLIFrameElement, options: Options) { |
| 38 | try { |
no test coverage detected
searching dependent graphs…