First off, I created a really easy upload script so i could upload .flv files to a folder on my server. I used this tutorial.
When I had the upload script working, I created a Quick Tag in cnr with this code, set Name and Tag to flv or something:
- Code: Select all
<center><embed src="(path to flvplayer)mediaplayer.swf" width="500" height="310" allowscriptaccess="always" allowfullscreen="true" flashvars="height=310&width=500&file=(uploaddir)/$1&image=(path to bgimage.jpg)&backcolor=0xAAAAAA&frontcolor=0x000000&lightcolor=0x000000&screencolor=0x000000&logo=(path to watermark.png)&searchbar=false&showstop=true&showdownload=true" /></center>
change the (dir to flvplayer), (uploaddir), (path to bgimage.jpg) and (path to watermark.png) to your settings (dont use the ( and )-characters ).
Now you can upload files with the fileuploader and use [flv]flvfilename.flv[/flv] to get the videoes in your news.
This is all good so far, but i also wanted a videosection on my site. I found a script that searches a folder for .flv files and makes a .xml file. This xml file can be used with JW FLV Media Player to make a playlist.
Open notepad and copy/paste the code below. Save the file as playlist.php or something. Upload playlist.php to the same dir as you upload your .flv files.
- Code: Select all
<?php
/*
* This is a sample file that reads through a directory, filters the mp3/jpg/flv
* files and builds a playlist from it. After looking through this file, you'll
* probably 'get the idea' and'll be able to setup your own directory.
*
*/
// set this to a creator name
$creator = "Your name";
// search for mp3 files. set this to '.flv' or '.jpg' for the other scripts
$filter = ".flv";
// path to the directory you want to scan
// "./" = current directory
$directory = "./";
// URL to files
$url = "http://www.dummyurl.com";
/////////////////////////// no user configuration variables below this \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// read through the directory and filter files to an array
@$d = dir($directory);
if ($d)
{
while($entry = $d->read())
{
$ps = strpos(strtolower($entry), $filter);
if (!($ps === false))
{
$items[$entry]['mtime'] = filemtime($entry);
}
}
$d->close();
arsort($items);
}
// the playlist is built in an xspf format
// first, we'll add an xml header and the opening tags...
header("content-type:text/xml;charset=utf-8");
echo "<?xml version='1.0' encoding='utf-8'?>\n";
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
echo " <title>Sample PHP Generated Playlist</title>\n";
echo " <info>" . $url . "</info>\n";
echo " <trackList>\n";
// ...then we loop through the array...
foreach($items as $key => $value)
{
$title = substr($key, 0, strlen($key) - 4);
echo " <track>\n";
echo " <creator>" . $creator . "</creator>\n";
echo " <title>" . $title . "</title>\n";
echo " <location>" . $url . '/' . $key . "</location>\n";
echo " <image>" . $url . '/' . $title . ".jpg</image>\n";
echo " <info>" . $url . "</info>\n";
echo " </track>\n";
}
// ...and last we add the closing tags
echo " </trackList>\n";
echo "</playlist>\n";
/*
* That's it! You can feed this playlist to the SWF by setting this as it's 'file'
* parameter in your HTML page.
*/
?>
Now all you have to do is make a embed code that looks for the playlist.php file. Example:
- Code: Select all
<embed
src="(path/to/mediaplayer.swf)"
width="500"
height="500"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="height=500&width=500&file=(path/to/playlist.php)&image=(path/to/bgimage.jpg)&logo=(path/to/watermark.png)&displayheight=240&showstop=true&showdownload=true&autoscroll=true"
/>
thats it. hopefully someone else will try this and try to work some more on it. I would love to have a searchoption, a ratingsystem and a most viewed section
Here is what i have so far: http://playstation.sistestopp.com/side. ... videoarkiv
Ohh, and if you upload a .jpg picture with the same name as the .flv file you will have a preview image
EDIT: I use http://media-convert.com/ to convert video files to flv files.
And i have also added the upload script to the cutenews.ru admin panel, so its really easy to add files. If you want the code for that i can give it to you
