(attrs: Record<string, string>)
| 3 | import type { RuntimeMediaClip } from "./media"; |
| 4 | |
| 5 | function createVideo(attrs: Record<string, string>): HTMLVideoElement { |
| 6 | const el = document.createElement("video"); |
| 7 | for (const [key, value] of Object.entries(attrs)) { |
| 8 | el.setAttribute(key, value); |
| 9 | } |
| 10 | // jsdom doesn't compute media duration, so we stub it |
| 11 | Object.defineProperty(el, "duration", { value: NaN, writable: true, configurable: true }); |
| 12 | document.body.appendChild(el); |
| 13 | return el; |
| 14 | } |
| 15 | |
| 16 | function createAudio(attrs: Record<string, string>): HTMLAudioElement { |
| 17 | const el = document.createElement("audio"); |
no test coverage detected