Primefaces/jsf媒体标签在chrome浏览器中播放WebM文件

Primefaces/jsf媒体标签在chrome浏览器中播放WebM文件,jsf,primefaces,Jsf,Primefaces,我想知道使用PrimeFaces标签播放.webm媒体文件需要什么类型的设置。 我的代码如下所示: <p:media style="margin: auto; display: block" id="part1Video" rendered="true" player="windows" width="600" height="400" value="C:\...\Part1_Intro_(new).webm"/> 当我尝试在Microsoft Internet Explor

我想知道使用PrimeFaces标签播放.webm媒体文件需要什么类型的设置。 我的代码如下所示:

<p:media style="margin: auto; display: block" id="part1Video" 
rendered="true" player="windows" width="600" height="400" 
value="C:\...\Part1_Intro_(new).webm"/>

当我尝试在Microsoft Internet Explorer中打开页面时,这一点很有效,但我无法在Google Chrome中看到视频。 我正在寻找一种方法来嵌入视频使用PrimeFaces,不涉及插件

我的代码如下所示:

<p:media style="margin: auto; display: block" id="part1Video" 
rendered="true" player="windows" width="600" height="400" 
value="C:\...\Part1_Intro_(new).webm"/>

我希望您的意思是文件在服务器上,因为我不知道服务器在什么情况下需要向客户端本身播放客户端计算机中的视频

无论如何,您可以尝试创建一个servlet来流式处理您的webm

@WebServlet(name = "WebmViewer", urlPatterns = {"/WebmViewer"})
public class WebmViewer extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        try {
            String path = request.getParameter("path");
            Path p = Paths.get(path);
            byte[] webmbytes = Files.readAllBytes(p);
            response.setContentType("video/webm");
            response.getOutputStream().write(webmbytes);
            response.getOutputStream().flush();
            response.getOutputStream().close();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
url将类似于

http://localhost:8080/WebApp/WebmViewer?path=F:\java\mp3\Loop.webm
然后使用quicktime播放它

<p:media value="WebmViewer?path=F:\java\mp3\Loop.webm" player="quicktime"/>


服务器或客户端上是否有“c:\…”?是否使用“”查看应用程序?浏览器控制台中的任何错误?c:\..\在客户端上。是的,我正在使用“127.0.0.1/localhost”查看应用程序。浏览器控制台消息“不允许加载本地资源:”file:///c:/../Part1_Intro_(新).webm?pfdrid c=true
。当从Chrome浏览器调用文件时,它自己就可以完美地工作。提前感谢您的建议。