Saturday, August 03, 2013

How to Do a Partial YouTube Embed (Custom Start and End)?

Suppose you have a long YouTube video but would like to do an embed only from say first to second minute? It's actually possible with a simple tweak.

The following is the standard embed code (without changing anything) of the PSY - Gangnam Style YouTube from first to second minute.

<iframe width="560" height="315" src="//www.youtube.com/embed/9bZkp7q19f0" frameborder="0" allowfullscreen></iframe>

To do a partial embed from the first to second minute, you will first need to convert the periods into seconds. So it would be from the 1*60=60 seconds to the 2*60=120 seconds. We will then add the 2 new start and end parameters to the embed code. The following is the customised embed code.

<iframe width="560" height="315" src="//www.youtube.com/embed/9bZkp7q19f0?start=60&end=120" frameborder="0" allowfullscreen></iframe>

The video goes like this!

No comments:

Post a Comment

Do provide your constructive comment. I appreciate that.