We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,567 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Start and stop in youtube video?

Hi Frendz,
I need a solution to stop an embed youtube video at a particular timestamp. Any possible way to do this?

2
Contributors
4
Replies
14 Hours
Discussion Span
1 Year Ago
Last Updated
8
Views
Karthik_pranas
Posting Pro
571 posts since Feb 2011
Reputation Points: 96
Solved Threads: 101
Skill Endorsements: 0
diafol
Keep Smiling
Moderator
10,608 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,506
Skill Endorsements: 57

http://googlesystem.blogspot.com/2008/10/embed-part-of-youtube-video.html

Thanks for your reply Ardav... Thats working fine in http://www.splicd.com/. But I want that in my site

Karthik_pranas
Posting Pro
571 posts since Feb 2011
Reputation Points: 96
Solved Threads: 101
Skill Endorsements: 0

Get the embed code from spliced. Here's an example:

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/bYHq5QffAbo&start=10&end=20"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/bYHq5QffAbo&start=10&end=20" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>

You need to get the long link from youtube (embed option, then options)
Paste this into spliced, set the start and stop times, scroll down to get the object embed code. You can get rid of the spliced div though.

All it does is add start and end parameters to the v link.

If you have a db table for videos:

vid_id
videotype_id (e.g. 1=youtube, 2=vimeo...)
videocode (e.g. bYHq5QffAbo)
videostart (e.g. 10)
videoend (e.g. 20)
videotitle (...)
videocaption (...)


videotype_id
videotype_label (e.g. YouTube)
videotype_template (see below)


A videotype_template for YouTube could be:

<object width="%width" height="%height"><param name="movie" value="http://www.youtube.com/v/%code%start%end"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/%code%start%end" type="application/x-shockwave-flash" allowfullscreen="true" width="%width" height="$height"></embed></object>

You then just substitute placeholders for data from the videos table and default parameters like width and height:

$width = 345;
$height = 200;

$r = mysql_query("SELECT v.*, vt.* FROM videos AS v INNER JOIN vt ON v.videotype_id = vt.videotype_id WHERE v.vid_id = 5");
if(mysql_num_rows($r)){
  $d = mysql_fetch_array($r);

  $temp = $d['videotype_template']; 
  $temp = str_replace('%width',$width,$temp);
  $temp = str_replace('%height',$height,$temp);
  $temp = str_replace('%code',$d['videocode'],$temp);
  $temp = str_replace('%start','&start='.$d['videostart'],$temp);  
  $temp = str_replace('%end','&end='.$d['videoend'],$temp);  

}
echo "<h3>{$d['videotitle']}</h3>$temp<p>{$d['videocaption']}</p>";

That's off the top of my head. Last bit is a bit naff, but you get the idea.

EDIT

Check the values of end - perhaps replace the whole end placeholder with "" if no end specified (or = 0)

diafol
Keep Smiling
Moderator
10,608 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,506
Skill Endorsements: 57

Thanks for your valuable suggestion Ardav, I get the embed code from splicd as follows

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/EXLIj0n2BV4&start=70&end=75"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/EXLIj0n2BV4&start=70&end=75" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>							
        <div style="text-align: right; margin-top: 3px; width: 425px; height: 344px;"><a href="http://splicd.com" style="color: rgb(85, 85, 85); font-size: 13px; text-decoration: none; font-family: Helvetica,sans-serif;">powered by <span style="color: rgb(200, 91, 0);">Splicd.com</span></a></div>

But in that the start point is working fine and the end point of video is not. The video is starting from the point where I specified but it continuously running till the end of the video.

The embed source that you specified in the last post did the same....

Karthik_pranas
Posting Pro
571 posts since Feb 2011
Reputation Points: 96
Solved Threads: 101
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0719 seconds using 2.79MB