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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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">

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.