Ezviz-OpenBiz / EZUIKit-JavaScript-npm

轻应用npm版本,降低接入难度,适配自定义UI,适配主流框架
235 stars 82 forks source link

延时加载 js 报错 #258

Open chendetong1993 opened 3 hours ago

chendetong1993 commented 3 hours ago

你好, 我在下面的使用场景遇到了bug,希望帮忙看下谢谢。

//异步加载脚本
  async loadScript(url) {
        const scriptElement = document.createElement('script');
        scriptElement.src = url;
        document.head.appendChild(scriptElement);
        await new Promise((resolve, reject) => {
            scriptElement.onload = resolve;
            scriptElement.onerror = reject;
        });
    }

//开始运行
await loadScript('./ezuikit.js');
new window.EZUIKit.EZUIKitPlayer({
      id: "xxxxxxx",
      accessToken: "xxxxxxx",
      url: "xxxxxxx",
      width: 320,
      height: 250,
      handleError: (err) => {
          console.log(err);
      },
      handleSuccess: () => {
      }
  });

控制台输出 错误 (1)Decoder.js:8 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'. (2)Decoder.js:8 falling back to ArrayBuffer instantiation

freeshineit commented 3 hours ago

你好, 我在下面的使用场景遇到了bug,希望帮忙看下谢谢。

//异步加载脚本
  async loadScript(url) {
        const scriptElement = document.createElement('script');
        scriptElement.src = url;
        document.head.appendChild(scriptElement);
        await new Promise((resolve, reject) => {
            scriptElement.onload = resolve;
            scriptElement.onerror = reject;
        });
    }

//开始运行
await loadScript('./ezuikit.js');
new window.EZUIKit.EZUIKitPlayer({
      id: "xxxxxxx",
      accessToken: "xxxxxxx",
      url: "xxxxxxx",
      width: 320,
      height: 250,
      handleError: (err) => {
          console.log(err);
      },
      handleSuccess: () => {
      }
  });

控制台输出 错误 (1)Decoder.js:8 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'. (2)Decoder.js:8 falling back to ArrayBuffer instantiation

正常情况, 因为服务器不支持 application/wasm, 只能以文件流的方式响应。 报错不影响解码播放