asciinema / asciinema-player

Web player for terminal session recordings
https://docs.asciinema.org/manual/player/
Apache License 2.0
2.67k stars 266 forks source link

Cannot read properties of null (reading 'init') #248

Open TheBozzz34 opened 1 year ago

TheBozzz34 commented 1 year ago

Bug Attempting to use the asciinema player in both Chrome and Firefox results in a properties of null error, or a type error.

To Reproduce

  1. Install asciinema player
  2. Open in browser
  3. Click play button
  4. See error

Expected behavior Player plays recording when play button is clicked

Screenshots Chrome: chrome Firefox: firefox

Versions:

Additional context I have added CSP headers to both my html and NGINX config

The html:

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Security-Policy" content="default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval'">

  <link rel="stylesheet" type="text/css" href="asciinema-player.css" />
</head>
<body>
  <div id="player"></div>
  <script src="asciinema-player.min.js"></script>
  <script>
    AsciinemaPlayer.create(
      'neofetch.cast',
      document.getElementById('player'),
      { cols: 203, rows: 62 }
    );
  </script>
</body>
</html>

NGINX header:

add_header Content-Security-Policy "script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval';";

ku1ik commented 1 year ago

I guess Windows CSP is blocking the embedded WASM instantiation. I don't have Windows system at hand so can't test this unfortunately.