How can I make links on my own page that work like deep links interacting with an embedded youtube/vimeo on that same page?
-
Does anyone know about a technique to make links on a website function as deep links to an embedded vimeo/youtube video on that same page? That way one could include video's in a blog post or similar, and reference certain portions of the video through deep linked time codes. I suspect one would need some javascript magic to do this. On another note, I wish I had the "tagging might" to be able to introduce the tags deep-linking and vimeo.
-
Answer:
You can embed deep-linked YouTube videos by using the 'start' attribute to make playback start at a specific time, like this: <iframe id="video" width="560" height="349" src="http://www.youtube.com/embed/3CR5y8qZf0Y?start=20" frameborder="0" allowfullscreen></iframe> You could modify the start time using JavaScript and jQuery, like this: jQuery function setTheTime(theTime) { var videoURL = $('iframe#video').attr('src'); videoURL = videoURL.replace(/=.+/, "="+theTime+"&autoplay=1"); $('iframe#video').attr('src',videoURL); } $('.time').click(function() { var newTime = $(this).attr('href').replace('#',''); setTheTime(newTime); }); HTML <p>Watch this video from <a href="#20" class="time">20 seconds</a> or from <a href="#40" class="time">40 seconds.</a></p><br/><br/> <iframe id="video" width="560" height="349" src="http://www.youtube.com/embed/3CR5y8qZf0Y?start=0" frameborder="0" allowfullscreen> </iframe> Demo Here's a http://jsfiddle.net/cPyZ9/4/ (Click the '20 seconds' and '40 seconds' links in the 'Result' frame on the bottom right to see it working.) Notes Note that I modified the default YouTube embed code to add ?start=0 to the src and the id="video" attribute so we can target that iframe with jQuery. Once you've done that, all links on the page using the <a href="#20" class="time">link text here</a> format will modify the start time and autoplay the video. Not sure if this is possible with Vimeo, as I'm not as familiar with their embed code.
thunki at Webmasters Visit the source
Other answers
For YouTube, this is how you link using timecodes to get to the bit you want: http://www.google.com/support/youtube/bin/answer.py?answer=116618 For Vimeo this FAQ describes how to do it, but only if it's your video: http://vimeo.com/help/faq#chapters
paulmorriss
Related Q & A:
- How can I make My Yahoo! my home page?Best solution by Yahoo! Answers
- How can I make a page my home page?Best solution by Yahoo! Answers
- How can I make my YouTube Profile better?Best solution by Yahoo! Answers
- How can I make Yahoo as my home page?Best solution by Yahoo! Answers
- How can I make Yahoo.com my home page?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.