Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding Youtube Video in Email

I've tried multiple times to send out an email trying to get the YouTube video to appear within the email but however, I've had no luck.

I get this back:

Empty Screen

I've tried using iFrame but turns out it doesn't support Gmail.

<iframe width="560" height="315" src="https://www.youtube.com/embed/w_Da75XbPBs"            frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

I'm trying to replicate what Youtube uses when it sends out subscription emails containing the video link.

I've also tried object and embed but neither of them appear when I send the email out.

edit; I'm trying to replicate this (the portion in red redirecting to Youtube if clicked on):

enter image description here

like image 738
Jona Avatar asked Oct 16 '22 04:10

Jona


1 Answers

The world of coded emails is an interested one. For starters, you can't send javascript elements through an email, for security reasons, I'm sure you know this but I wanted to cover my bases.

Also, consider what css you're using. Emails can only support a limited number of css options and all css must be inline (you can't use the element). Also maybe read up on email support for html and css as a whole (check out this super awesome link).

It looks to me as though YouTube isn't actually embedding the video, which others have mentioned (at least, they aren't embedding the videos in the way we are used to). Rather they are taking the thumbnail image from their database and then stylizing it (with video length and such) to make it look like an embedded video.

While you don't have access to the YouTube thumbnail database, I'm assuming you want to send links of your own videos to others? Just host the thumbnails, of whatever videos you want to send, on your server and then link to it with a simple '> and then use some styles.

like image 71
Nathan Martin Avatar answered Nov 15 '22 10:11

Nathan Martin