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

Function buildHostHtml

packages/player/tests/perf/server.ts:80–118  ·  view source on GitHub ↗
(fixtureName: string, width: number, height: number)

Source from the content-addressed store, hash-verified

78}
79
80function buildHostHtml(fixtureName: string, width: number, height: number): string {
81 const playerSrc = "/player/hyperframes-player.global.js";
82 const fixtureSrc = `/fixtures/${fixtureName}/index.html`;
83 return `<!doctype html>
84<html lang="en">
85 <head>
86 <meta charset="utf-8" />
87 <title>player perf host: ${fixtureName}</title>
88 <style>
89 html, body { margin: 0; padding: 0; background: #000; }
90 hyperframes-player { display: block; }
91 </style>
92 </head>
93 <body>
94 <hyperframes-player
95 id="player"
96 src="${fixtureSrc}"
97 width="${width}"
98 height="${height}"
99 muted
100 ></hyperframes-player>
101 <script>
102 window.__playerReady = false;
103 window.__playerReadyAt = null;
104 window.__playerNavStart = performance.timeOrigin + performance.now();
105 const player = document.getElementById("player");
106 player.addEventListener("ready", function (event) {
107 window.__playerReady = true;
108 window.__playerReadyAt = performance.timeOrigin + performance.now();
109 window.__playerDuration = (event.detail && event.detail.duration) || 0;
110 });
111 player.addEventListener("error", function (event) {
112 window.__playerError = (event.detail && event.detail.message) || "unknown";
113 });
114 </script>
115 <script src="${playerSrc}"></script>
116 </body>
117</html>`;
118}
119
120async function readBunFile(path: string): Promise<Response> {
121 if (!existsSync(path)) {

Callers 1

fetchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected