gpt4 book ai didi

html - 无需下载即可播放网页中的flv和mkv格式视频

转载 作者:行者123 更新时间:2023-11-28 23:36:01 27 4
gpt4 key购买 nike

我正在开发考试门户网站,教师可以在该网站上为学生上传视频教程。我想在学生不下载教程的情况下点击教程播放视频。视频包含(.flv,.mkv,.mp4)格式我提到了互联网但无法理解请任何人帮助简单的例子。我正在使用 php 和 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>&nbsp;<?php echo $dept;?>
</td>
<td>
<iframe width="460" height="215" src="staff/video/<?php echo $name ;?>" allowfullscreen=""></iframe>
&nbsp;
</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
}
}
?>

最佳答案

<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>&nbsp;<?php echo $dept;?>
</td>
<td>

<video width="460" height="215" >
<source src="staff/video/<?php echo $name ;?>" type="videp/mp4" >
</video>

&nbsp;
</td>

</tr>
<?php }?> </table></body></html>

如果您想播放 flv 或 mkv 视频,只需将“mp4”替换为“mkv”或您想要的任何视频格式即可。

关于html - 无需下载即可播放网页中的flv和mkv格式视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35719910/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com