Reputation: 13
I'm developing exam portal site, where faculty upload video tutorials for students. I want to play video when the student click the tutorial without downloading.video include (.flv,.mkv,.mp4) formats I referred internet but not able to understand please any one help with simple example. I'm using php and mysql
<html><body><table cellpadding="0" cellspacing="0" border="0" class="table table-hover table-stripped" id="example">
<thead>
<tr style="background:lightblue">
<td align="center">Department Name</td>
<th align="center">Video Tutorials</th>
<th align="center">Action</th>
</tr>
</thead>
<?php
$query=mysql_query("select * from video_uploads order by id desc");
while($row=mysql_fetch_array($query)){
$name=$row['file'];
$dept=$row['dept_name'];
?>
<tr>
<td> <?php echo $dept;?>
</td>
<td>
<iframe width="460" height="215" src="staff/video/<?php echo $name ;?>" allowfullscreen=""></iframe>
</td>
</tr>
<?php }?> </table></body></html>
code for upload video is here
if(isset($_POST['submit'])){
$dept_name=$_POST['dept'];
$name=$_FILES['file']['name'];
$size=$_FILES['file']['size'];
$type=$_FILES['file']['type'];
$temp=$_FILES['file']['tmp_name'];
move_uploaded_file($temp,"video/".$name);
$sql="INSERT INTO video_uploads(dept_name,file,type,size) VALUES('$dept_name','$name','$type','$size')";
if(executeQuery($sql))
{
echo " <script>
alert('successfully uploaded');
window.location.href='videoupload.php?success';
</script>";
}
else
{
?>
<script>
alert('error while uploading file');
window.location.href='videoupload.php?fail';
</script>
<?php
}
}
?>
Upvotes: 1
Views: 1407
Reputation: 133
<html><body><table cellpadding="0" cellspacing="0" border="0" class="table table-hover table-stripped" id="example">
<thead>
<tr style="background:lightblue">
<td align="center">Department Name</td>
<th align="center">Video Tutorials</th>
<th align="center">Action</th>
</tr>
</thead>
<?php
$query=mysql_query("select * from video_uploads order by id desc");
while($row=mysql_fetch_array($query)){
$name=$row['file'];
$dept=$row['dept_name'];
?>
<tr>
<td> <?php echo $dept;?>
</td>
<td>
<video width="460" height="215" >
<source src="staff/video/<?php echo $name ;?>" type="videp/mp4" >
</video>
</td>
</tr>
<?php }?> </table></body></html>
If you want to play flv or mkv video then just replace the "mp4" to "mkv" or any video format you want it.
Upvotes: 2