繁体   English   中英

如何在其余查询中使用jwplayer?

[英]How to use jwplayer with rest query?

我正在尝试让JWPlayer参与我的网站。 我试图从服务器获取我的视频文件。 这是我的JavaScript:

       <div id='player'></div>
       <script type='text/javascript'>
           jwplayer('player').setup({
               file: "http://localhost:8080/rest/course/getVideoStream",
               width: '100%',
               aspectratio: '16:9'
           });
       </script>

这是我的休息:

@GET
@Path("/getVideoStream")
    @Produces("video/mp4")
public Response getVideoStream(){
    File file = new File(storagePath + "videos/courses/1.mp4");
    return Response.ok(file, "video/mp4").build();
}

它不起作用,但是如果我尝试使用包含JavaScript的文件夹中的视频来更改字段“文件”,则它可以工作。

如果http://localhost:8080/rest/course/getVideoStream确实提供了有效的mp4文件,请尝试添加

type:'mp4'

 aspectratio: '16:9'

完整代码:

   jwplayer('player').setup({
           file: "http://localhost:8080/rest/course/getVideoStream",
           width: '100%',
           aspectratio: '16:9',
           type:'mp4'
       });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM