On this page, we show examples of coding for embedding Youtube videos on your web page. You may also be interested in making the vidoes "responsive", IE, they'll look good regardless of the screen size used by your visitors.
First, a simple embed of a single Youtube video. You get the code to do this on any Youtube video by clicking Share and then Embed. This gives you HTML code like this:
Adjust the size of the video by changing the height and width values in the IFRAME. As most videos on Youtube have a 16/9 aspect ratio, it's best to set the height to be 56.25% of the width.
Although putting several videos on a page has advantages, it may harm how Google Search treats your page. Google takes considerable interest in video pages but one of their "rules" is that you should only have one video per page. We've got around that on one of our sites by having extra code that scans the multi-video page and builds a lot of individual pages that have only one video. How we did that is beyond the scope of this set of articles.
You can add multiple videos to a page
There are some issues with putting more than one video on a page
Users can easilly start more than one resulting in mixed soundtracks
If you have a lot of videos on one page, the page can load very slowly
We've done a lot of work to avoid these issues. Here are some techniques
Use code that detects when the user has clicked the Play button on a video and pauses any other video that was playing. We've some code that does that here