如何使用servlet和jsp在浏览器上播放视频,视频存储在本地系统中,如D:/video/sample.mp4

时间:2014-10-13 10:43:56

标签: javascript html5 jsp servlets

我尝试使用视频标签但是当视频不在项目位置时它无法正常工作

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Sample</title>
    </head>
    <body>

        <video width="400" controls>
          <source src="D:/video/Sample.mp4" type="video/mp4"/>

          Your browser does not support HTML5 video.
        </video>

    </body>
</html>

1 个答案:

答案 0 :(得分:2)

对于本地绝对文件路径,您必须写:

<source src="file:/d:/video/Sample.mp4" type="video/mp4"/>