我正在开发考试门户网站,其中教师上传学生的视频教程。我想播放视频,当学生点击教程没有下载.video包括(.flv,.mkv,.mp4)格式 我介绍了互联网,但不能理解请任何一个简单的例子帮助。 我使用PHP和MySQL在没有下载的情况下在网页中播放flv和mkv格式的视频
<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>
上传视频代码是在这里
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
}
}
?>
Ther在mkv或flv的视频标签中不支持。只有MP4和ogg和webm。因此,文件必须转换..文件仍然下载,它只是浏览器自动为你做。 – szatmary