From bd73617e5c080dec851c1ff929f5f2ea48f32190 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Thu, 20 Apr 2023 14:45:08 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 525854969 --- mediapipe/web/graph_runner/graph_runner.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mediapipe/web/graph_runner/graph_runner.ts b/mediapipe/web/graph_runner/graph_runner.ts index 578577cf0..0115312b4 100644 --- a/mediapipe/web/graph_runner/graph_runner.ts +++ b/mediapipe/web/graph_runner/graph_runner.ts @@ -14,6 +14,7 @@ import {isWebKit} from '../../web/graph_runner/platform_utils'; */ export declare interface FileLocator { locateFile: (filename: string) => string; + mainScriptUrlOrBlob?: string; } /** @@ -1222,7 +1223,11 @@ export async function createMediaPipeLib( // self.Module and a fileLocator, we manually merge them into self.Module and // use that. TODO: Remove this when asset scripts are fixed. if (self.Module && fileLocator) { - (self.Module as FileLocator).locateFile = fileLocator.locateFile; + const moduleFileLocator = self.Module as FileLocator; + moduleFileLocator.locateFile = fileLocator.locateFile; + if (fileLocator.mainScriptUrlOrBlob) { + moduleFileLocator.mainScriptUrlOrBlob = fileLocator.mainScriptUrlOrBlob; + } } // TODO: Ensure that fileLocator is passed in by all users // and make it required