Pass thumbnails to media players

Stuart Greenfield - May 1, 2009 - 18:37
Project:SWF Tools
Version:6.x-2.5
Component:User Interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I've opened this thread in place of this one since that posted to a fixed issue, and one that was different to this.

How do you setup the Display Fields so that the an image that has been uploaded using FileField can be pass the thumbnail to the JW Media Player 4?

I've got the FLV and skin working great, but can't seem to pass the thumbnail correctly.

There was also a screenshot with that post.

#1

Stuart Greenfield - May 1, 2009 - 18:44

If I read your screenshot right you have created two filefields? The first one "Video source" is intended to be the video, while the second "Video Thumbnail" you'd like to be the video thumbs?

I can see this being an issue / common request now we have the FileField formatter in place.

However, it was a (periodically) recurring question for input filters and swf() calls too.

I think I'd like to propose a different solution - to make SWF Tools "intelligent" when it comes to playlists that are mixtures of images and video and/or audio.

I think it would be fairly easy to make a default behavior that if a playlist starts with an image, or alternates image/{video|audio}/image/{video|audio} then we assume the images are thumbs, and construct the playlist accordingly.

This could be toggled on the settings page in case you really do want a mixed media list, but I'd imagine this would be the preferred behavior in >90% of cases.

Then you only need one filefield, and SWF Tools doesn't need to work out which is the "source" and which is the "thumb" (this matters for FileField as each element would be rendered separately, so linking the two would be complicated).

Using the "single field" approach you simply build the list as a single sequence of files.

Would that work for you?

#2

jreashor - May 7, 2009 - 17:31

I was able to achieve this with a template file.

1. Create a content type "video" with a field for your thumb - "video_thumb", and one for your flv - "video".
2. Copy the "content-field.tpl.php" template from the CCK theme folder into your theme folder.
3. Make a duplicate of "content-field.tpl.php" and rename it "content-field-field_video-video.tpl.php", so it will only apply to the FLV field within the video content type.
4. Within this new template, replace the line

<?php
print $item['view']
?>
with
<?php
print swf($item['filepath'], array('flashvars' => array('image' => $node->field_video_thumb['0']['filename'])))
?>

When setting up your content type, under the display setting for your fields, be sure to hide the thumbnail from being displayed.

And done :)

#3

gwen - June 3, 2009 - 15:01

I attempted to use the solution described in comment 2 above and couldn't get it working. After some digging, I discovered it was happening b/c I needed to pass the thumbnail into "othervars" rather than "flashvars". So rather than this:

1 <?php
2  
print swf(
3     $item['filepath'],
4     array(
5       'flashvars' => array('image' => $node->field_video_thumb['0']['filename'])
6     )
7   );
8 ?>

I did something like this (changes on line 5):

1 <?php
2  
print swf(
3     $item['filepath'],
4     array(
5       'othervars' => array('image' => $node->field_video_thumb['0']['filename'])
6     )
7   );
8 ?>

Not sure if this is a versioning issue with flowplayer, but I'm using flowplayer 3.1.1 so if the code in comment 2 doesn't work for you, try what I described above.

#4

djudd - June 8, 2009 - 17:44

This is a pretty cool solution. I have two questions that hopefully someone can clarify for me...

First, I'm not very good with PHP at all.Is there a way to upload the image file, pass it on to the video as a thumb, and then not have the image repeat below it? I'm getting the image showing up in the node as well below the video.

Second, is there a way to pass additional arguments to the player from here? For example, is there a way to pass along height and width arguments as well? Probably not, but I thought I'd ask.

#5

heywetried - June 24, 2009 - 22:49

I'm trying to get this to work, and I'm running into trouble getting my theme to recognize my customized tpl.php file, which is "content-field-field_project_video-project.tpl.php" (field: project_video, type: project). No matter how I edit it (even if I make it an empty file), the display doesn't change. I know 100% that I have the filename correct. Any advice?

EDIT: Ug... I had to put a copy of the original "content-field.tpl.php" file in my theme folder, too. All is well... Thanks for the solution, BTW!

#6

marie70 - October 28, 2009 - 22:58

I was able to change the height and width of the player like this:

<?php
print swf($item['filepath'], array('params' => array('width' => '175', 'height' => '30')))  
?>

#7

superduperdan - November 8, 2009 - 19:01

Has anyone successfully made this work with the video displayed in a lightbox2?

#8

rodibox - November 15, 2009 - 05:01

Both solutions work well for me individually.
The proposed jreashor and gwen to show thumbail and marie70 proposal to change the size.
Someone could suggest how to combine the two things that bring them together That is one sentence that brings the thumbnail and also resize.

Sforgiveness for my English and my ignorance
Thanks

#9

rodibox - November 15, 2009 - 05:26

Sorry
After half an hour more testing, it achieved, the sentence is

  <?php
  
print swf(
    
$item['filepath'],
    array(
   
'params' => array('width' => '175', 'height' => '130'),
   
'othervars' => array('image' => $node->field_video_thum['0']['filename']),
     )
   );
?>

I do not achievement it´s get change the is high ControlBar .-

#10

martinvandiest - November 28, 2009 - 23:03

Solution #2 passed the thumb to the media player but it made my 'SWFTools - with download link' link for the video file vanish. Any ideas?

 
 

Drupal is a registered trademark of Dries Buytaert.