You're almost there. :-)
Most Flash players will import video via external XML files. All you need to do is output valid XML from your PHP. For example, let's say your embed code is using SWFObject (which it should) and you *normally* point to the video list like this.
<script type="text/javascript" src="/js/swfobject.js"></script>
<script type="text/javascript">
window.onload = function() {
if (document.getElementById('video-canvas')) {
var video = new SWFObject('\/flv\/myplayer.swf', 'video-embed', '495', '420', '6', '#ffffff');
video.addParam("wmode", "transparent");
video.addVariable("playlist", "\/somedirectory\/playlist.xml");
video.write('video-canvas');
}
};
</script>
You'd just change the bolded line to
video.addVariable("playlist", "\/somedirectory\/your-script.php");
which would output valid XML. Most players accept movie, title, caption, and the like so you'd do
header("content-type:text/xml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
<movies>";
Query your database, get full url, caption, etc . . .
while ($row=mysql_fetch_array($result)) {
$movie = $row['movie'];
$title = $row['title'];
$cap = $row['caption'];
echo "<movie url=\"$movie\" movietitle=\"$title\" moviecaption=\"$cap\"/>";
}
Then don't forget to close . . .
echo "</movies>";
It will vary from player to player, but that's how you'd most likely want to do it.