MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / parseResolutionFromHtml

Function parseResolutionFromHtml

packages/parsers/src/htmlParser.ts:134–160  ·  view source on GitHub ↗
(doc: Document)

Source from the content-addressed store, hash-verified

132}
133
134function parseResolutionFromHtml(doc: Document): CanvasResolution | null {
135 const htmlEl = doc.documentElement;
136 if (!htmlEl) return null;
137 const resolutionAttr = htmlEl.getAttribute("data-resolution");
138 if (
139 resolutionAttr === "landscape" ||
140 resolutionAttr === "portrait" ||
141 resolutionAttr === "landscape-4k" ||
142 resolutionAttr === "portrait-4k" ||
143 resolutionAttr === "square" ||
144 resolutionAttr === "square-4k"
145 ) {
146 return resolutionAttr;
147 }
148
149 const widthAttr = htmlEl.getAttribute("data-composition-width");
150 const heightAttr = htmlEl.getAttribute("data-composition-height");
151 if (widthAttr && heightAttr) {
152 const width = parseInt(widthAttr, 10);
153 const height = parseInt(heightAttr, 10);
154 if (width && height) {
155 return resolveResolutionFromDimensions(width, height);
156 }
157 }
158
159 return null;
160}
161
162const UHD_SQUARE_MIN = 2160;
163const UHD_RECT_MIN = 3840;

Callers 1

parseHtmlFunction · 0.85

Calls 2

getAttributeMethod · 0.65

Tested by

no test coverage detected