Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playing YouTube video with start and end time using YouTube API

I'm trying to figure out how to set a custom start and end time for an embedded YouTube video shown below:

https://youtube.googleapis.com/v/BmOpD46eZoA%26start=36%26end=65 

However the above link is not working properly in the Safari browser. Can anyone suggest how to make this work for the Safari browser?

like image 689
SureshKumar Vegesna Avatar asked Oct 22 '13 00:10

SureshKumar Vegesna


2 Answers

Your problem is on the encoding of "?"and "&".

https://www.youtube.com/v/BmOpD46eZoA?start=36&end=65 

or

http://www.youtube.com/embed/BmOpD46eZoA?start=36&end=65  

simply works fine.

like image 180
Ibrahim Ulukaya Avatar answered Sep 17 '22 14:09

Ibrahim Ulukaya


You should try

https://www.youtube.com/embed/-ZWGpOSS6T0?start=130&end=144&version=3 

First thing you have to do is of course get the specific time you want your embedded video to start and the specific time you want it to end at. Then convert them into seconds. Let’s say you want to embed only the part of the video starting from 02:16 up to 02:58.

In seconds, your start time would be ( 2 * 60 ) + 16 = 136 and your end time would be ( 2 * 60 ) + 58 = 178.

Next, grab the embed code from the Youtube video, and append the following parameters to the video URL in the embed code:

?start=[your_start_time]&end=[your_end_time]&version=3

Replace [your_start_time] and [your_end_time] with your actual start and end times in seconds so that your embed code would look like this:

Read more here, How to embed or link to a specific part of a YouTube video

like image 34
Vishal Chopra Avatar answered Sep 17 '22 14:09

Vishal Chopra