The main problem is that you're trying to run a script that uses XMLHttpRequest
as a local HTML file in your browser. If you open your browser console, you'll see that it gives an error trying to find the files in all your src
/href
tags. You could fix that by removing the starting /
from every src
/href
and the player would load, but then you'd run into problems with CORS when the script tries to load your cast file.
The solution would be to use an HTTP server to host your cast files, so you could reference them directly by their full server path, like http://localhost:3000/asciinema/demo.cast
. Or you could just use an external URL for a cast file, providing the external website has no CORS enabled. Example:
<asciinema-player src="https://asciinema.org/a/28307.cast"></asciinema-player>
Now which HTTP server you choose is on you, there are many many really simple servers made in every programming language possible. If you're familiar with Node/JavaScript, then http-server
would do. If you're familiar with Python then simplehttpserver
would also do. Try whichever one you're comfortable with.
Another "solution" is to disable CORS in your browser. But then you're just risking yourself and that's also just a cheap hack.
TL;DR: you can't load local cast files within local HTML files because of CORS. You need to host your casts on a local or external HTTP server.