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?
Click the compose tweet button. Write an engaging caption to go along with your video. Click add media, choose your video file, and click add. Note: Maximum file size is 512MB.
Click the icon located within the Tweet. From the menu, select Embed Tweet. This will open publish.twitter.com where you can customize the look of the embedded Tweet by clicking set customization options. If the Tweet is a reply to another Tweet, you can check Hide Conversation to hide the original Tweet.
If the video file doesn't meet Twitter video posting requirements, for example, the video is too long, the file size is too large, or the video format is not supported, you will end up with failure in posting a video to Twitter. According to Twitter's official policy, the video length could be between 0.5s to 140s.
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.
Use http://tinyurl.com/ and put in the url of your YouTube video it will give you a smaller url and tweet that
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With