My default height is 200px, but sometimes I have only 2-4 tracks and there is white space shows up.
arthurf, is it possible to automatically change playlists height depending on tracks quantity?

I'm printing player in node template like this:

  $params = array( 
    'type' => 'playlist',
    'width' => 200,
    'height' => 200,
    'allowfullscreen' => 'false',
  );
  $vars = array(
    'file' => xspf_playlist_url('xspf/node/'. $node->nid),
    'displaywidth'=>0,
    'shuffle' => 'false',
    'transition' => 'fade',
    'thumbsinplaylist' => 'false'
  );
print theme("swfobject_api", base_path() . path_to_theme() . '/flash/mediaplayer.swf', $params, $vars); 

ps. thank you for this module

CommentFileSizeAuthor
white space.jpg25.36 KBolegnaumov

Comments

olegnaumov’s picture

Assigned: olegnaumov » Unassigned
Priority: Critical » Normal

Sorry, changed priority to normal.

olegnaumov’s picture

Status: Active » Closed (fixed)

Wrong place

arthurf’s picture

Basically, you're going to have to figure out how many tracks there are and then adjust the height accordingly. You could get the track count by doing something like:

   $height = 200;
   $count = count(xspf_playlist_node_items($node)); 
   if ($count < 5 ) {
      $height = $count * 40;
   }

I'm not sure if this is the visual outcome that you want, but the concept should hold.

olegnaumov’s picture

Hey, arthurf! Thanks, you really helped me out.

This is how I've done it:

$count = count(xspf_playlist_node_items($node)); 
$height = $count * 25;

$params = array( 
 'type' => 'playlist',
 'width' => 200,
 'height' => $height,
);

$vars = array(
 'file' => xspf_playlist_url('xspf/node/'. $node->nid),
 'displaywidth'=>0,
 'shuffle' => 'false',
 'transition' => 'fade',
 'thumbsinplaylist' => 'false'
);
print theme("swfobject_api", base_path() . path_to_theme() . '/flash/mediaplayer.swf', $params, $vars);
olegnaumov’s picture

[edit] Double post, sorry

arthurf’s picture

You can actually do this now with views- if you look at the XSPF filter, you can set the number of items per node that the filter will return. This is a new feature that was written for the alpha release.

Glad the code helped though!