XSPF playlist generated by Views not working in flash player
| Project: | Audio |
| Version: | 5.x-2.x-dev |
| Component: | Views support |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
The recent developments in the audio module are really great! It seems to be just what I need for my site, but some things leave me confused. I've read several posts with similar issues, but no definitive and/or clear solutions to this (listed below). I am assuming (perhaps incorrectly) that the idea of assigning an audio node to another piece of content and therefore creating a playlist for it would be that at some point somewhere this playlist could be viewed and played as a unit. Obviously, the XSPF player is the one to be able to do this. Here is what I have done so far, what works and what doesn't:
1. I've created 4 mp3 audio nodes and assigned them to the same playlist (attached them to the same piece of content with Attach Audio Files and Audio Feeds both enabled). Ideally if the XSPF player is chosen as the default for playback of mp3 files the player should display all four audio files in one playlist in a single player window rather than four separate player windows with one file each (http://anthonymosakowski.com/node/6) which is what I currently have. If this is not the intended functionality of the module(s), then perhaps this could be made a feature request? It would be very elegant.
2. I've also tried to create my own view using the audio playlist views type. I managed to get more than one file to show up and play in the player, but not as expected. I have a page view defined as Type: Audio XSPF/M3U/PLS Playlist. I have filters for published=YES and Node Type is one of Audio. As far as I can tell this should provide a view which includes any audio I have on my site. So far I only have those 4 files. In the player view (http://anthonymosakowski.com/player) however I get only two files, and the second one is listed as "unspecified". Both files playback fine. Perhaps I've missed a step.
If anyone has any ideas, please pass them along.
Anthony
some similar threads: http://drupal.org/node/209562 http://drupal.org/node/181118 http://drupal.org/node/207000 http://drupal.org/node/200656

#1
Looks like you've figured it out, as the player on your site is displaying two songs in one extended player. Mind helping us out on this?
Also, I'd recommend that there be a 3rd option under 'audio settings > players' for which kind of player we'd like to use for the playlist. The reasoning being that I might want to use the extended player for playlists, but not for individual nodes.
#2
Changing title to reflect the combined issue, and pointing related issues to this one. It seems that the main issue is with the views generation of playlists, and the playlist is breaking, creating issues with the player.
Anthonym, for #1 you can create a one-player-for-all type functionality through the theme. See issue #139581. A patch to make this a configurable option would be great.
For #2, it sounds like the XSPF generated by the view is breaking. I'm not sure exactly why.
#3
Superkev07: At this time, the extended player is hardcoded as the default player for the views playlist. Changing the player in the audio settings will change the per-node player, but not the views generated player, so they aren't related. I agree it should be a configurable setting, I'll accept patches for that behavior.
#4
You're referring to the views bonus: audio playlist, right? I've got that module installed, but it doesn't show up as a view type. Is that what I'm supposed to be looking for? It doesn't appear that the JW MP3 Player required by the module is available anymore.
#5
No, I'm referring to audio_feeds.module that comes with 5.x-2.x-dev. The Views Bonus: audio playlist is a different module. The audio_feeds.module gives you a view type called Audio: XSPF/M3U/PLS in the dropdown.
#6
Aaaand, that explains it. Alright, I'd tried that and received this error on the page view:
user warning: Unknown column 'audio_metadata_track.value' in 'field list' query: SELECT node.nid, audio_metadata_track.value + 0 AS audio_metadata_track_value FROM node node WHERE (node.status = '1') AND (node.type IN ('audio')) ORDER BY audio_metadata_track_value ASC LIMIT 0, 10 in /home/heatwig7/public_html/includes/database.mysql.inc on line 172.#7
Update: Apparently it's because I tried to sort by track. Just deleted that option in the view, and I was fine.
#8
Sounds like you got the views part working. I'm going to mark this as fixed.
#9
After much head scratching and some troubleshooting I've managed to get a XSPF playlist feed view working with the extended player showing 4 audio files all listed and playable, but there are still some questions remaining.
I found the following: Audio files uploaded individually don't seem to appear correctly in the playlist feed view for the extended player. However, the same files when uploaded via ftp and then imported as a batch via the Audio import module do display correctly. So far I have done this with 4 files only, so I don't know what will happen with any additional files either uploaded individually or in a batch. My extended player view with the four files included can be found here: http://anthonymosakowski.com/player I've copied the output of the view export tab below in case it might be useful to anyone who knows how to decipher it.
One remaining question (for now) concerns the way the player lists the tracks. They are listed with a number and my name as the artist (they are my compositions) while in the the individual audio nodes, the tracks are listed in the player with the title (e.g. http://anthonymosakowski.com/node/24). Why the difference? I would prefer if the extended player in the feed view had tracks listed by title as well so they can be distinguished from one another. Right now they all look the same.
Also I'd like to reiterate my feature request for having multiple files appear automatically in an extended player for any node with an attached playlist (without having to resort to themeing which I haven't quite had the time to learn about yet). Anyone else think this is a good idea?
I changed the status of this issue back to active. Apologies if this is a breach of etiquette.
Anthony
$view = new stdClass();
$view->name = 'player';
$view->description = '';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'audio_feeds';
$view->url = 'player';
$view->use_pager = FALSE;
$view->nodes_per_page = '10';
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'audio_metadata_title',
'field' => 'value',
'label' => '',
'defaultsort' => 'ASC',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'audio',
),
),
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
);
$view->exposed_filter = array (
);
$view->requires = array(audio_metadata_title, node);
$views[$view->name] = $view;
#10
Hey,
I've gotten a couple of messages asking how I solved this problem. My answer isn't going to be very satisfactory, but it does end up being the easiest, most reliable way to get a playlist on your site.
Basically, I just downloaded the universal XSPF player (http://musicplayer.sourceforge.net/), configured it, and embedded the code in my site (can be done as a page block, a blog post, or even straight up in the html). As long as you upload your personal playlist (and, obviously, all of your preferred mp3 files) to the same directory as the XSPF player, it will work.
Of course, you have to update/change the songs by hand, which isn't nearly as neat as doing it dynamically from your Drupal admin tools, but if you're just looking to host the same songs for quite a while (like if you're a band) this method works like a charm. Details instructions for configuring and embedding the XSPF on your site (Drupal or otherwise) are here, or just search Google:
http://musicplayer.sourceforge.net/
#11
The trick for me seemed to be uploading files via ftp and then importing them as a group via Audio Import (Administer >> Content Management >> Audio Import). It would be good to have some other users confirm whether or not this actually makes the XSPF playlist "work" versus creating individual audio nodes. As I said above I haven't yet had the time to upload any additional files to see if they will appear in the the playlist or not, but I do still have questions about the way the files are displayed in the playlist/player? Anyone have any guesses on this? Am I missing some way to control exactly what information is displayed for each track in the XSPF extended player?
#12
I was able to test this a little more. I uploaded some additional files via ftp and then imported using Audio Import as described above. Happily, the second batch of files was correctly added to my XSPF player view. I don't want to mess with success and test to see if any individually uploaded files will do the same. I hope this helps people who have been having trouble with this. It is more of a workaround than a fix, but perhaps will provide some clues to make the playlist feed work correctly no matter what method is used for uploading audio files.
I still am not satisfied with the way the files are displayed in the player however. These are all my own compositions, so I am listed as the author on the tags. And the way the playlist feed is generated it seems to put the author information first. This might work well for some sites, but not for others. I found the following lines of code in the feeds.inc file which seem (to me) to control the order of the audio tags in the generated playlist feed.
$output .= '<trackList>';foreach ($items as $item) {
$output .= '<track>';
$output .= "<location>". check_plain($item['enclosure']['url']) ."</location>";
$output .= "<creator>". check_plain($item['author']) ."</creator>";
$output .= "<album>". check_plain($item['album']) ."</album>";
$output .= "<title>". check_plain($item['title']) ."</title>";
$annotation = $item['author'] ? $item['author'] ." - ". $item['title'] : $item['title'];
$output .= "<annotation>". check_plain($annotation) ."</annotation>";
$output .= "<duration>". check_plain($item['duration']) ."</duration>";
$output .= "<image>". check_plain($item['image']['url']) ."</image>";
$output .= "<info>". check_plain($item['link']) ."</info>";
$output .= '</track>';
I don't know want to mess with this and break anything, but would it be possible to make the order of the tags in the playlist info customizable, perhaps in a views tab or somewhere else? If not, maybe someone could guide me on how to safely alter the code to get what I need: just a listing of title, no author.
#13
Hey Anthonym,
I haven't had a chance to work on this lately, but would accept any patches to make this setting configurable. You are right that feeds.inc is responsible for the way the title displays. The reason it displays this way is because the XSPF player uses the annotation variable to set the visible title for each track. On the XSPF player website you can see that they have set the annotation to display as ARTIST - TITLE and I just assumed this to be the best practice for this player.
If you wish to manually change this, you can modify feeds.inc to display what you want. On line 73 of feeds.inc you can change annotation to simply be the title.
BEFORE:
$annotation = $item['author'] ? $item['author'] ." - ". $item['title'] : $item['title'];AFTER:
$annotation = $item['title'];It'd be better if no code hacking was needed, though. Perhaps it could be a theme function that could be overridden.
#14
Thanks Zirafa,
I was reluctant to hack the code, but when I have some time I will experiment with it. I agree that some sort of theme override would be good. Patching and theming is a little out of my element at the moment. I'll report back on what success I have.
Anthony
#15
anthonym, thanks for the exported view.... I've been banging of the wall too for some time now to get all audio nodes to show in one flash player and that saved my day...again, much thanks
#16
perke,
Glad my post helped you solve your issue.
Anthony
#17
Zirafa,
I changed the code in feeds.inc as suggested, but the XSPF player is still not displaying my tracks by title. The really weird thing is that I checked the xspf feed file being generated (by viewing the source of the xspf link in my browser) and the annotation tag did change to just the title after changing that line of code. Could there be something else feeding this information to the player? I cleared the views cache just in case this might have been the culprit, but that didn't seem to have any effect. Any ideas?
Anthony
#18
Zirafa,
I'm still fiddling with things to present my audio just the way I want it. As reported above, the change I made to feeds.inc had no effect on the display of tracks in the player. After a little digging online, I found the following on the Lacy Morrow website (http://lacymorrow.com/projects/xspfwmp/xspfdoc.html)
It seems that the web player is overriding the annotation tag and choosing to display a combination of creator and title instead. So, for my purposes I commented out the
<creator>tag definition line in feeds.inc. This is probably far from ideal, but I don't know if anything else can be done about it.#19
I am having the same problem as the title of this post rather than the display of the mp3 display issue now in motion.
the need is for xspf playlists to work in views. I am sorting by album and want to generate a playlist of that album, I can get the view to work with : entire node and feeds and everything except xspf playlists. The view I get is a non populated empty playlist with my site info only for Title.
Do I have it installed correctly, hardly any info from the developer on that?
Are there any specific filters or sorts to add?
Why won't views show me a playlist with files in it?
#20
stuffnthings: I just posted an issue about this and I found that if I had clean urls disabled on the site, then no tracks would load in the views created playlists.
you could try turning those off and on to see if that has any effect on the playlists.
also sorry if I posted a duplicate.. didn't find this one, and it seemed like the issue was solved..
#21
manimal: thanx for your input but that is not the fix, however you are on the right track. I do have bad characters breaking feeds. I tried a feed.inc patch with no success from http://drupal.org/node/212913#comment-746871 and could not get that to work, so I am still on the hunt for the ever elusive bad character display holy grail fix.
Still no tracks on the track list.
#22
When clicking on any of the fee links I'm getting this error:
Fatal error: Cannot use object of type stdClass as array in /home/sagreene/public_html/drupal_samgreene/modules/audio/contrib/feeds/audio_feeds_views.inc on line 72
I also have an empty player.
Thanks for any help.
#23
I went into the php and changed
'duration' => $audio->audio_file['playtime'],
to
'duration' => '0',
which makes me think that the playtime field is wrong...and yes, it does not exist in the audio_file table.
Have I messed up my installation somehow?
I had the stable audio version first and then replaced the folder with the -dev version with feeds. The modules showed up, but the main audio module still shows the old version - Audio 5.x-1.4
Thanks!