Search code examples
jplayer

jPlayer problem with local files


when i try to play files that are located on my server jPlayer does not playing. but if i link to the demo files in jPlayer server it's working fine. for example:

//this is working fine! 
<script type="text/javascript"> 
//<![CDATA[ 
$(document).ready(function(){ 
        new jPlayerPlaylist({ 
                jPlayer: "#jquery_jplayer_1", 
                cssSelectorAncestor: "#jp_container_1" 
        }, [ 
                { 
                        title:"Cro Magnon Man", 
                        artist:"The Stark Palace", 
                        mp3:"http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3", 
                        oga:"http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg", 
                        poster: "http://www.jplayer.org/audio/poster/ 
The_Stark_Palace_640x360.png" 
                } 
        ], { 
                swfPath: "js", 
                supplied: "webmv, ogv, m4v, oga, mp3" 
        }); 
}); 

//]]> 
</script> 

but the same code with files that located on my server is not working:

<script type="text/javascript"> 
//<![CDATA[ 
$(document).ready(function(){ 
        new jPlayerPlaylist({ 
                jPlayer: "#jquery_jplayer_1", 
                cssSelectorAncestor: "#jp_container_1" 
        }, [ 
                { 
                        title:"Cro Magnon Man", 
                        artist:"The Stark Palace", 
                        mp3:"http://www.myDomain/audio/mp3/TSP-01-Cro_magnon_man.mp3", 
                        oga:"http://www.myDomain/audio/ogg/TSP-01-Cro_magnon_man.ogg", 
                        poster: "http://www.myDomain/audio/poster/ 
The_Stark_Palace_640x360.png" 
                } 
        ], { 
                swfPath: "js", 
                supplied: "webmv, ogv, m4v, oga, mp3" 
        }); 
}); 

//]]> 
</script> 

just to be clear i have copied the same exact files from jPlayer demo to my server. any ideas?


Solution

  • The problem was with server MIME types. I had to add custom MIME types to support the type of media.