JW Player 6的主要和后备(RTMP和HTML5)

时间:2013-04-19 02:20:39

标签: java amazon-s3 jwplayer

我目前正在使用JWplayer 6,我认为JWPlayer 5和6之间存在配置“差异”。

有谁知道如何为JWPlayer 6设置主要和后备?

我以这种方式设置了我的脚本:

out.println("<div id=\"myElement\">Loading the player...</div>");
out.println("<script type=\"text/javascript\">");
out.println("jwplayer(\"myElement\").setup({");
out.println("sources:[");
out.println("{'file': \"rtmp://s2y3u5i4t1fkbz.cloudfront.net:1935/cfx/st/mp4:XXXXX.mp4\"},");
out.println("{'file': \"http://dkgitv33rxgy.cloudfront.net/XXXXX.mp4\"},");
out.println("],");
out.println("width: \"720\",");
out.println("height: \"480\"");
out.println("});");
out.println("</script>");

当我访问我的PC浏览器并查看我的网站时,它无法显示。但是,如果我使用了我的iphone,它会显示出来。如果我评论出http,我的浏览器可以显示视频,但不能显示我的iPhone。如果我评论rtmp,我的iPhone可以显示视频。但我需要流支持作为我的主要支持。

以前有没有人遇到这个问题?

谢谢

编辑:在宽度720之前和之后使用'primary':'flash'(关闭方括号)。它适用于PC和手持设备的流和HTML,WOOHOO !!

1 个答案:

答案 0 :(得分:2)

试试这个适用于JwPlayer 6.3。

        jwplayer("<?php echo $this->id?>").setup({

                autostart: 'true' ,
                flashplayer: "<?php echo CHtml::asset($this->_path.'/jwplayer.flash.swf')?>",
                width:<?php echo $this->width?>,
                height:<?php echo $this->height?>,
                playlist: [{
                    sources: [
                    {
                       //Desktop: Use RTMP protocol and played by flash.
                        file: "<?php echo $this->rtmpPath;?>"
                    },
                    {
                        //Mobile: Use HLS protocol and played by HTML5
                        file: "<?php echo $this->hlsPath;?>",
                    }
                    ]
                }],
                primary:"flash",
            });

参考: Fallback to direct download