asciinema-server icon indicating copy to clipboard operation
asciinema-server copied to clipboard

Host asciinema-player.js/.css at known location for easier player embedding

Open ku1ik opened this issue 8 years ago • 2 comments

We could serve asciinema-player.js and asciinema-player.css from asciinema.org so people could use the player in their HTML without downloading anything. (technically it's there somewhere in /assets but it's not official and not recommended to rely on its location right now)

We should have player version number in the URL, for example:

  • https://asciinema.org/dist/player/v2.4.1/asciinema-player.js
  • https://asciinema.org/dist/player/v2.4.1/asciinema-player.css
  • https://asciinema.org/dist/player/v2.0.0/asciinema-player.js
  • https://asciinema.org/dist/player/v2.0.0/asciinema-player.css

and so on.

Then, one could use the player via <asciinema-player> tag directly (having access to its DOM element for programmatic control etc), by linking to JS bundle on asciinema.org:

<html>
<head>
  ...
  <link rel="stylesheet" type="text/css" href="https://asciinema.org/dist/player/v2.4.1/asciinema-player.css" />
  ...
</head>
<body>
  ...
  <asciinema-player src="/demo.json"></asciinema-player>
  ...
  <script src="https://asciinema.org/dist/player/v2.4.1/asciinema-player.js"></script>
</body>
</html>

I don't see a reason to start with any version older than the latest one released.

Initially it could be as simple as redirecting to Github release URL (https://github.com/asciinema/asciinema-player/releases/download/v2.4.1/asciinema-player.js).

Further down the road it may be nice to use CDN for this.

ku1ik avatar Apr 26 '17 10:04 ku1ik

Someone added asciinema-player to cdnjs.com - https://cdnjs.com/libraries/asciinema-player 👍

ku1ik avatar Jul 18 '17 09:07 ku1ik

The latest release on cdnjs is v2.4.1, which doesn't seem to work with recordings from current asciinema.

udondan avatar Feb 23 '18 15:02 udondan

It seems cdnjs has the latest one (3.3.0 as of this writing) so I'm going to close this.

https://cdnjs.com/libraries/asciinema-player

ku1ik avatar Apr 25 '23 12:04 ku1ik