footy
footy

Reputation: 5911

Why is the jplayer not playing song

Here is my jplayer code

<div id="player"></div>

Javascript:

$("#player").jPlayer( {
    ready: function () {
      $(this).jPlayer("setMedia", {
        mp3: '/bedupako/songs_related/uploads/1.mp3' // Defines the url
      }).jPlayer("play"); // Attempts to Auto-Play the media
    },
    supplied: "mp3",
    swfPath: "js"
  });

and i am sure that my mp3 path is correct, also i am sure of the swfpath too. So why my song being not played?

EDIT:

Ok now i just got frstrated and just did this. I got the DEMO jPlayer, the simple circle and just uploaded it on my site. With only the following changes:

circle.player.js got the following changes

solution: "html", // I want only HTML5 playback, NO FLASH
supplied: "mp3",

in Index.php. I removed the second players and then changed the constructor of one of them to the following

var myCirclePlayer = new CirclePlayer("#jquery_jplayer_1",
            {
                mp3: "http://bedupako.com/songs_related/uploads/40.mp3"
            }, {
                cssSelectorAncestor: "#cp_container_1"
            });

And the live link is here. I am specifically using HTML5 player as i need that. (In Opera and firefox, chrome played my song; havent tried in IE, but honestly i dont care about IE anyway :P cos there is always some problem with it -_-) please disable your flash plugin before playing it

Upvotes: 2

Views: 4929

Answers (4)

Lloyd
Lloyd

Reputation: 8396

Neither Firefox nor Opera support the MP3 format in HTML 5 Audio, only WEBMA and OGA:

HTML5 browsers and their supported audio file formats:

Firefox (OSX, Win): WEBMA, OGA
Safari (OSX, Win): MP3, M4A
Mobile Safari iOS4 (iPad, iPhone, iPod): MP3, M4A
Opera (OSX, Win): WEBMA, OGA
Chrome (OSX, Win): WEBMA, OGA, MP3, M4A
IE9 (Win): MP3, M4A (Can install the WebM codec.)

taken from http://www.jplayer.org/latest/developer-guide/#reference-html5-audio-format

Upvotes: 5

Vigrond
Vigrond

Reputation: 8198

I wrote a short example, describing the code and directory structure on my blog here: http://vigrond.com/blog/2011/12/01/invisible-html5-flash-audio-player-using-jplayer/ (Click the link to the example)

Hopefully you can compare your code to this and see the problem.

It is hard to say what is causing the problem without a live test page.

Upvotes: 1

Lloyd
Lloyd

Reputation: 8396

do you get any error or warning alerts if you add the following two constructor options?

$("#player").jPlayer( {
    ready: function () {
      $(this).jPlayer("setMedia", {
        mp3: '/bedupako/songs_related/uploads/1.mp3' // Defines the url
      }).jPlayer("play"); // Attempts to Auto-Play the media
    },
    supplied: "mp3",
    swfPath: "js",
    errorAlerts: true,
    warningAlerts: true
  });

Upvotes: 2

dovydasm
dovydasm

Reputation: 63

Have you tried using an absolute path for your mp3 file?

Upvotes: 0

Related Questions