Jump to content

getting from mysql and streaming video


Dusaro

Recommended Posts

Well, I am not sure where to post this since it is using php and javascript.

 

I am using OSFlvPlayer to stream the videos, the information for each video is in a mysql database. Using the $_GET php variable I am getting a value called id, I am then comparing the $id variable with the value called ID in the mysql database.

The problem i am having is that it will not get the correct directory to get the videos, it is simply setting it as "/videos/.flv" instead of say "/videos/mario.flv"

 

<?php 
//disabling cache
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

//getting id of video
$id = $_GET[id];

// Connects to your Database 
mysql_connect("localhost", "user", "pass") or die(mysql_error()) ; 
mysql_select_db("database") or die(mysql_error()) ; 

//Retrieves data from MySQL 
$data = mysql_query("SELECT * FROM Videos WHERE ID= '$id'") or die(mysql_error()); 
//Puts it into an array 
while($info = mysql_fetch_array( $data )) 
{ 

//Outputs the image and other data
Echo "<b>Name:</b> ".$info['Name'] . " <br>";
?>

<script src='AC_RunActiveContent.js' language='javascript'></script>
<!-- saved from url=(0013)about:internet -->
<script language='javascript'>
AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'width', '400', 'height', '325', 'src', ((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? 'OSplayer' : 'OSplayer'), 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'id', 'flvPlayer', 'allowFullScreen', 'true', 'allowScriptAccess', 'always', 'movie', ((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? 'OSplayer' : 'OSplayer'), 'FlashVars', 'movie=/videos/<?php $info["Name"] ?>.flv&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off&vTitle=<?php $info["Name"] ?>&showTitle=yes');
</script>
<noscript>
<object width='400' height='325' id='flvPlayer'>
  <param name='allowFullScreen' value='true'>
   <param name="allowScriptAccess" value="always"> 
  <param name='movie' value='OSplayer.swf?movie=<?php $info["Name"] ?>.flv&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off&vTitle=<?php $info["Name"] ?>&showTitle=yes'>
  <embed src='OSplayer.swf?movie=/videos/<?php $info["Name"] ?>.flv&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off&vTitle=<?php $info["Name"] ?>&showTitle=yes' width='400' height='325' allowFullScreen='true' type='application/x-shockwave-flash' allowScriptAccess='always'>
</object>
</noscript><br/>
<?php 
Echo "<b>Description:</b><br/> ".$info['Description']; 
}
?> 

Link to comment
https://forums.phpfreaks.com/topic/254102-getting-from-mysql-and-streaming-video/
Share on other sites

Ah, in your script function you have

 

movie=/videos/<?php $info["Name"]; ?>.flv

 

Where it should be,

 

movie=/videos/<?php echo $info["Name"]; ?>.flv

 

same goes to the other similar code, you must echo the variables.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.