Embedded player often gives 404 when in reveal.js

I wrote some slides in reveal.js 4 and I imported some asciinema recordings using the provided script:

The result is beautiful, but the player does not load by itself or at all (see the rendered slide).

In Firefox 77, the slide does not render at all. In Chromium 83, the slides sometimes load by themselves, but I usually need to right click and “reload element” (a few times). When it does not load, I get the following warnings in the developer tools:

A cookie associated with a cross-site resource at http://asciinema.org/ was set
without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

DevTools failed to load SourceMap: Could not load content for https://asciinema.org/js/asciinema-player.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Running the same script in a bare minimum HTML file locally, always works. The problem seems to be specific to the combination of reveal.js + asciinema.

I get the same problem both with and without async (although I don’t completely understand what it does, at least not in this case).

Any clue which direction I should look at? Any hints are appreciated.

You could try using the new player directly, without the intermediate embed script.

<html>
<head>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/asciinema-player@3.0.0-rc.1/dist/bundle/asciinema-player.css" />
</head>
<body>
<div id="demo" class="player"></div>
<script src="https://unpkg.com/asciinema-player@3.0.0-rc.1/dist/bundle/asciinema-player.min.js"></script>
<script>
  AsciinemaPlayer.create('https://asciinema.org/a/342201.cast', document.getElementById('demo'));
</script>
</body>
1 Like

Thanks a lot for your answer, especially since it replies to such an old question!

Both the embeding script and the new player seem to work for me today. The embeding script still has some minor issues (not appearing at the right location, though this would probably be unrelated to asciinema itself), but the player seems to be working fine!