Welcome Guest, Not a member yet? Register   Sign In
Error with jPlayer inside a view
#1

[eluser]Unknown[/eluser]
Hello, I'm trying to use jPlayer inside a view but I get that error from firebug:

Code:
TypeError: $("#jquery_jplayer_1").jPlayer is not a function

However, if the code is stored on server's home all is working correctly (so I think that is a problem with CI).

Thats the code:

Code:
<sscript type="text/javascript" src="/js/jquery-latest.min.js"></sscript>
<sscript type="text/javascript" src="/js/jquery.jplayer.min.js"></sscript>
<sscript type="text/javascript">
    $(document).ready(function(){
     $("#jquery_jplayer_1").jPlayer( {
      ready: function () {
       $(this).jPlayer("setMedia", {
        m4v: "/videos/video.mp4",
        webmv: "/videos/video.webm"
       }).jPlayer("play"); // Attempts to Auto-Play the media
      },
      solution: "html, flash", // Flash with an HTML5 fallback.
      supplied: "m4v, webmv",
      swfPath: "/js"
     });
    });
</sscript>

<div id="jquery_jplayer_1"></div>

Note that really "sscript" is "script".

Any ideas?

Thanks
#2

[eluser]Mr. Pickle[/eluser]
Is the jPlayer working?
Because it can be that FireBug is wrong Wink

If not:
Are you sure the paths to the JavaScripts are correct?
>> e.g. no base href's that are there (or not there) to make it not work via a CI url.
#3

[eluser]Unknown[/eluser]
Thanks, but jPlayer is working correctly if I put the code on server root. The problem is when the code is placed on /application/views, inside CI. The paths are right because i can access .js files through their urls.




Theme © iAndrew 2016 - Forum software by © MyBB