Jump to content

Play random youtube videos from urls in database


JohnOP

Recommended Posts

Ok say i have a database with users who have a video url field for them to enter a video url to be submitted to the database, im trying to create a page where the videos will be displayed one at a time for example ' 1st video plays then it switches to the next random video from the database and so on' i want only to play so many seconds of the video before it switches as they will be presentations so i dont want viewers to watch them all in full, could anyone help me out with some code or feedback on this please?

OK i have made a popup for where the video will be displayed, i can grab all the urls from the database for all users but i dont know how to display only of those videos for so many seconds then the popup refreshes to a new video for so many second, please could anyone help?

Yeah i know how to refresh the page but how can i have it where after that refresh a new video is shown from the database, instead of the one we previously seen before the refresh?

 

When it refreshes it will still be the same link so i cant redirect them every refresh.

Ahh i see i never thought of that at all, just to get this cleared up is it possible to have a variable in this

 

<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/<?php echo $vid; ?>"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/<?php echo $vid; ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>

 

I have tried this a few ways as a test and the video does not show.

 

<?php
$vid = "uBBly_0E7f0&feature=feedu";

?>
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/<?php echo $vid; ?>"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/<?php echo $vid; ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>

 

Though i even tried it without a variable and you as the whole link and still the video doesn't show hmm.

Ok i got this to work

 

<embed src="
http://www.youtube.com/v/mnPCMIUvT0g&autoplay=1" type="application/x-shockwave-flash"
wmode="transparent" width="425" height="350">

 

But this doesn't

 

<embed src="
http://www.youtube.com/v/<?php echo $videoid; ?>&autoplay=1" type="application/x-shockwave-flash"
wmode="transparent" width="425" height="350">

 

with or without autoplay=1 at the end, any ideas why not?

The page stays blank.

 

Source code

 

53i8UpqT80U<embed src="
http://www.youtube.com/v/&autoplay=1" type="application/x-shockwave-flash"
wmode="transparent" width="425" height="350">

 

Not showing the php at all

 

My code

 

 <?php
echo "53i8UpqT80U";
?>
<embed src="
http://www.youtube.com/v/<?php echo $videoid; ?>&autoplay=1" type="application/x-shockwave-flash"
wmode="transparent" width="425" height="350">

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.