English 中文(简体)
如何使用 jPlayer 播放 Flv 文件?
原标题:How play flv files using jPlayer?

我通过谷歌找到了在网上播放视频内容的 jPlayer 。 但是 jPlayer 不播放. flv (flash Video) 文件。 我正确地提到了 swf 播放器的路径。 它在 js 文件夹中, js 文件夹位于相同杠杆处, 我的示例是. html 代码文件。 我的代码与下面的示例相同 。 html

$("#jquery_jplayer_1").jPlayer({
        ready: function () {
          $(this).jPlayer("setMedia", {
            m4v: "media/royalrumble.mp4",
            flv: "media/royalrumble.flv",
            poster: "media/royalrumble.jpg"
        });
    },
    swfPath: "js",
    supplied: "m4v, flv"
});
最佳回答

下面的代码为我工作

$("#jquery_jplayer_1").jPlayer({
        ready: function () {
         $(this).jPlayer("setMedia", {
            m4v: "../media/royalrumble.mp4",
            flv: "../media/royalrumble.flv",
            poster: "media/royalrumble.jpg"
         });
    },
    swfPath: "js",
    supplied: "m4v, flv",
});

我不知道为什么?媒体目录在我的代码存在的地方 处于同一个控制杆上,但还是不接受

m4v: "media/royalrumble.mp4",
flv: "media/royalrumble.flv",

m4v: "../media/royalrumble.mp4",
flv: "../media/royalrumble.flv",

工作顺利。

这意味着所提供的路径应该与 jPlayer.swf 文件相对。

问题回答

希望我能加上一点信息 Bc 我在IE也有同样的问题 但是找到一个固定的网络

我发现如果我为 IE 使用 FLV fil 并做了一个./ 路径, 那么它就会对 IE 有效 。

所以我从这个开始

<script type="text/javascript">
        //<![CDATA[
        $(document).ready(function () {

            $("#jquery_jplayer_1").jPlayer({
                ready: function () {
                    $(this).jPlayer("setMedia", {
                        mp4: "video/Soccer.mp4",
                        webmv: "video/Soccer.webm",
                        flv: "video/Soccer.flv",
                        m4v: "video/Soccer.m4v",
                        ogv: "video/Soccer.ogv",
                        poster: "video/Soccer.png"
                    });
                },
                //error: function (event) {
                   // console.log(event.jPlayer.error);
                   // console.log(event.jPlayer.error.type);
                //},
                swfPath: "add/jplayer.swf",
                errorAlerts: true,
                supplied: "mp4, webmv, flv, m4v, ogv",
                solution: "html,flash",
                size: {
                    width: "640px",
                    height: "360px",
                    cssClass: "jp-video-360p"
                },
                smoothPlayBar: true,
                keyEnabled: true
            });


            $("#jplayer_inspector").jPlayerInspector({ jPlayer: $("#jquery_jplayer_1") });
        });
        //]]>
</script>

And that was not working i IE, but in FF and Safari, iPhone/iPad. And ended up with this, thats works 100% in FF, Safari, IE and iPhone/iPad...

<script type="text/javascript">
    //<![CDATA[
    $(document).ready(function () {

        $("#jquery_jplayer_1").jPlayer({
            ready: function () {
                $(this).jPlayer("setMedia", {        
                    mp4: "video/Soccer.mp4",
                    webmv: "video/Soccer.webm",  //WEBM. works for FF
                    flv: "../video/Soccer.flv",  //FLV. works for IE, but u need ../ in front of the path...
                    m4v: "video/Soccer.m4v",  //M4V. works for FF, Saf, iPhone/iPad
                    ogv: "video/Soccer.ogv",                   
                    poster: "video/Soccer.png"
                });
            },
            //error: function (event) {
               // console.log(event.jPlayer.error);
               // console.log(event.jPlayer.error.type);
            //},
            swfPath: "add/jplayer.swf",
            errorAlerts: true,
            supplied: "mp4, webmv, flv, m4v, ogv",
            solution: "html,flash",
            size: {
                width: "640px",
                height: "360px",
                cssClass: "jp-video-360p"
            },
            smoothPlayBar: true,
            keyEnabled: true
        });


        $("#jplayer_inspector").jPlayerInspector({ jPlayer: $("#jquery_jplayer_1") });
    });
    //]]>





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签