This article is not about embedding video from youtube or vimeo or some other site.
It’s about adding your own videos to your website. And adding video to your site can be tricky these days. Especially when people are using mobile devices.
You must add video to your website that is compatible with mobile devices otherwise you lose a great majority of potential visitors.
So first thing you need is a video that you’ve taken or you have rights to publish on your website. Then you need to convert the video format to prepare it for your website and mobile devices. The best way to make your videos compatible is to convert them to mp4.
Mp4 is compatible on mobile devices. There are many software you can purchase or even download for free which can be used to convert your video.
Moyea video converter is a free converter you can download and use. ffmpeg is another free tool you can use as well.Once you have converted your video to mp4 you will need to upload it to your website.
The next thing you’ll need is a player to play your video on your website. Two of the most popular and most widely used are jwplayer and flowplayer.
The video example below uses a licensed version of the jwplayer.
Once you have your player files and your video uploaded to your website you can use the following code on your web page to add your video.
<script type='text/javascript' src='http://www.yourwebsite.com/jwplayer.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'player.swf',
'file': 'http://www.yourwebsite.com/videos/yourvideo.mp4',
'controlbar': 'bottom',
'width': '470',
'height': '320'
});
</script>
And that’s all you need to do. Both jwplayer and flowplayer have example code and setup wizards as well if you get stuck with embedding the code on your website.
If you are using wordpress then the code above may not work. WordPress is tricky when it comes to adding javascript on a post or page, so the best way is to use plugins for the players instead of the code above.
WordPress has plugins you can use for both flowplayer and also for jwplayer. There are short codes you can add to your post once you’ve activated and installed the plugins.