Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asciinema oembed doesn't provide the player #328

Open
damageboy opened this issue May 26, 2018 · 3 comments
Open

asciinema oembed doesn't provide the player #328

damageboy opened this issue May 26, 2018 · 3 comments

Comments

@damageboy
Copy link

The asciinema oEmbed support provides the following json, as an example:

{
  "type": "rich",
  "version": 1,
  "title": "DevStats async loading, interactive mode and caching",
  "author_name": "shroudedcode",
  "author_url": "https://asciinema.org/~shroudedcode",
  "provider_name": "asciinema",
  "provider_url": "https://asciinema.org/",
  "thumbnail_url": "https://asciinema.org/a/170671.png",
  "thumbnail_width": 644,
  "thumbnail_height": 632,
  "html": "<a href=\"https://asciinema.org/a/170671\" target=\"_blank\"><img alt=\"DevStats async loading, interactive mode and caching\" src=\"https://asciinema.org/a/170671.png\" width=\"644\" /></a>",
  "width": 644,
  "height": 632
}

As it can be easily seen the html portion of the oEmbed doesn't actually embed a player, but rather embeds a link to the asciinema site...

Is there a reason no to embed the player through an iframe as, for example youtube does?

@ku1ik ku1ik transferred this issue from asciinema/asciinema Nov 13, 2018
@ku1ik
Copy link
Contributor

ku1ik commented Nov 13, 2018

Frankly I don't remember whether iframe would work here or not. I don't see why not though :) That's worth considering, thx!

@tomy0000000
Copy link

tomy0000000 commented May 8, 2023

I also recently bumped into this issue and would love to see players provided in the oEmbed API.

Looking at the source code of oEmbed view, I think it should not be hard to support this, and I'm willing to contribute to this.

Specifically, the oEmbed API currently responds:

{
  "author_name": "captainPuff",
  "author_url": "https://asciinema.org/~captainPuff",
  "height": 792,
  "html": "<a href=\"https://asciinema.org/a/50301\" target=\"_blank\"><img alt=\"rya.nc 1987\" src=\"https://asciinema.org/a/50301.png\" width=\"1179\"></a>",
  "provider_name": "asciinema",
  "provider_url": "https://asciinema.org",
  "thumbnail_height": 792,
  "thumbnail_url": "https://asciinema.org/a/50301.png",
  "thumbnail_width": 1179,
  "title": "rya.nc 1987",
  "type": "rich",
  "version": 1.0,
  "width": 1179
}

and the html part provides:

<a href="https://asciinema.org/a/50301" target="_blank">
  <img alt="rya.nc 1987" src="https://asciinema.org/a/50301.png" width="1179" />
</a>

after changing, it'll be:

<script src="https://asciinema.org/a/50301.js" id="asciicast-50301" async></script>

If possible, I'll also try to make the customized parameters work.

@ku1ik Please let me know if you'd like this, then I'll start drafting a PR.

@ku1ik
Copy link
Contributor

ku1ik commented Aug 25, 2023

@tomy0000000 I think we can try that, yeah 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants