我试图让这个信用卡读卡器在我的角度应用程序上工作。我按照阅读中的所有步骤操作并获得了许可证密钥,但由于某种原因,我收到以下错误
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,但它仍然给我错误。我是否缺少参考资料或其他内容?在此先感谢您的帮助。