gpt4 book ai didi

angular - DOMException:无法在 'importScripts' 上执行 'WorkerGlobalScope':无法加载 'http://localhost:4200/BlinkCardWasmSDK.js' 处的脚本

转载 作者:行者123 更新时间:2023-12-04 08:06:23 27 4
gpt4 key购买 nike

我正在尝试获取 this信用卡读卡器来处理我的 Angular 应用程序。我按照自述中的所有步骤操作并获得了许可证 key ,但由于某种原因,我收到以下错误

Error during the initialization of the SDK! DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:4200/BlinkCardWasmSDK.js' failed to load.
在我的组件中,我根据说明实现了以下方法:
 scanCard() {
if ( BlinkCardSDK.isBrowserSupported() ) {
const loadSettings = new BlinkCardSDK.WasmSDKLoadSettings( 'sRwAAAYJbG9jYA==' );

BlinkCardSDK.loadWasmModule( loadSettings ).then
(
( wasmSDK: BlinkCardSDK.WasmSDK ) => {
// The SDK was initialized successfully, save the wasmSDK for future use
BlinkCardSDK.createBlinkCardRecognizer( wasmSDK ).then(recognizer => {
BlinkCardSDK.createRecognizerRunner( wasmSDK, [ recognizer ], true ).then(recognizerRunner => {
const cameraFeed = document.getElementById( 'camera-feed' ) as HTMLVideoElement;
BlinkIDSDK.VideoRecognizer.createVideoRecognizerFromCameraStream(cameraFeed, recognizerRunner)
.then(videoRecognizer => {
videoRecognizer.recognize().then(processResult => {
if ( processResult !== BlinkIDSDK.RecognizerResultState.Empty ) {
recognizer.getResult().then(recognitionResult => {
console.log( recognitionResult );

});
} else {
console.log( 'Recognition was not successful!' );
}
console.log(processResult);
});

});
});

});
},
( error: any ) => {
// Error happened during the initialization of the SDK
console.log( 'Error during the initialization of the SDK!', error );
});
} else {
console.log( 'This browser is not supported by the SDK!' );
}
}
在html中我有:
<body>
<div id="screen-initial">
<h1 id="msg">Loading...</h1>
<progress id="load-progress" value="0" max="100"></progress>
</div>

<div id="screen-start" class="hidden">
<a href="#" id="start-scan">Start scan</a>
</div>

<div id="screen-scanning" class="hidden">
<video id="camera-feed" playsinline></video>
<!-- Recognition events will be drawn here. -->
<canvas id="camera-feedback"></canvas>
<p id="camera-guides">Point the camera towards Payment cards.</p>
</div>
</body>
我在/src/assets/BlinkCardWasmSDK.js 中添加了 BlinkCardWasmSDK.js 但它仍然给我错误。我是否缺少引用资料或其他东西?在此先感谢您的帮助。

最佳答案

问题是 BlinkID 找不到它需要的资源。您需要将其指向架构师、构建、选项以及最后的 Assets 数组中的 angular.json 配置文件( Angular workspace configuration docs )中的资源位置。

          "assets": [
{
"glob": "**/*",
"input": "node_modules/@microblink/blinkid-in-browser-sdk/resources",
"output": "/"
}
]
您不需要将 BlinkID 资源移动到您的 Assets ,而是指向它在 node_modules 中的位置。如果这有帮助,请告诉我。

关于angular - DOMException:无法在 'importScripts' 上执行 'WorkerGlobalScope':无法加载 'http://localhost:4200/BlinkCardWasmSDK.js' 处的脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66199865/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com