MCPcopy Index your code
hub / github.com/heygen-com/hyperframes / initializeSession

Function initializeSession

packages/engine/src/services/frameCapture.ts:913–1243  ·  view source on GitHub ↗
(session: CaptureSession)

Source from the content-addressed store, hash-verified

911
912// fallow-ignore-next-line unit-size
913export async function initializeSession(session: CaptureSession): Promise<void> {
914 const { page, serverUrl } = session;
915
916 // Forward browser console to host. HyperFrames runtime logs get a dedicated
917 // prefix so page-context observability is visible in producer stdout.
918 page.on("console", (msg: ConsoleMessage) => {
919 const type = msg.type();
920 const text = msg.text();
921 const locationUrl = msg.location()?.url ?? "";
922 const diagnostic = formatConsoleDiagnostic(type, text, locationUrl);
923 if (!diagnostic.suppressHostLog) console.log(diagnostic.text);
924 appendBrowserDiagnostic(session, diagnostic.text);
925 });
926
927 page.on("pageerror", (err) => {
928 const message = err instanceof Error ? err.message : String(err);
929 const text = `[Browser:PAGEERROR] ${message}`;
930
931 // Benign play/pause race during frame capture — suppress terminal noise, keep in buffer.
932 const isPlayAbort =
933 /^AbortError:/.test(message) && message.includes("play()") && message.includes("pause()");
934 if (!isPlayAbort) {
935 console.error(text);
936 }
937
938 appendBrowserDiagnostic(session, text);
939 });
940
941 page.on("requestfailed", (request) => {
942 appendBrowserDiagnostic(
943 session,
944 formatRequestFailureDiagnostic({
945 method: request.method(),
946 resourceType: request.resourceType(),
947 url: request.url(),
948 failureText: request.failure()?.errorText ?? "unknown",
949 }),
950 );
951 });
952
953 page.on("response", (response) => {
954 const status = response.status();
955 if (status < 400) return;
956
957 const request = response.request();
958 appendBrowserDiagnostic(
959 session,
960 formatHttpErrorDiagnostic({
961 method: request.method(),
962 resourceType: request.resourceType(),
963 url: response.url(),
964 status,
965 statusText: response.statusText(),
966 }),
967 );
968 });
969
970 // Navigate to the file server

Callers 13

renderChunkFunction · 0.90
runOneCalibrationFunction · 0.90
runCaptureStreamingStageFunction · 0.90
runProbeStageFunction · 0.90
runCaptureStageFunction · 0.90
runCaptureHdrStageFunction · 0.90
executeWorkerTaskFunction · 0.85
generateThumbnailFunction · 0.85
generateThumbnailFunction · 0.85

Calls 15

formatConsoleDiagnosticFunction · 0.85
appendBrowserDiagnosticFunction · 0.85
gotoEntryPageFunction · 0.85
logInitPhaseFunction · 0.85
pollHfReadyFunction · 0.85
applyVideoMetadataHintsFunction · 0.85
pollVideosReadyFunction · 0.85
pollImagesReadyFunction · 0.85
decodeAllImagesFunction · 0.85

Tested by

no test coverage detected