Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I was creating a block with most recent media uploaded, so I guess it would be great to be able to view the first image of every movie in teaser linked to node!
I don't know if it can be possible..
Comments
Comment #1
ñull CreditAttribution: ñull commentedsubscribe
Comment #2
ñull CreditAttribution: ñull commentedI discovered this post and I was wondering if anybody implemented this one using jQuery Media and could show us how he/she did it. Or someone could may be give me a hint how to do it. May be put the code in the default.js file? How would a sample default.js file look like?
Comment #3
artscientific CreditAttribution: artscientific commentedwould be interested in this as well
-Peter
Comment #4
GuillaumeDuveauFor those using JW Media player, at the moment it does not do it. There are two things that need to be done :
- render the picture of the preview from the .flv
- make jQuery Media pass that picture to the player as a Flashvar
For the first issue, I'm not so interested since I anyway have an Imagefield which is a chosen snapshot of the .flv (not the first frame). Also, it depends on the flash player. So if you're using another flash player, and that it provides the option, everything should work for you ? Anyway this does not depend on Drupal. The only way Drupal could do it would be with access to ffmpeg I guess, which is not an issue in jQuery Media.
For the second issue, let's say we have the image URL, but it changes for every video of course, so passing a static "image" Flashvar would not work. Any way to pass a dynamic variable like $node->field_imagefield[0]['filepath'] ?
Comment #5
dmbch CreditAttribution: dmbch commentedI am using JW player currently with an imagefield like this:
This way, I can set video width and height and upload a still image for my videos.
YMMV and please remember: The above code is pasted straight from a q&d prototype.
Comment #6
GuillaumeDuveauHow could I miss that ? Thanks a lot Daniel !!!
If someone else wants to use this, in the jQuery Media settings you must NOT have the .video class in Classes > Media > Media class , this code does it. Or fully disable Auto-invoke Media class.
Comment #7
jlevis CreditAttribution: jlevis commentedHey Daniel, where do you put that code?
Comment #8
Mike Serafin CreditAttribution: Mike Serafin commentedSubscribed as well. Would love to see this feature.
Comment #9
tekyTris CreditAttribution: tekyTris commentedI've been looking for a fix for just adding a preview image in for videos.
Code should look like
<swf file="productvideos/superscan11-short_VP6_CDwide.flv" flashvars="image=decpreview.jpg">
rather than
<swf file="productvideos/superscan11-short_VP6_CDwide.flv" image="decpreview.jpg">
and we're done ;)
Creating the equivilant for a node type should be nice and easy too.
Just have new content type, with 2 cck fields. File src & image. Use contemplate for ease of use and add the script into the template for that node type. Something along the lines of..
<swf file="<?php print $node->field_video[0]['filepath']; ?>" flashvars="image=<?php print $node->field_video_still[0]['filepath']; ?>">
..for your content type and bobs your aunts husband.
That should work fine for you.
Comment #10
jbova CreditAttribution: jbova commentedI was able to successfully use Daniel's code with one issue. It uses the class name to set the flashvar for the image. This means that if you have a video gallery, with more than one FLV Media Player instance on the page, then all of the preview images are set to the same image. There doesn't seem to be a unique ID on the elements for which to define an image. Does anyone have any ideas?
I am currently using this...
However, it would seem that
$('.filefield-file a')
should be replaced with the element's ID, such as
$('video" . video-$node->id . "')
.This would only work if the element had the ID set as "video-nid", or something of the sort.
Another possibility would be to get the array of elements by using
$('.filefield-file')
, then looping through the child elementsa
and setting the flashvars that way? I may give that a try, if there are no other suggestions.Thanks,
Jim
Comment #11
jbova CreditAttribution: jbova commentedThis will work in both FF and IE.
In the Content Template, you use the following for the teaser field:
The following goes in the body field:
Here are the field names and meanings for my video content type:
field_width : the desired display width for teaser
field_height : the desired display height for teaser
field_video_width : the desired display width for full node
field_video_height : the desired display height for full node