Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rickvug’s picture

Title: Image Preview » Provide image poster (with configuration to select the source)

@diskojerk Having a preview image is definitely something that needs to be supported. What makes it a somewhat tricky proposition is that the image could come from many different sources depending on a site's needs. To give an example I'm working on a project that uses File Entity. With File Entity we attach a thumbnail field to files themselves. In other cases you may want a site wide preview image or you may want to grab the image from another field on a node. Because of the multitude of possibilities any image selection logic will need to be pluggable and configurable within a preset.

As a quick start to adding process I've added a $poster variable within the player tpl (commit) allowing developers a way to set their own poster image. However there's no logic within the module for setting the value. To give an idea of one particular implementation here's the pre-process code I'm using right now to pull the image in from a field attached to video files:

/**
 * Implements hook_preprocess_HOOK().
 *
 * The JW Player tpl file accepts a $poster variable for a video's placeholder
 * image. However because the logic determining what image should be used varies
 * from site to site the module does not provide this variable itself. For this
 * reason we pre-process in Dennis Media to add a file's thumbnail image as the
 * poster when possible.
 */
function dennis_media_preprocess_jw_player(&$variables) {  
  if($variables['file_object']) {
    $thumb_field = field_get_items('file', $variables['file_object'], 'field_file_thumbnail');
    if ($thumb_field) {
      $variables['poster'] = file_create_url($thumb_field[0]['uri']);
    }    
  }
}

I'd be very happy to see someone try to take on the problem.

gtrdriver’s picture

Hello

i just posted a new request regarding this function...

I see this is not possbile jet in drupal because there is no storage Plan for the "Poster Images".

Im not a developer - so i want to ask you what changes i can made that jwplayer allways display the same "Poster Image" in all my Videos at my Drupal Installation ?

I think about to make a "company Poster" Image and i think this will look fine.

Can you help me what modifications i have to do to define a default Poster (preview Picture) for alle jwplayer locations in my drupal site ?

Best regards
Axel

andypost’s picture

Solution for video module using $poster variable #1398388-2: Using JW Player

probably we could use tokens in formatter settings to point a image field but this would only works for file field + image field

nochiu’s picture

Hello, rickvug

Could you teach me where should I add the your PHP code.
Should I make some custom module ? or add the code in "jw_player.module" ?

I'm new user with Drupal7

sorry but my poor English.

Thank you.

rickvug’s picture

@nochiu The PHP code should either go into a custom module or your own theme. As a general rule never modify modules or Drupal core directly. If you must, submit a patch and then apply that patch (and be sure to document and track its status afterwards). To get this working implement the hook_preprocess_jw_player. If your custom modules name is "mymodule" then the function would be mymodule_preprocess_jw_player(&vars). In this function add a poster to variables array. I hope this points you in the right direction. Drupal development and theming has a fairly high learning curve but you're lucky that there's a lot of documentation out there now. Good luck!

nochiu’s picture

Thank you for replying!

I tried creating the module, but It seems that does not working now.
Could you check my process?

  1. I made sure a "$poster" variable within the jw_player/theme/jw_player.tpl.php (It seems that correctly in version of 7.x-1.0-alpha1)
  2. Creating a my module files.
  3. mymodule.info

    ; $Id$
    
    name = mymodule
    description = add preview image in JW player.
    package = My modules
    version = VERSION
    core = 7.x

    mymodule.module

    <?php
    /**
    * Implements hook_preprocess_HOOK().
    */
    function mymodule_preprocess_jw_player(&$variables) { 
      if($variables['file_object']) {
        $thumb_field = field_get_items('file', $variables['file_object'], 'field_file_thumbnail');
        if ($thumb_field) {
          $variables['poster'] = file_create_url($thumb_field[0]['uri']);
        }   
      }
    }
    
  4. Files upload and activate the module.
  5. I added a "field_file_thumbnail" File or Image Field within a content types.(I had previously arrenged JW player video field)
  6. And submited the thumbnail image on node.

It has been black out in the player and Didn't see a preview image(thumbnail).
Were there somthing wrong?
Please, tell me more something what I should do.

Thank you very much.

rickvug’s picture

I think that the problem is that you've attached the field to the node you're attaching the video to rather than the video file itself. In the example provided the field must be attached to the file via file_entity. It would also be possible to grab the field from the node but the code would be different. In that case you could use menu_get_object() to get the nid, node_load() to get the node, then call field_get_items('node', $node, 'field_name') to extract the image URL for the poster.

Does this make sense?

rickvug’s picture

Note that I just made a commit that changes the variable from $poster to $image. This is more consistent with JW Player - poster is only used in the HTML5 video tag itself. The same commit also makes it possible to pass the image URL directly to the theme function. So the following should work:

$video = array(
  'file_object' => file_load($fid),
  'preset' => 'your_sites_preset',
  'image' => 'http://example.com/image.jpeg',
);
theme('jw_player', $video);

Preprocessing to add the poster is also possible and works with the field formatter integration (no need to call theme('jw_player') manually).

nochiu’s picture

I made that displayed poster image with File entity module!
Thank you very much.

but I would like to attache a field to node and get poster image from attaching a video node.
Could you teache me how to write defferent corde.

I tried replace the code, but doesn't work.

/**
* Implements hook_preprocess_HOOK().
*/
function mymodule_preprocess_jw_player(&$variables) {
  $node=menu_get_object($type = 'node');
    $thumb_field = field_get_items('node', $node, 'field_file_thumbnail');
    if ($thumb_field) {
      $variables['poster'] = file_create_url($thumb_field[0]['uri']);
  }
}

Thank you.

rickvug’s picture

Try changing $variables['poster'] to $variables['image'] as the variable being used by JW Player has changed. If that doesn't solve the issue try var_dump() (or dpm() if you're using devel) on the variables to see if you are getting what is expected at each stage.

nochiu’s picture

Thank you, rickvug. I'll try it with devel module.Thanks a lot!

Max_Headroom’s picture

FileSize
1.74 KB

Based on the tips here I created a small module that will use an image uploaded with the node as poster for player.

You can select the field used for the image in the JW Player settings (/config/media/jw_player/settings). Ideally this setting should be in the presets to make it more content specific, but I am not sure how to alter a ctools form and this way suits my needs.

fugazi’s picture

Hi Max_Headroom,

It works great, many thanks

stevebeck’s picture

Thanks Max_Headroom, working nicely for me as well.

stevebeck’s picture

Hi, I am loving this module, one question, is it possible for the poster image to inherit the imagecache style?

Max_Headroom’s picture

I did not include imagecache, as the poster image scales to the video size set in the preset.

champagne61’s picture

First of all, thanks you Max_Headroom, this module proved to be very useful. It's working great with the nodes.
However I cannot get it working when the jw player is inside a view ? Any idea how to do this ?

Screenack’s picture

Max_Headroom: W00T! That module is buggy yet awesome! I would love to see this merged or whatever to make it live. Then I can file a bug report. ;)

I get the following when this property isn't set:
[23-Aug-2012 02:46:34 UTC] PHP Fatal error: Cannot access empty property in /Volumes/client/public_html-7/modules/field/field.module on line 936

mgifford’s picture

@Max_Headroom what's happening with this small module? Ideally it would be a nice small module brought into the jw_player module so that it is an easy option for everyone who wants this functionality.

@rickvug any concerns with that approach?

Jorrit’s picture

Status: Active » Needs review
FileSize
8.44 KB

I am the maintainer of the Video.js module, where I implemented a similar feature. I have ported this code to the JW player module. It allows you to select an image field in the Formatter settings. You are able to select image fields that are associated with the same bundle. You can select an image style to be applied to this image.

The patch also contains support for the link_field, in more simple way than suggested in #1494436: Provide a formatter for Link fields. I have not yet tested this patch 100%, I may update it in the coming days.

Jorrit’s picture

As promised, the patch contained a bug. Here is an updated version.

Max_Headroom’s picture

@19 Innitially my module was just a means to an end to get the job done for me. It was never meant (nor good practice) to be an add on module.
I was also tolling with the idea of having the poster image as a formatter, just never got around to it. Glad to see Jorrit came up with something.

Seems like this is a popular request, and I vote that we get the patch tested and rolled out in the main module. Will try to get around to test it (hectic this time of year).

Berdir’s picture

Status: Needs review » Needs work

Thanks for working on this, looks quite good, detailed review below.

I don't quit understand the need for that ctools special case and why the mimetype stuff needs custom handling now, if that is required for this patch please add some inline (or in case of ctools to the function docblock that needs to be added anyway).

+++ b/jw_player.moduleundefined
@@ -113,6 +115,30 @@ function jw_player_field_formatter_settings_form($field, $instance, $view_mode,
+      // Poster field handling

Comments should end with a ".".

+++ b/jw_player.moduleundefined
@@ -113,6 +115,30 @@ function jw_player_field_formatter_settings_form($field, $instance, $view_mode,
+          '#description' => t('The original video thumbnail will be displayed. Otherwise, you can add a custom image style at !settings.', array('!settings' => l(t('media image styles'), 'admin/config/media/image-styles'))),

Usually, for links within translatable strings, the tag is directly added and just the url (created with url() is a placeholders. That allows to translate it with a context and also come up with a correct sentence in e.g. right to left languages like russion.

+++ b/jw_player.moduleundefined
@@ -121,6 +147,52 @@ function jw_player_field_formatter_settings_form($field, $instance, $view_mode,
 
+function _jw_player_find_image_fields($field, $entity_type, $bundle) {
+  $imagefields = array();

The function should have some basic documentation with a one-line description, @param and @return tags.

+++ b/jw_player.moduleundefined
@@ -148,6 +220,21 @@ function jw_player_field_formatter_settings_summary($field, $instance, $view_mod
+      $summary[] = t('Poster image field') . ': ' . check_plain($imageinstance['label']);

The label should be a placeholder here, then check_plain() isn't necessary.

+++ b/jw_player.moduleundefined
@@ -148,6 +220,21 @@ function jw_player_field_formatter_settings_summary($field, $instance, $view_mod
+  if (isset($image_styles[$settings['posterimage_style']])) {
+    $summary[] = t('Poster image style') . ': ' . check_plain($image_styles[$settings['posterimage_style']]);
+  }
+  else {
+    $summary[] = t('Poster image style') . ': ' . t('None');

Same.

+++ b/jw_player.moduleundefined
@@ -155,19 +242,59 @@ function jw_player_field_formatter_settings_summary($field, $instance, $view_mod
+            $mime = DrupalLocalStreamWrapper::getMimeType($item['url']);

Should use file_get_mimetype() instead.

+++ b/jw_player.moduleundefined
@@ -155,19 +242,59 @@ function jw_player_field_formatter_settings_summary($field, $instance, $view_mod
+    // Add the poster image

Another missing .

Jorrit’s picture

Thanks for the review.

The ctools part is used when the formatter is used for a Views field. When the formatter is used there, the bundle is not known, so more options need to be available in the field option list. I will update the patch soon with more comments.

Jorrit’s picture

Status: Needs work » Needs review
FileSize
9.17 KB

The reason I used t('Poster image style') . ': ' . t('None'); instead of a placeholder is that in that way, the string 'Poster image style' only needs to be translated once. Now it needs to be translated twice, while the ': @value' part doesn't really add anything to translate.

In any case, I updated the patch with all your comments.

Berdir’s picture

Thanks, re-roll looks good.

Maybe some people can confirm that this is working correctly and RTBC this?

The reason I used t('Poster image style') . ': ' . t('None'); instead of a placeholder is that in that way, the string 'Poster image style' only needs to be translated once. Now it needs to be translated twice, while the ': @value' part doesn't really add anything to translate.

Right, it is a bit more work to translate it but it *can* be translated correctly now :)

Max_Headroom’s picture

I could not apply the patch to the latest dev version, but I think it is possible my IDE, as I did not see any funny things when I applied the patch manually.

You have included another fix inside this patch. That is to add link_field to have a JW_Player formatter:

@@ -58,9 +58,11 @@ function jw_player_field_formatter_info() {
   $formatters = array(
     'jw_player' => array(
       'label' => t('JW player'),
-      'field types' => array('file'),
+      'field types' => array('file', 'link_field')

And:

if ($display['type'] == 'jw_player') {
     // Process files for the theme function.
     $files = array();
     foreach ($items as $delta => $item) {
-      $files[$delta] = (object) $item;
+      switch ($field['type']) {
+        case 'file':
+          $files[$delta] = (object) $item;
+          break;
+        case 'link_field':
+          // Manual override for WebM, because Drupal doesn't detect it.
+          if (substr($item['url'], -5) == '.webm') {
+            $mime = 'video/webm';
+          }
+          else {
+            $mime = file_get_mimetype($item['url']);
+          }
+          // If the mime type is application/octet-stream, default to MP4.
+          // This happens for instance for links without extensions.
+          if ($mime == 'application/octet-stream') {
+            $mime = 'video/mp4';
+          }
+          $files[$delta] = new stdClass();
+          $files[$delta]->uri = $item['url'];
+          $files[$delta]->filemime = $mime;
+          break;
+      }
+    }

I also think link_field is a good idea, but it is not related to this issue. Link module is also a contributed module. Please remove and open a separate issue for it.

Other than that, it is working well. I think another test to check the patch, then we can go RTBC.

Jorrit’s picture

Status: Needs review » Needs work

That is also what I said in #20. I will remove it.

Jorrit’s picture

Status: Needs work » Needs review
FileSize
8.14 KB

New patch

TomSherlock’s picture

First, I want to thank everyone on this thread for contributing to the patch in #29.

I've successfully applied the patch to the JW Player. I traced the code in Eclipse. I have been able to set the property when editing my content type.

However, I have not been able to select an image, so I have no image displayed in the JW Player in place of the black screen. Obviously, I'm missing a step. Should I be using the preprocess_jw_player hook to select the image?

Thanks.

TomSherlock’s picture

Based in Max_Headroom's comment from #12, I added an image field to my content type.
Under display management I was then able to set the Poster image field and Poster image style.
For Poster image field I selected the field to which I had uploaded the image.

I also traced the code and saw that this field was selected and it had a legitimate URL associated with it.
Nevertheless the video's black screen is still present; there is no preview or poster image.

I also looked at the tags through the browsers element inspector. I thought I'd might see an img tag
associated with the poster image. I found a div for _jwplayer_display and within that div an img with
the id _jwplayer_display_image whose style included display:none. I wonder if
that might have anything to do with no img displaying? Or is it something else?

The img tag has no src attribute with a url pointing to the image.

I'm using a jw player preset that was created before I added the patch. Should I be creating a new jw player preset?

Does someone have a sample on a public website that I could look at? I'm curious see how the html would look when inspecting the elements.

Thanks.

TomSherlock’s picture

I'm using the field type File and the widget Media file selector and then under display I'm using JW player as Format. Should I be using a different field type?

Jorrit’s picture

An example video is: http://www.domradio.de/video/interview-mit-bundesverteidigungsminister-t...

You should look at the HTML when it is generated. It should be like:

  <video id="jwplayer0media-layer-video" width="640" height="360" controls="controls" preload="none" poster="http://www.domradio.de/sites/default/files/vimp/thumbnails/maiz.jpg">
      <source src="http://www.medien-tube.de/images/media/21888.mp4" type="video/mp4" />
    </video>

The poster part is important.

TomSherlock’s picture

Thanks, Jorrit, for the HTML sample. When I inspect element in Firefox 19.0.2, I see very different HTML:


<div class="jwplayer-video">
<div id="5cb29a32e5d7420c8edc18b5ad0d6f53_wrapper" style="position: relative; width: 640px; height: 360px;">
<object id="5cb29a32e5d7420c8edc18b5ad0d6f53" width="100%" height="100%" type="application/x-shockwave-flash" data="http://localhost:8888/rtc2/sites/all/libraries/jwplayer/player.swf" bgcolor="#000000" name="5cb29a32e5d7420c8edc18b5ad0d6f53" tabindex="0"></object>
</div>
</div>

It seems to be defaulting to flash even though I set the JW Player to try HTML5 first. So I had a look at the jw_player.tpl.php to see if poster was there. It is but the variable $poster is not initialized. And there doesn't seem to be the index counterpart (['poster']) in the preprocess function nor anywhere else.

The jw_player.info file dates my copy at 2012-01-13. It is version 7.x-1.x-dev.

I was looking at version 7.x-1.x-dev with the date 2013-01-26. It looks it has the patch included. However, I still don't see ['poster'] within the $variables.

Could this be an issue because it's defaulting to flash instead of HTML5?

Jorrit’s picture

You are looking at the HTML _after_ the JW Player javascript has processed it. What's important is the HTML that Drupal generates. In most browsers, that's what you see when you press the right mouse button and choose View Source.

My patch was not committed (yet), so you can't look at 7.x-1.x-dev and find it.

TomSherlock’s picture

Ok, thanks. When I view source this is what I see:

 <video id="587d2e801c3e2e1c7dc8602f728477d0" width="640" height="360" controls="controls" preload="none">
    <source src="http://staging.rutherfordtheatre.com/sites/default/files/video/Afterparty-jam%20%28iPhone%20%26%20iPod%29.m4v" type="video/x-m4v" />
  </video>

I do not see poster. I was looking more closely at jw_player.tpl.php and noticed that poster will be initialized only of $image has a value in the 2013-01-26 version:

<?php if(isset($image)) : ?> poster="<?php print $image ?>"<?php endif ?>

The 2012-01-13 version it checks for $poster instead:

<?php if(isset($poster)) : ?> poster="<?php print $poster ?>"<?php endif ?>

In a comment associated with the function template_preprocess_jw_player it says $image is an optional variable that can also be set.
The $image variable comes in unset and is not set in the function. Should I be writing my own preprocess function to set $image?

BTW, Jorrit, I greatly appreciate your responsiveness.

Jorrit’s picture

Setting the optional image parameter is exactly what my patch at comment #29 does. Have you applied this patch?

TomSherlock’s picture

The only time I can see the preview image is in the function jw_player_field_formatter_view.
The $image is associated with the index, '#image' in the array, $element.

But the $image seems to get lost after that. I don't see it being added to $poster.

And yet a few others on this thread seemed to have been successful in displaying the preview.

So should I be writing my own preprocess function?
Is this what they did?

TomSherlock’s picture

Yes I applied the patch.

I've applied it to the dev version from 2012-01-13 and the alpha version succesfully.
I was unable to apply the patch to the most recent dev version. I got an error:

tjsherlock$ patch < jw_player-posterfield-1395584-29.patch --dry-run
patching file jw_player.module
Hunk #1 succeeded at 62 (offset 1 line).
Hunk #2 succeeded at 116 (offset 1 line).
Hunk #3 succeeded at 149 (offset 1 line).
Hunk #4 succeeded at 222 (offset 1 line).
Hunk #5 succeeded at 235 (offset 1 line).
Hunk #6 succeeded at 257 (offset 1 line).
Hunk #7 FAILED at 267.
1 out of 7 hunks FAILED -- saving rejects to file jw_player.module.rej

TomSherlock’s picture

The patch says:

Subject: [PATCH] Issue #1395584 by Jorrit: Added settings to the formatter to
allow selecting an image field and style to be used for the
poster of the video.

So I am able to go to Manage display at admin/structure/types/manage/article/display.
I am able to select JW Player as the Format and configure the Poster image field and the Poster image style:

Preset: jw_present
Description:
mode: html5
width: 640
height: 360
controlbar: over
skin: default
autoplay: default
Poster image field: Preview Image
Poster image style: medium

It would appear to me that the $variables should be set in the preprocess function as indicated by the function's comments. But the variable used in the *.tpl.php is not being initialized. I don't see $variables['poster'] nor $variables['image'] in the module nor the patch, while $poster and $image are referenced in their respective versions of the *.tpl.php.

TomSherlock’s picture

So back to the function, jw_player_field_formatter_view.

It does a good job of using the $posterimage_field and $posterimage_style to get the poster image.
Then it packs that image into an array and returns it.

If there are no items then the default image found does not get added to the array being returned.

If I can somehow get that poster image into the $variables or somehow pick up the poster image while in the preprocess function
I would be able to set $variable['image'] or $variables['poster'] and then display the image in in the *.tpl.php.

One possibility would be to use variable_set and variable_get. But the downside is that it would require writing to and reading from the
database.

gavrillich’s picture

FileSize
31.61 KB

I was able to upload a custom video preview image file with the video module http://drupal.org/project/video. I set the JW player as default player for .flv files in settings. In content type manage fields field type is video ( not file), under manage display format is video player. In the node edit form I had to select bypass auto conversion ( for some reason it was not working) and there is a field to upload video preview below( attached). I still needed JWplayer module - video module uses preset.

TomSherlock’s picture

Thanks for this tip, gavrillich. I'll try your recipe.

kingfisher64’s picture

The patch on #29 outputs the following when applied the latest dev, 26th Jan 2013.

Hunk #1 succeeded at 62 (offset 1 line).
Hunk #2 succeeded at 116 (offset 1 line).
Hunk #3 succeeded at 149 (offset 1 line).
Hunk #4 succeeded at 222 (offset 1 line).
Hunk #5 succeeded at 235 (offset 1 line).
Hunk #6 succeeded at 257 (offset 1 line).
Hunk #7 FAILED at 266.
TomSherlock’s picture

I got that same failure as noted in comment #39.

Berdir’s picture

Status: Needs review » Needs work

If a patch doesn't apply anymore, set it needs work and/or try to re-roll it.

Jorrit’s picture

Status: Needs work » Needs review
FileSize
8.5 KB

Rerolled the patch.

kingfisher64’s picture

$ patch < jw_player-posterfield-1395584-47.patch
patching file jw_player.module
Hunk #1 succeeded at 62 with fuzz 1.
Hunk #7 succeeded at 288 with fuzz 2 (offset 21 lines).
Hunk #8 succeeded at 316 (offset 21 lines).
Hunk #9 FAILED at 627.
1 out of 9 hunks FAILED -- saving rejects to file jw_player.module.rej

Is the outcome when jw_player-inputfilter.patch from http://drupal.org/node/1816928 is applied first.

I tried again with dev from 26th Jan and patch works fine.

Jorrit’s picture

I think patches are always intended to be applied against a clean git version. I can't take into account any other patches you have applied.

nyl_auster’s picture

Wow, this last patch works like a charm and this is very handy to have this option in the field formatter. No bug for me for now. thanks !

kingfisher64’s picture

@Jorrit - you are right. The problem is when a module has more than one patch that needs applying. Can we commit this into the project asap since it's working fine. :)

RobKoberg’s picture

Here is a preprocess function that works for me. Note the line with $variables['config']['image'] = $poster_url; which is necessary.

function mymodule_preprocess_jw_player(&$variables) {
  $node=menu_get_object($type = 'node');
  $poster_field = field_get_items('node', $node, 'field_front_video_poster');
  if (!$poster_field) {
    $poster_field = field_get_items('node', $node, 'field_video_poster');
  }
  if ($poster_field) {
    $poster_url = file_create_url($poster_field[0]['uri']);
    $variables['poster'] = $poster_url;
    $variables['config']['image'] = $poster_url;
  }
  if (!variable_get('jw_player_inline_js', FALSE)) {
    variable_set('jw_player_inline_js', TRUE);
  }
}
Nikit’s picture

I remade RobKoberg code for safety and now itsn't depend on node full-page viewing, so it can used on views or teasers, replace all uppercase text, so you should:
1. have video (media) field on node;
2. have image field for poster, that attached to the same node where media field - IMAGE_FIELD_NAME;
3. add image style for filling poster in video: IMAGE_STYLE_FOR_VIDEO - sizes should be the same as video widget size (scale & crop will useful).
4. Add next code to your template.php and rename THEMENAME to your theme name;
5. Clear cache;

/**
 * Process variables for jw_player.tpl.php.
 */
function THEMENAME_preprocess_jw_player(&$variables) {
  template_preprocess_jw_player($variables); // Let's pass via jw player preprocess.

  // Check that next is node entity.
  if (isset($variables['file']['referencing_entity']) && isset($variables['file']['referencing_entity']->nid)) {
    $node = $variables['file']['referencing_entity'];
  }
  else {
    $node=menu_get_object('node');
  }

  if ($node) {
    $poster_field = field_get_items('node', $node, 'field_preview_image');
    if (isset($poster_field[0]['uri'])) {
      $poster_url = image_style_url('slide_content_img01', $poster_field[0]['uri']);
      $variables['poster'] = $poster_url;
      $variables['config']['image'] = $poster_url;
    }
  }

}

p.s. Code refixed, since in some case in node full page viewing node reference doesn't loaded.
p.p.s ref.variables refixed due to julescone comment

julescone’s picture

Thanks Nikit, that is exactly what I needed.

One heads up on your code I was getting a PHP warning:
"Deprecated function: Call-time pass-by-reference has been deprecated in phptemplate_init()"

This comment set me on the right track. https://drupal.org/node/1293776

Essentially the & on the template_preprocess_jw_player line isn't required under PHP 5.x+ , and is the cause of the warning.

template_preprocess_jw_player(&$variables); // Let's pass via jw player preprocess.
Should be:
template_preprocess_jw_player($variables); // Let's pass via jw player preprocess.

Note you need to leave the "pass by reference" & parameter on &$variables in the function declaration though.

Cheers, Jules

  • rickvug committed 972d052 on 8.x-1.x
    Issue #1395584: Add  variable to template file as a first step to...
  • rickvug committed 2113a48 on 8.x-1.x
    Issue #1395584: Follow up - Allow  to be passed to the theme function.
    
    
pbuyle’s picture

Issue summary: View changes

As far as I can tell, both the 7.x-1.x and 7.x-2.x branch support the usage of a poster image via hook_preprocess_jw_player.

The patch in #47 add a solution to allow usage of an image field on the entity. This is a nice solution, but only cover some use cases of poster image. Rather than being in the main jw_player module, it should be on in its separated module (that could still be part of the JW Player project). This way, users (like myself) who have no need for the feature and implement their own custom solution won't have to ensure both solution does not create any conflict.

pbuyle’s picture

Status: Needs review » Needs work
ron_s’s picture

@Berdir, given that you recently committed preview image functionality for 7.x and 8.x, what are your thoughts on this point?

The patch in #47 add a solution to allow usage of an image field on the entity. This is a nice solution, but only cover some use cases of poster image. Rather than being in the main jw_player module, it should be on in its separated module (that could still be part of the JW Player project). This way, users (like myself) who have no need for the feature and implement their own custom solution won't have to ensure both solution does not create any conflict.

ron_s’s picture

Status: Needs work » Closed (duplicate)

This functionality is in 7.x-2.x, and probably makes sense to just close the ticket for now. Someone can re-open or post a new one for 7.x-2.x if there are further issues or items to be discussed.