Primary and Fallback (RMTP and HTML5) for JWPlayer 6

百般思念 提交于 2019-12-11 12:04:52

问题


I'm currently using JWplayer 6, and I figured that there are configurations "differences" between JWPlayer 5 and 6.

Does anyone know how to set primary and fallback for JWPlayer 6?

I've set my script this way:

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>");

When I go to my PC browser and check my website, it cannot display. However, if I used my iphone, it shows. If I comment out http, my browser can show the video, but not my iphone. If I comment out rtmp, my iPhone can show the video. But I needed stream support as my primary.

Has anyone had this problem before?

Thanks

EDIT: Use 'primary':'flash' just before width 720 and after ] (close square brackets). And it works with stream and HTML for both PC and handheld devices, WOOHOO!!


回答1:


Try this it works on 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",
            });

Reference: Fallback to direct download



来源:https://stackoverflow.com/questions/16096180/primary-and-fallback-rmtp-and-html5-for-jwplayer-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!