Reputation: 2096
I recently signed up for Twitter at a client's request. When posting my video's URL or direct link to the .mp4 on Twitter, I'm just getting the link.
When attempting the same with youtube, there is a dropdown "view video" tab. Is there specific headers that are needing to be sent? I can't find it in the API or on Google. Or any question asked on here about it!
Or is the site needing to be whitelisted by Twitter themselves?
Upvotes: 10
Views: 64056
Reputation: 2544
Nowadays you should directly upload your video to Twitter, from app or web.
Note, there are some restrictions, most notably:
The reason for the latter is probably that after uploading the video you get a small editing (cropping) dialog, which presumably requires Flash.
Upvotes: 1
Reputation: 4237
This question is rather old, but it has quite a few views, and none of the solutions are correct.
Twitter has a feature called Twitter Cards that will allow you to have the videos on your website embedded directly in tweets. You will need to add a Player Card to your website via meta data if you would like to achieve this.
Implementing Twitter Cards only requires adding a few lines of code to your HTML head. You can find some examples here. I'll paste one example for your convenience:
<!DOCTYPE html>
<html>
<head>
..
<meta name="twitter:card" content="player">
<meta name="twitter:site" content="@rchoi">
<meta name="twitter:title" content="Sample Player Card">
<meta name="twitter:description" content="This is a sample video. When you implement, make sure all links are secure.">
<meta name="twitter:image" content="https://yoursite.com/example.png">
<meta name="twitter:player" content="https://yoursite.com/container.html">
<meta name="twitter:player:width" content="480">
<meta name="twitter:player:height" content="480">
<meta name="twitter:player:stream" content="https://yoursite.com/example.mp4">
<meta name="twitter:player:stream:content_type" content="video/mp4">
..
</head>
..
</html>
Not all of the meta
properties are required. You can find a list of them on Twitter's developer website: Player Card Reference.
You will also need to get your Twitter account whitelisted for Twitter Cards. You can do so at the Card validator. Once you preview your card, a button should appear, giving you the option to request access to Twitter Cards.
Upvotes: 4
Reputation: 6971
Use http://tinyurl.com/ and put in the url of your YouTube video it will give you a smaller url and tweet that
Upvotes: 2