By nyleve101 on
Hi,
I'm currently using JW Media Player via the SWF Tools module and would like to switch to the JW Player Module for Drupal (http://drupal.org/project/jwplayermodule).
At present I’m creating the player in my node and views using the code below and would like it to be rewritten (including the caching) so that it works with the JW Player Module for Drupal.
Node-example.tpl.php
if (isset($node))
{
// Displays the media player with an Imagefield preview
if ($node-> field_video_advert[0]['filepath']!='')
{
print swf($node-> field_video_advert [0]['filepath'],
array(
'params' => array('width' => '450', 'height' =>'350'),
'flashvars' => array(
'image' => 'imagecache/product_pic/activity_event_images/' . ($node-> field_image_product [0]['filename']))
));
}
else
print theme('imagecache', 'product_pic', $node->field_image_product[0]['filepath']);
}
views-view-field--field-video-advert-fid.tpl
// Get file ids
$fid_video = $row->{$field->field_alias};
// Find real field alias for image field
$fid_image = false;
$suffix = "field_image_product_fid";
foreach($row as $key => $val)
if (substr($key, -1*strlen($suffix)) == $suffix)
$fid_image = $val;
// If we got some data, display it.
if (!empty($fid_video) || !empty($fid_image))
{
$node = (object)array();
$node->field_video_advert[0] = field_file_load($fid_video);
$node->field_image_product[0] = field_file_load($fid_image);
// Check if we got an image
if ($node-> field_video_advert[0]['filepath']!='')
{
// Displays the media player with an Imagefield preview
print swf($node-> field_video_advert [0]['filepath'],
array(
'params' => array('width' => '210', 'height' =>'180'),
'flashvars' => array(
'image' => 'imagecache/product_image/activity_event_images/' . ($node-> field_image_product [0]['filename'])
));
}
else
print theme('imagecache', 'product_image', $node->field_image_product[0]['filepath']);
}
Any help is appreciated!
Thanks,
Evelyn
Comments
use theme("jwplayermodule_render_player"
I have not tried, but this might work
Node-example.tpl.php
views-view-field--field-video-advert-fid.tpl
Hope that helps
Juan
Hi Juan, thanks for your
Hi Juan,
thanks for your help. I tried your code but for some reason the player loads a 'video not found or access denied' message. To test the issue I switched back to using jwplayer using swftools and everything worked again.
Do you have any idea why this might be happening?
Thanks again,
Evelyn
Add $base_path in template
This would result
Node-example.tpl.php
views-view-field--field-video-advert-fid.tpl
you must verify the path imagecache
Juan
Hi Juan, thanks again for
Hi Juan,
thanks again for your help. The video is now playing correctly- thank you! However, the preview images are not appearing, I assume it's the base path issue again, so how would I incorporate that for the images please?
Hope you're well and taking care of yourself,
Evelyn
You add imageche path
Now I can not test image_cache, but I think this works. You add imageche path, should change $flash_vars['image'] (use imagecache_create_url()):
in Node-example.tpl.php
by
and
in views-view-field--field-video-advert-fid.tpl.php
by
Juan
Juan, thanks so much! That
Juan,
thanks so much! That did the trick perfectly.
Thanks again!!
Evelyn