Video Coding

Home❯Coding Introduction

Coding up Videos on Web Pages

If you maintain a web site, you may have a simple tool to insert (or "embed") a Youtube/video into your pages - and you should probably use it - especially if you put just one video on a page.

This series of articles is mainly for people who lack such a tool, want to do something more complex or maybe don't want the adverts. It may also be useful if you've got a lot of videos on one page as there's several techniques for making this nicer.
 
What's good and bad about Youtube? Coding a recent video web project, we started to get fed up with Youtube and researched some alternatives. Eventually, we came back to Youtube but your journey might be different. The ideal system works perfectly, is free, is easy to code and lacks adverts. In practice, you're going to have to compromise.

As well as Vimeo and other third party solutions, did you know that it's possible to host videos on your own site/server with native HTML using the <video> tag? We didn't but when we stumbled on it, we were quite excited and found it delightfully easy to code up our project. Better still, there were no adverts! Then we hit a snag! In short, "buffering" - the videos would momentarily pause at random points for a fraction of a second which was horrible for music and dance. It might be OK for you though, here's how to do it.

Our webite is hosted on an inexpensive service that is perfectly adequate for most purposes. No one minds if there's an occasional half-second delay before a page loads. Videos involve a lot of data moving pretty fast - and without hesitation. We tried some fixes. We converted the video files to a format that had about 1/3rd of the original data which did improve things a bit. We also considered upgrading to a powerful server that wasn't shared with anyone else but the pricing was prohibitive.

When you use a third-party service like Youtube, your visitors are getting the video data directly from the Youtube servers. Your website is just the steering wheel on a very powerful car. Youtube servers are built to deliver smooth videos and if you ever see one that isn't smooth, it's probably due to your Internet connection.

So, these third-party services have a lot going for them unless you have a high-end server yourself. Generally, you pay for them by accepting adverts or by a regular subscription.

Our Code

More Resources


 


Last modified: 11 October 2025, 5:04pm