Hi
It works pretty well with attached files, but as I add a new filefield with cck, JWplayer doesn't see it.
I've tried [jwplayer|file=mp3preview] (mp3preview is the name of my filefield).
In vain.
Does someone how to fix this ?
thx

Comments

JW Player’s picture

@artatum,

The jwplayer tag only works in the node body which is why you're having difficulty getting it to work with a cck field (we're looking to address this in future versions).

The module makes the embedding code available as part of a theme function so you can use that as a workaround. An example would look like the following:

<?php
  $flash_vars = array(
    'file' => $node->field_video_advert [0]['filepath'], 
    'image' => 'activity_event_images/' . ($node-> field_image_product [0]['filename']), 
    'icons' => 'false'
  );
  print theme("jwplayermodule_render_player", "custom_player", $flash_vars);
?>

Let me know if that helps.

Thanks.

maru06’s picture

rickvug’s picture

Title: JWplayer doesn't see my filefield mp3 » JWplayer CCK FileField / FieldAPI formatter
Version: 6.x-1.1 » 6.x-1.3
Category: support » feature
Priority: Normal » Major

Renaming this issue for clarity. There is no question that JW Player should work as a field formatter for CCK in D6 and Field API in Drupal 7. This is a much more common use case than having an embed code. In Drupal 7 the Media project can take care of the embed code work.

guitarman2’s picture

Thanks. It worked for me!

JW Player’s picture

Glad you got it working.

We're investigating Drupal 7 currently.

Thanks.

adrianmak’s picture

do u mean the custom formatter module in d6 ?

pelleas’s picture

@ LongTail Video - Thank you for the code, it worked for me but not all the way.

I have 2 cck fields: 1 file upload for the video and 1 for the image but:

1. The thumbnail doesn't show and
2. The video plays only in the teaser, in full node I get the following message:
"Video not found or access denied: sites/default/tutorials/movie.mp4"

I'm using the following code in my node-video.tpl.php

<?php $flash_vars = array(
    'file' => $node->field_tutorial[0]['filepath'],
    'image' => 'files/imagecache/Thumbnail' . ($node->field_imagine_tutorial [0]['filename']), 
    'icons' => 'true'
  );
  print theme("jwplayermodule_render_player", "sample", $flash_vars);
?>

Any help appreciated.

Thank you.

JW Player’s picture

Hmm, seems like a relative path issue since viewing the node will change the page URL. Have you tried prepending a '/' to the path? Alternatively you could dynamically construct the entire URL using $base_url.

Thanks.

pelleas’s picture

@LongTail Video - you are right, there was a relative path issue. I've put '/' to the path and everything work perfect now. Thank you so much for your advice.

The modified code looks like this(maybe this will help anybody else):

<?php $flash_vars = array(
    'file' => '/' .($node->field_tutorial[0]['filepath']),
    'image' => '/' . ($node->field_thumbnail [0]['filepath']),
    'icons' => 'true'
  );
  print theme("jwplayermodule_render_player", "sample", $flash_vars);
?>