Search code examples
javascriptjqueryhtmlflashjplayer

How to set width and height to jPlayer


I am using jPlayer library but i don't know how to set width and height

My code is :

 $("#jquery_jplayer_1").jPlayer({
                    ready: function(){
                        $(this).jPlayer("setMedia", {
                            m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v"
                        }).jPlayer("play");
                    },
                    ended: function(event){
                        // $(this).jPlayer("play");
                    },
                    swfPath: "../../common/assets/jplayer/js",
                    supplied: "m4v"

                });

Please help me.


Solution

  • Untested, I think your code should look something like this:

     $("#jquery_jplayer_1").jPlayer({
                        ready: function(){
                            $(this).jPlayer("setMedia", {
                                m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v"
                            }).jPlayer("play");
                        },
                        ended: function(){
                             $(this).jPlayer("play");
                        },
                        swfPath: "../../common/assets/jplayer/js",
                        supplied: "m4v",
                        size: {
                             width: "400px",
                             height: "30px"
                        }
                    });
    

    I noticed that you were trying to loop the file? I changed the function call since it doesn't seem like you need the (event).

    You should read this: http://jplayer.org/latest/developer-guide/#jPlayer-size
    The sizes change according to the file types given.