TinyPortal
Development => Block Codes => Topic started by: Tron420 on December 19, 2006, 11:07:35 PM
how do i edit this code to make a random video play ( from a certain directory or list )
whenever the page is refreshed or viewed?
<!-- begin embedded WindowsMedia file... -->
<table border='0' cellpadding='0' align="center">
<tr><td>
<OBJECT id='mediaPlayer' width="160" height="160"
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
<param name='fileName' value="-------------------------">
<param name='animationatStart' value='true'>
<param name='transparentatStart' value='true'>
<param name='autoStart' value="true">
<param name='showControls' value="false">
<param name='loop' value="true">
<EMBED type='application/x-mplayer1'
pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1'
bgcolor='black' showcontrols="false" showtracker='-1'
showdisplay='0' showstatusbar='-0' videoborder3d='-1' width="150" height="150"
src="-----------------------" autostart="true" designtimesp='5311' loop="true">
</EMBED>
</OBJECT>
</td></tr>
<!-- ...end embedded WindowsMedia file -->
<!-- begin link to launch external media player... -->
<tr><td align='center'>
<a href="-------------------" style='font-size: 85%;' target='_blank'>-----------</a>
<!-- ...end link to launch external media player... -->
</td></tr>
</table>
Right Click For Control
You could try this.
Create a php file called urlrotator.php with the following code
$version = "v1.01";
<?
$linksfile ="urlrotator.txt";
$urls = file("$linksfile");
$url = rand(0, sizeof($urls)-1);
$goto = "$urls[$url]";
header("Location: $goto");
?>
Then create a text file called urlrotator.txt
Put the links to any videos you wanted rotated in the txt file.
Upload it to a directory on your server and then create a TP Script Block with the code
<iframe width="X" height="X" src="http://yoursite/scriptfolder/urlrotator.php"></iframe>
Replace the X's with the width/height that suites you and replace the url with the url to your uploaded script.
how is the txt supposed to look? i mean, how should i place the movie file names? canb u show me an example of how the txt file should look?
text file should just look like
http://yoursite.com/vid/1.avi
http://yoursite.com/vid/a.mpg
http://yoursite.com/vid/jd.wmv