I followed the directions in the README and created a file field with display format jPlayer. The field displays as a player but nothing happens when I click on any of the buttons. (I tried it in Firefox & Chrome on my Mac.) The audio file plays when I visit the URL of the mp3 file directly. Has anyone else had this behavior?

I tried it with the current (2.1.0) and previous (2.0.0) versions of the jPlayer library. I tried futzing with the display format settings but still can't get it to play.

I must have done something wrong. Has anyone gotten a simple, single instance mp3 field to play with this combination?

CommentFileSizeAuthor
#29 jplayer-wont-play-1289016.patch653 bytesdavidneedham
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeremyluby’s picture

I am having the same issue! I see the player, but nothing happens regardless of browser.

tresero’s picture

I also see the same problem.

piwchix’s picture

Same here

jh3’s picture

It seems that jplayer.js is loaded before every other script (i.e., jquery.js), in my case anyway. You can confirm this by checking the console tab in Firebug on a page with jplayer. If jplayer.js is loaded before jQuery you should see an error that says "jQuery is not defined."

If this is everyones problem, it can quickly be fixed by removing the scope key-value pair on line 484 of jplayer.module. For me, this made jplayer load after jquery.js, jquery.once.js, and drupal.js.

I have also moved the scripts variable to the bottom of my page template so I am not completely sure if this will resolve everyones problem. I am pretty certain it's a weight issue, though. See http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ad... for more on how Drupal handles the order in which it adds javascript files to a page. I am guessing the scope is set to footer because the module assumes your scripts variable is in the tag of your page template.

For example, you would want to go from this:

/* .. snip .. */
'js' => array(
  drupal_get_path('module', 'jplayer') . '/theme/jplayer.js' => array('type' => 'file', 'scope' => 'footer', 'group' => JS_DEFAULT),
),
/* .. snip .. */

to this:

/* .. snip .. */
'js' => array(
  drupal_get_path('module', 'jplayer') . '/theme/jplayer.js' => array('type' => 'file', 'group' => JS_DEFAULT),
),
/* .. snip .. */
DanishK’s picture

and how do you solve this for Drupal 6? I have the same problem but for D6.

dddave’s picture

Priority: Normal » Critical

This is a critical bug.

mostoneskin’s picture

I'm getting this too, on 7.8.

clcanela’s picture

I can confirm ejh3 solution, this is indeed a scope problem, actually my error said: "Cannot read property 'timeFormat' of undefined" and moving the attached js from the footer actually worked (at least for a single player/single song)

Note: I downloaded the jPlayer 2.0 library, haven't reverted to the newest 2.1 library

mostoneskin’s picture

I can also confirm that this worked for me. Thanks ejh3. Not sure I understand what the long-term solution is (new to Drupal)?

aasarava’s picture

For Drupal 6, make sure you are using jPlayer 1.2, not 2.0 or later.

rlmumford’s picture

I have this issue on drupal 7.8, not getting any script errors though and the jplayer library is definately getting included after drupal.js, jquery.js and jquery.once.js

Also, I've tried the solution above : still no luck.

rlmumford’s picture

Update, I only seem to have this problem on firefox. It might be a filetype thing.

Update: Not working in firefox with ogg either.

wheatpenny’s picture

I tested this module on a local site, and I took a look at the Lullabot podcasts. I'm on Ubuntu, and I'm using Chromium and Firefox out of the Ubuntu repos. On both the local site and on http://www.lullabot.com/podcasts/lullabot-podcast-99-drupalizeme-1-year-..., the player worked in Firefox, but nothing played in Chromium.

obstikle’s picture

For Drupal 6, this issue might be more relevant #1298126: Missing play command for single-file player

czigor’s picture

I would like to use this for playing mp3 files.
I can see the player both in Firefox and Chromium. When I click the play button, it changes to the pause sign for half a second then back to the play sign. The play does not start. I tried it with both the single and the playlist mode.

czigor’s picture

Changing the formatter setting from HTML5 to Flash has solved it for me.

ronny89’s picture

in my case it plays mp3 in firefox and neither mp3 nor ogg in chromium.
the firebug-console doesn't show any message. :-/

edit:
using Flash let's jplayer play mp3s in chromium

i also found out, that some mp3-files are played while others are not.

rayvan’s picture

Try using jPlayer v1.3

D2ev’s picture

i have the same problem #15.... in jplayer support i found

You disabled caching of the media using the media's server response. This causes the duration to be unknown. If you cannot correct the server response, an alternative solution is to use {solution:"flash,html"} 

like @czigor changing the formatter setting from HTML5 to Flash work for me.

sbree’s picture

I had a similar problem but with single view and a video.

The problem was in the use of Drupal.settings passed to jQuery.extend.
I started listen error event at iniatilisation of jplayer instance (need to be placed just before the initialisation in jplayer.js):

          $(player).bind($.jPlayer.event.error, function(event) { // Using ".myProject" namespace
            alert("Error Event: type = " + event.jPlayer.error.type + "\n" + event.jPlayer.error.message); // The actual error code string. Eg., "e_url" for $.jPlayer.error.URL error.
            switch(event.jPlayer.error.type) {
            case $.jPlayer.error.URL:
              alert(event.jPlayer.error); // A function you might create to report the broken link to a server log.
              //getNextMedia(); // A function you might create to move on to the next media item when an error occurs.
              break;
            case $.jPlayer.error.NO_SOLUTION:
              // Do something
              break;
            case $.jPlayer.error.NO_SUPPORT:
              // Do something
              alert(dump(playerSettings.files));
              break;
            }
          });

(this code is provided by jplayer.org... I only add some strings and function calls)

It returned error about variable passed to setMedia
How playerSettings.files looks in jQuery.extend:
{"m4v":"video.m4v"}
What jplayer seems wanting:
{m4v:"video.m4v"}

So, I wrote a function which rewrite playerSettings.files passed to jplayer's "setMedia" method:

function toStdObject(arr,n) {
  if(n == null || n == undefined) tmp = { }; else tmp = n;
  if(typeof(arr) == 'object') { //Array/Hashes/Objects 
    for(var item in arr) {
      var value = arr[item];
      
      if(typeof(value) != 'object') {
        eval('tmp.'+item+" = \"" + value + "\";");
      } else {//If it is an array or something else,
        toStdObject(value,tmp);
      }
    }
  }
  return tmp;
}

And modified the script jplayer.js this way:

...
          $(player).jPlayer({
            ready: function() {
              playerSettings.files = toStdObject(playerSettings.files);
              $(this).jPlayer("setMedia", playerSettings.files);
...

not sure that's secure, with the use of eval method... and it may be optimised. But it works...
I also rewrite jplayer.tpl.php where you can find this : <div class="jp-type-playlist"> become <div class="jp-type-<?php print $mode; ?>">, javascript pending "jp-type-single" for single views.

PS: Sorry for my poor english (that's not Google translation!)

deviantintegral’s picture

It seems like there's a few issues being discussed here. Something to keep in mind when testing is that some browsers (especially on Linux) won't have MP3 support by default due to patent issues. Make sure that you can actually play an MP3 in the browser and that you have any additional required packages installed (such as gstreamer codecs).

Regarding the script order in #4, I'm not sure that's actually a problem with this module. On a default D7 site the script is added in the footer and it works fine. jQuery is added in the head, so it will always be processed before the jPlayer JS in the body. I wonder if your jQuery library is being added in the body instead of the head.

russellb’s picture

I'm seeing a 'won't play' problem in Firefox 3.6.27 Windows with mp3s. On page load the play button doesn't work. If I click on the download link below the clip plays in QT for me. After that if I go back in the browser I see a little square by the download link, and the HTML 5 play button is working.

My test site here is Drupal 7, Media 7.x-2.0-unstable3

Problem observed on Firefox 3.6.27 under Windows 7. It works for me first time all fine in Internet Explorer 8 on Win7 and on the mac in Firefox 10 and Safari 5 so I guess it's an old Firefox issue.

russellb’s picture

Update:

I've upgraded the Firefox in question on Windows 7 here to latest (10.0.2) and the problem looks to have gone away, so this looks very much like an old Firefox issue. We are only seeing the problem in latest firefox on Windows 2000 now so that is fine.

onehandsomedog’s picture

Player not working in firefox 11.0 or earlier, IE 8, Opera 11.6, & Chrome is off and on. Safari works everytime ;) This is true on mac os 10.6 and windows 7

amontero’s picture

For the record, jPlayer was working OK for me until recently when I updated Flash player. Downgrading Flash plugin made it work again.
HTML5 mode is unaffected.

amontero’s picture

Replying to myself, with my problem's cause:
Adobe Flash 11.2 broke FLV playing. See https://bugbase.adobe.com/index.cfm?event=bug&id=3157899
Also, for the record :)

deviantintegral’s picture

Status: Active » Closed (won't fix)

Sounds like we'll just have to wait for Adobe to fix this. I'm marking this issue as closed since there's no changes required in the jPlayer module code.

christophrumpel’s picture

I also have the problem, thtat the controls does not work and i cannot play the songs, only if i click the titles then they are played in a new window by the browser.
I am trying to follow the approach in #4 but i do not know where to try to add the JS file. My jplayer.js is also loading before the jquery js. Can someone help me what i exactyl have to write and where?
That would be great!
thx

davidneedham’s picture

Status: Closed (won't fix) » Needs review
FileSize
653 bytes

I can confirm that this bug still exists in osx with the latest chrome and firefox. Clicking the play button makes it flash for a second, but nothing happens. I followed the steps in #4 above and made a patch. Like him, I'm not sure if this is the best "fix", but it makes it work for me.

fwiw, @christophrumpel, the file to change is jplayer.module

micnap’s picture

Patch didn't work for me. No change.

Mickey

i_rice’s picture

Hi, just the same situation.

Thanks for patch! it really works)
patch help me only in Chrome, but in FF still jPlayer is not working. Can it be that FF loads js files differently from Chrome?

glamdring’s picture

If you are having an issue where it starts and stops again in the flash fallback mode, but it loads properly in IE try renaming the file. In FF, Chrome, and Opera audio files with odd names containing things like - would not play. After I renamed this file it loaded perfectly in flash fall back.

bentleychan’s picture

My observations: In Windows 7 SP1, jPlayer works in IE9, Chrome 24.0, and Safari 5.1.7, but not in Opera 12.02 and Firefox 18.02. For tablets, jPlayer works on my iPad 3 (both Safari and Chrome), but does not work on my HP TouchPad.
Note: The above observations apply to my website in a remote server. If I test jPlayer with my localhost server, both Opera and Firefox work, i.e. all my five browsers will work with jplayer in localhost.

pradeep22saini’s picture

My issues with jplayer:
windows: In Internet Explorer7,8,9 a link to download appears.
Mac: works only on chrome but on safari browser "player on play button click it's icon changes but songs doesn't play" and in firefox it redirects me to url of the song and play it in new tab.
Touch pad : it also gives the link to download.
linux: it works fine in linux browsers opera firefox and chrome.
I applied all patch and done the modification but didn't find a satisfactory solution. Can any body help me regarding issues in windows and mac. Thanks in advance.

pradeep22saini’s picture

it was an flash palyer issue and worked when flash player is installed.

Mohva’s picture

Best response, work perfectly for me @sbree #41

davidneedham’s picture

Status: Needs review » Reviewed & tested by the community

I just applied my patch from #29 on a different website and it fixed this problem again.

This still doesn't seem like the right solution... anyone care to suggest something else or RTBC so at least this module will function as downloaded without patching?

heyehren’s picture

I'm having the same problem. Both HTML5 and Flash option are not working in Safari and FF.

I have applied the change described in #4, and downgraded jPlayer from the latest version 2.4.0 to 2.0.0. Now it's working in Safari and Chrome, but not Firefox.

Play button doesn't work, and clicking on the media file name in a playlist brings me to the media file. Any help would be greatly appreciated.

spgd01’s picture

I found that MP3 works in FF and IE 10 but other file formats and IE 8 and 9 are problematic.

Vemma-1’s picture

Got it to finally work using FF 25.0.1 while having to use Player V. 2.0.0. Scared to update my FF now.

jathoo’s picture

had the problem and mine was a silly mistake ,

we have to use the player 2.0 library , and jquery.jplayer.min.js and Jplayer.swf must be in the root folder (she be in - sites/all/libraries/jplayer)

and now its working on all the browsers . just need some skinning to do

hope it may help someone :)

nateB’s picture

Issue summary: View changes

Other folks with the jQuery Update module may run into this issue, so let me say that I had to limit the jQuery version to 1.8 to keep the player playing.

jQuery versions 1.9 and 1.10 broke the jplayer.

markie’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Please update to the latest dev. the function mentioned in the above patch no longer exists. If all looks well I will be pushing a new full release.

guidot’s picture

Status: Postponed (maintainer needs more info) » Active

Does not play an mp3 with dev from 2015-Mar-08, jPlayer 2.9.2, firefox 36.0 on Linux. If I switch to Generic file format firefox plays it.

rivimey’s picture

@hylid: I too fount jQ > 1.8 to be a problem (and not just for this module but eg views_ticker too).

@guidot: is it all mp3 files that don't play, or just a specific one? Can you play any other format file (e.g. ogg)?

@markie, @deviantintegral could this thread be addressed best with an FAQ section on the project page or in other docs? For example:

Q: Player is not visible onscreen
A1: is the widget type for the field set to 'jPlayer'? If in doubt, check the html for the page includes elements with classes such as jp-audio or jp-playlist in the expected area).
A2: has the jplayer module's CSS been included on the page?
A3: has the jPlayer JS been included on the page?

Q: Player apparently there but is completely unresponsive (no JS events attached to controls)
A1: check to see that JavaScript enabled on your browser
A2: Check that you are not relying on a version of Flash being installed that isn't present or is too old.
[ I found you needed Flash >= v10 for the supplied jplayer.swf ... is that a known issue? ]]
A3: check you are using jQuery >= 1.4 and jQuery <= 1.8; could jQuery Update have switched the site to v1.9 or v2.0?

Q: Player active (JS events applied, buttons respond when clicked), but won't play
A1: Check that the browser and platform you're testing with is able to play the files you're giving it when given a direct link. For example, some Linux-based platforms have no support for mp3 file playback out of the box.
A2: something about supported file extensions / file formats ... ?

Q: Which versions of the jPlayer library are known to work with the module?
A1: The Drupal 6 jplayer module only supports jPlayer version 1; version 2 is not compatible.
A2: The Drupal 7 jplayer module supports jPlayer versions 2.0 to [[ 2.9? not sure ]]

Note: in the above, "jPlayer" refers to the main jplayer.org javascript library, while "jplayer" refers to the Drupal module.

Swarnendu-Dutta’s picture

i had the same issue multiple time and #4 worked for me.

samheuck’s picture

'jQuery is not defined' was the issue for me as well. However, I didn't want to hack the jPlayer contrib module, so I used hook_js_alter():

in template.php (or in some custom module if you prefer)

/**
 * Implements hook_js_alter().
 */
function yourtheme_js_alter(&$js) {
  if (array_key_exists('sites/all/modules/contrib/jplayer/theme/jplayer.js', $js)) {
    // 'header' is the default for Drupal 7
    $js['sites/all/modules/contrib/jplayer/theme/jplayer.js']['scope'] = 'header';
  }
}

  • markie committed 7076b09 on 7.x-2.x
    Issue #1289016 by davidneedham: Player doesn't play
    
    Updated FAQ as...
markie’s picture

Status: Active » Needs review

@rivimey I updated the README.txt in the latest dev branch with an FAQ as suggested. Thanks for that. Please let me know if you have any questions about the... err questions.. Since Drupal6 support is going away soon, I will not be addressing the D6 version anymore. If no complaints are heard soon, I'll be creating a full release.

markie’s picture

Status: Needs review » Closed (outdated)

Closing issue as 7.x-2.0 has been released. Please open any new issues against that.