我正在尝试使用Amazon CloudFront使用jwplayer流式传输/下载视频。
首先,我的s3桶是:miemiebucket.s3.amazonaws.com,我分别放了2个视频,分别是MOV和MP4。
然后我去了cloudfront并创建了两个发行版,流媒体和下载,它们是:
s2y3u5i4t1fkbz.cloudfront.net(流媒体) dkgitv33rxgy.cloudfront.net(下载)
我回到了我的jsp文件,并使用JWplayer
尝试了3种不同的设置文档中的那个:
out.println("<div id=\"myElement\">Loading the player...</div>");
out.println("<script type=\"text/javascript\">");
out.println("jwplayer(\"myElement\").setup({");
out.println("file: \"http://content.bitsontherun.com/videos/3XnJSIm4-kNspJqnJ.mp4\",");
out.println("});");
out.println("</script>");
完全按预期工作
我发现这是一个HTML播放器。因此我切换了文件:
out.println("file: dkgitv33rxgy.cloudfront.net\someVideo.MOV",");
然而它无法播放
然后我尝试了RMTP:
out.println("'file': 'rtmp://s2y3u5i4t1fkbz.cloudfront.net/someVideo.MOV',");
2和3都有此错误:
Error loading player: No playable sources found
2和3不起作用,但1有效,所以我猜测有一个设置没有正确配置Amazon CloudFront?我没有使用限制访问权限,所以我不需要签署URL。当我输入时:
http://dkgitv33rxgy.cloudfront.net\someVideo.MOV
我最初将someVideo.MOV设置为public时可以下载该文件。
我还将存储桶设置为公共存储桶,以确保通过浏览器连接它没有问题。
与jwplayer和CloudFront很混淆,之前有没有人遇到过这个问题?
编辑:解决方案:Primary and Fallback (RMTP and HTML5) for JWPlayer 6