How to preview a video website card?


#1

We know that there is no preview api for card,
So we get the card info by /cards/video_website/:id ,

  {
      "video_poster_height": "9",
      "name": "カード名",
      "website_shortened_url": "https://t.co/Cto6poCGbR",
      "video_height": "9",
      "video_url": "https://video.twimg.com/amplify_video/vmap/956469818797957121.vmap",

and tried to make a card preview like the following.

<div>
  <video src={video_url} />
 <span>card title</span>
</div>

But video_url seems not worked?
Do you have any good idea?

Thanks in advance.


#2

@wenping.wang: We don’t currently have a way to generate HTML previews for Video Website Cards using the GET accounts/:account_id/tweet/preview.

[G]iven that we’re still working toward adding card_uri support for this endpoint, it currently does not support Video Website Cards.

Announcement: Tweet preview improvements.

For existing Tweets with a Video Website Card attached, you can use the GET accounts/:account_id/tweet/preview/:tweet_id endpoint to retrieve the HTML preview.

Thanks for the question.


#3

@juanshishido
Thanks so much.

I meant to preview a card, not a tweet,
but the “video_url” get by /cards/video_website/:id seemed not work when do sth with it like below.

<div>
  <video src={video_url} />
 <span>card title</span>
</div>

#4

I see what you mean. Thanks for the clarification.

You’ve got two options here.

  1. Using the card’s video_content_id, you can look up the video details using the GET accounts/:account_id/videos/:video_id endpoint. The preview_url for the video entity is a URL for the .mp4 file.
  2. You can parse the .vmap to get at the .mp4. Through this approach, we typically provide options for a few different bitrates.

I hope this helps.

Thanks!