#1 (permalink)  
Old 10-19-2004, 03:32 AM
Registered User
 
Join Date: Oct 2004
Posts: 20
PHP or Java for embedded random quicktime movie?

I am looking for either PHP or Java code for an embedded quicktime movie player that will play an embedded random quicktime movie from a list or from a folder...

Does this already exist and if not is it possible to create?

Thanks!
Reply With Quote

  #2 (permalink)  
Old 10-19-2004, 11:50 PM
Registered User
 
Join Date: Oct 2004
Posts: 20
Not a single response?
Reply With Quote
  #3 (permalink)  
Old 10-20-2004, 12:01 PM
Till's Avatar
Administrator
 
Join Date: Jan 2002
Location: Berlin, Germany
Posts: 1,453
Can you embed the quicktime in HTML? Then why not in PHP or Java?

What exactly do you struggle with?

Till
Reply With Quote
  #4 (permalink)  
Old 10-20-2004, 02:28 PM
Registered User
 
Join Date: Oct 2004
Posts: 20
I guess I did not explain it well enough... chalk it up to no sleep!

I am trying to get the embedded quicktime player to play a random movie each time you open the page so you dont see the same movie each time. I thought I would have to have a java or php script to do so automatically...

Right now it simply plays the same movie each time you open the page. I want to add variety...

Thanks!
Reply With Quote
  #5 (permalink)  
Old 10-23-2004, 05:09 PM
Registered User
 
Join Date: Oct 2004
Posts: 20
So... looks like no help from your people here...

I thought you guys were programmers? This is very dissappointing...
Reply With Quote
  #6 (permalink)  
Old 11-17-2004, 12:28 PM
Registered User
 
Join Date: Nov 2004
Posts: 2
I use a randomizer found at: http://tech.irt.org/articles/js033/

Put this in the <head> section of your html page:

<script language="JavaScript"><!--
// The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
// See: http://www.msc.cornell.edu/~houle/ja...andomizer.html

rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};

function rand(number) {
return Math.ceil(rnd()*number);
};

// end central randomizer. -->

</script>


Then, where you want the quicktime movie to appear, put:

<script language="javascript"><!--
document.write('<embed src="movie' + rand(#) + '.mov" width="240" height="196" align="left"></embed>');
//--></script>

Replace the # with the actual number of movies you have. This assumes they are named "movie1.mov, movie2.mov, etc."

Hope this helps.
Reply With Quote
  #7 (permalink)  
Old 11-17-2004, 05:49 PM
Registered User
 
Join Date: Oct 2004
Posts: 20
Excellent! This is exactly what I needed, it works very well!

I can also modify it to play a differing selection of videos per page by designating different folders for different video selections per page...

Thanks a ton! You have restored my faith in this board!

CAG out...
Reply With Quote
  #8 (permalink)  
Old 11-17-2004, 10:01 PM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks, glad it worked. But I wouldn't say I justified this board that much. I was looking for the same pre-written script, and stumbled on this thread.

Once I found, and slightly modified a script, i thought I return and post it for you.
Reply With Quote
  #9 (permalink)  
Old 11-17-2004, 11:50 PM
Registered User
 
Join Date: Oct 2004
Posts: 20
Well, my understanding, after voicing my frustration to the board admin via email last month, was that the board serves two functions.. one - resident admin helps you when they can and 2 -what you just did, that other users can help you with the information they come across or use themselves...

Without the board being here for you to surf, I would still not know how to solve this issue and I am sure this happens to alot of those that come here for help (other suers helping them out, I mean)...

That is what restored my faith...

CAG out...
Reply With Quote
  #10 (permalink)  
Old 11-18-2004, 02:12 PM
Registered User
 
Join Date: Nov 2004
Posts: 10
Do you have a site where you puted this code and where you can see the movies. Give me the link cuz I want to see it and would like to know how this works.
__________________
Mike
Reply With Quote
  #11 (permalink)  
Old 01-19-2005, 11:30 PM
Registered User
 
Join Date: Oct 2004
Posts: 20
Quote:
Originally Posted by xianfox
I use a randomizer found at: http://tech.irt.org/articles/js033/

Put this in the <head> section of your html page:

<script language="JavaScript"><!--
// The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
// See: http://www.msc.cornell.edu/~houle/ja...andomizer.html

rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};

function rand(number) {
return Math.ceil(rnd()*number);
};

// end central randomizer. -->

</script>


Then, where you want the quicktime movie to appear, put:

<script language="javascript"><!--
document.write('<embed src="movie' + rand(#) + '.mov" width="240" height="196" align="left"></embed>');
//--></script>

Replace the # with the actual number of movies you have. This assumes they are named "movie1.mov, movie2.mov, etc."

Hope this helps.
I have used this script quite successfully now since you posted it, however is there an equivilent php solution for this instead of a javascript? I am migrating my entire site to php and would prefer to do away with the javascripts if possible...

I look forward to your response...

Thanks...
Reply With Quote
  #12 (permalink)  
Old 01-24-2005, 02:52 PM
Registered User
 
Join Date: Oct 2004
Posts: 20
This Issue Fully Solved!!

Here is a php solution for an autoplaying embedded quicktime movie...

File name is randommovie.php

<?php

/*
* Name your movies 1.mov, 2.mov etc.
*
* Add this line to your page where you want the movies to
* appear on your php page: <?php include "randommovie.php"; ?>
*/

// Change this to the total number of movies in the folder
$total = "14";

// Change to the type of files to use eg. .mov , .mpg, .wmv, etc
$file_type = ".mov";

// Change to the location of the folder containing the images
$movie_folder = "movie/folder";

// You do not need to edit below this line

$start = "1";

$random = mt_rand($start, $total);

$movie_name = $random . $file_type;

// Alter width, height, alignment, controller, and loop commands to match your needs

echo "<embed src=\"$movie_folder/$movie_name\" width=\"125\" height=\"125\" align=\"center\" controller=\"false\" loop=\"true\"></embed>";

?>

I adapted this from php random image code...

All tested and works fine...

Speeds up the page significantly with not having another set of javascripts running...

CAG out...

Last edited by CAG Hotshot; 01-25-2005 at 12:49 AM.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 07:01 AM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter