When using the jPlayer display format in a view that gets a file entity field from nodes, the player is rendered with an empty playlist.

Steps to reproduce:

* Create a node type with a file field, using file entity "audio"
* Generate content
* Create a view with the jPlayer display format
* Use Fields-Display
* Select the file field with the audio file from the node and render it as "URL to file"
* Select the file field under the jPlayer display format settings as "File path field"

Now you should see a player with an empty playlist.

What I would expect:

* All files from the view result rows are in the playlist.
* If they are not found / not playable / playlist is empty, the player should not be shown.

What I found out about it / idea for a fix:

While debugging jplayer_style_plugin.inc I found out that there were view results, but the $filepath variable wasn't successfully set in line 109. The Problem seems to be that $fields[$field_name]->field_alias is used, which always returns "nid" (see #1160706). So from this point on instead of the filepath we have the node id and pass that through file_create_url, which of course cannot build a file path from that and returns "your_base_url/your_nid".

Because the jplayer_sort_files function in jplayer.theme.inc then cannot find out which type of file this should be, it removes them.

This explains why the player gets rendered (view with results) but has an empty playlist (in rendering the files don't pass through to the theme).

I fixed it with a little patch that checks if there is an entity object of the node in the views result and tries to get the uri of the field from there.

Reviews, correction, feedback and ideas welcome.

Comments

fisherman90 created an issue. See original summary.

fisherman90’s picture

StatusFileSize
new1.02 KB
fisherman90’s picture

Issue summary: View changes