Jump to content

Youtube


waynewex

Recommended Posts

Well, I have this, but it doesn't seem to work?

 

<object width="300" height="219"><param name="movie" value="<?php echo $user_details['youtube_video'];?>&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01"></param><param name="allowFullScreen" value="true"></param><embed src="<?php echo $user_details['youtube_video']; ?>&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01" type="application/x-shockwave-flash" allowfullscreen="true" width="300" height="219"></embed></object>

Link to comment
Share on other sites

this should work you will need to edit the select to get the user details a little bit to make it fit your needs but this is the exact code i uset to pull playlists into flash players so it should work out

 


<?
// includes
include("template/conf.php");


// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// generate and execute query
$Id = mysql_escape_string($_GET['Id']);
$query = "SELECT * FROM blog WHERE Id = '$Id'";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());


// get resultset as object
$row = mysql_fetch_object($result);

// print details
if ($row)
{
?><object width="425" height="344"><param name="movie" value="<? echo $row->Blog; ?>"></param><param name="allowFullScreen" value="true"></param><embed src="<? echo $row->Blog; ?>" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>


  

<?
}
else
{
?>
<p>
<font size="-1"> could not be located in our database.</font>
<?
}

// close database connection
mysql_close($connection);
?>



Link to comment
Share on other sites

 

you cant get rid of the  v=jVs9YANjbuM

thats what makes youtube select that video

 

much like php?id=3  in php

its the id value

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/jVs9YANjbuM&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/jVs9YANjbuM&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>

Link to comment
Share on other sites

No you see,

 

 

Is the URL that will be embedded in the source.

 

Whereas

 

 

Is the URL that Youtube gives you.

 

So what I need to do is strip jVs9YANjbuM from

 

and place the jVs9YANjbuM in like so:

 

<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/<?php echo subtracted_string; ?>&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01"></param>
<param name="allowFullScreen" value="true"></param>
<embed src="http://www.youtube.com/v/<?php echo subtracted_string; ?>&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01" 
type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>

Link to comment
Share on other sites

I have

 

<?php
$equalsign = strpos($user_details['youtube_video'],"=");
$andsign = strpos($user_details['youtube_video'],"&");
?>

 

So far... I'm just wondering where to go from here? Is there a function that allows you to take a string out of another string by giving a start position and an end position?

Link to comment
Share on other sites

http://us2.php.net/str-pad

 

 

but if users are getting the html link from youtube you wont need to strip it just do

 

<object width="425" height="344"><param name="movie" value="<? echo $row->Blog; ?>&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="<? echo $row->Blog; ?>&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>

that ending string &hl=en&fs=1 can be left on the video command  users will insert the url link to video  and the remaining string will remain there should work out fine

 

as from what ive seen that string doesnt change on the like 4 videos i just clicked on

Link to comment
Share on other sites

It's okay: I do so like:

 

<?php
$equalsign = strpos($user_details['youtube_video'],"=");
$get_val = substr($user_details['youtube_video'],$equalsign+1,11);
?>

<div align="center"><br />

<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/<?php echo $get_val; ?>&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01">
</param>
<param name="allowFullScreen" value="true"></param>
<embed src="http://www.youtube.com/v/<?php echo $get_val; ?>&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01" 
type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>

</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.