Jplayer player is always displayed even if there's no file field with jplayer formatter attached to the node.

I made a patch to disable jplayer in that case (no jplayer javascript link and no jplayer html). I only made it for the nodes I don't know if it has to be done for views.

Comments

MrVictor’s picture

This is good!

patrickroma’s picture

Did you try it? Does it work?

sbogner@insightcp.com’s picture

I applied this patch and it did not work for me - it appears nothing changed in the display. See www.insightcp.com/blog for an example.

patrickroma’s picture

Yeah, the same goes for me... Actually the patch doesnt change that much Code... Somebody ideas for a working Version?

hansrossel’s picture

Category: feature » bug

This is rather a bug

ermannob’s picture

It works. Thanks!

sbogner@insightcp.com’s picture

@ermannob - glad this worked for you, but it still doesn't work for me.

blazey’s picture

Status: Active » Needs review
StatusFileSize
new2.31 KB

This one should work

sbogner@insightcp.com’s picture

Thanks blazey - I tried applying the patch and got a bit of an error:

modules/jplayer # patch -p0 < jplayer-6.x-beta2-907000.patch
(Stripping trailing CRs from patch.)
patching file includes/jplayer.theme.inc
(Stripping trailing CRs from patch.)
patching file theme/jplayer.tpl.php
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 71: 

I reinstalled the latest version of jplayer prior to the patch.

Having said that, you can see the results on my site at http://www.insightcp.com/blog . For a blog entry without an MP3 file, take a look at http://www.insightcp.com/blog/catching-how-new-hr-systems-work

It's different now, but it seems that jplayer is still displaying when there is no MP3 file.

*** Update: I manually added the changes to jplayer.tpl.php and that didn't seem to change anything.

sbogner@insightcp.com’s picture

There might have been some caching problems, because the next day everything appeared to be working fine after applying the changes manually (the patch for some reason didn't update everything). So the changes work, but the patch didn't apply completely.

Grifforg’s picture

It's a pity because I would like to use this html5 module instead of Flash to display sound files in some of my nodes. I tried the patches and it was impossible for me to make them apply. Hope for a solution.

Grifforg’s picture

As sbogner I had the same error message and I made the changes to jplayer.tpl.php manually. It works. No player when the field is empty. Anyway impossible for me to manage the player to display in list mode. I can live with it but I hope for an update :-) One could set the player to multifile player and the player be displayed as a one file one if there is only one file uploaded. Anyway, it's still a work in progress…

zacho’s picture

I also manually applied that patch.
Same as previous poster: it works for single files, but it seems to break the playlist version (which always stops showing).

mandclu’s picture

Subscribing. I'm having the same issue with the player displaying even with no audio.

I notice that some of the changes apply specifically to the playlist functions, has anyone tried selectively applying the changes in the patch at #8 to see if that works?

mandclu’s picture

FWIW, I've been able to temporarily solve my issue in the theme layer by making the following change to a specialized implementation of content-field.tpl.php (called, in my case "content-field-field_showaudio.tpl.php") on line 36.

Change:

      if (!$item['empty']]) : 

To:


      if (!$item['empty'] && $item['fid']) : 

Works perfectly for my needs. From a purist perspective it still leaves the field wrapper markup when there's no audio to display (which isn't really needed) but this solved the most critical part of the issue.

We still need a fix for the actual logic, though. $field_empty should be true if a file hasn't been chosen.

blazey’s picture

This issue is fixed in beta3. Let us know if it works for your sites

sbogner@insightcp.com’s picture

beta3 fixed it for me. I had to do 2 things though - 1) after applying the update, clear the site's cache, and 2) check to make sure that you still have jplayer set for the custom file-field in your content type - mine got reset to 'Generic Files' for some reason.

linoleum’s picture

exactly the same as #17 with the same issue

blazey’s picture

Status: Needs review » Closed (fixed)
Grifforg’s picture

Same thing for me (#17). It should be written in the Read me to take care of it because I couldn't get back the players in my pages and was to reinstall the previous set because after a long time I didn't know how to fix it. Thanks to these comments. But I wasted a little time and with a few lines in the Read me I had not.

rszrama’s picture

Version: 6.x-1.0-beta2 » 6.x-1.0-beta3
Status: Closed (fixed) » Needs work

EDIT: Ugh, my code is way outdated. :-/

rszrama’s picture

Status: Needs work » Closed (fixed)
rschletty’s picture

Title: Jplayer player is always displaid in the node even if there's no audio » Jplayer player is always displayed in the node even if there's no audio
Issue summary: View changes