gpt4 book ai didi

java - 如何将 jwplayer 与 rest 查询一起使用?

转载 作者:行者123 更新时间:2023-11-30 17:21:55 25 4
gpt4 key购买 nike

我正在尝试让 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 的视频更改字段"file",它就会起作用。

最佳答案

如果 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'
});

关于java - 如何将 jwplayer 与 rest 查询一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25003557/

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