Embedded Media Field: Third Party Videos, Audio & Images

Last modified: June 12, 2009 - 22:17

The Embedded Media Field (emfield) creates a field for nodes created with CCK to accept pasted URL's or embed code from various third party media content providers, such as YouTube and Flickr. It will then parse the URL to determine the provider, and display the media appropriately.

Currently, the module ships with Embedded Video Field, Embedded Image Field, and Embedded Audio Field. In addition, it has Embedded Media Import, to import photosets and playlists into individual nodes, when allowed by specific providers. Finally, it also ships with Embedded Media Thumbnail, which allows editors to override provider-supplied thumbnails with their own custom image thumbnails.

The module also allows field & provider specific settings and overrides, such as autoplay, resized thumbnails or videos for teasers, RSS support, and YouTube's 'related videos'. You can turn off individual provider support on a field or global basis.

You can give the module a try at Drupal Hub.

Currently supported providers:

Video:

  • Blip.TV
  • Brightcove
  • Daily Motion
  • Google
  • Guba
  • JumpCut
  • imeem
  • Lastfm
  • LiveVideo
  • MetaCafe
  • MySpace
  • Revver
  • SevenLoad
  • Spike.TV
  • Tudou
  • Veoh
  • Vimeo
  • YouTube
  • Local videos (when already uploaded in the files directory)

Image:

  • Flickr
  • ImageShack
  • PhotoBucket
  • Picasa
  • Smugmug (via additional module download)

Audio:

  • Odeo
  • Podcast Alley
  • podOmatic

You can:

  • Administer emfield's general settings at administer >> content >> emfield
  • Add embedded media fields to your content types at administer >> content >> types >> %YourType% >> add_field
  • Manage teaser and full node display settings at administer >> content >> types >> %YourType% >> fields

Node Theming with emvideo in Drupal 6

Eikaa - October 21, 2008 - 17:00

To manually theme a node you can insert sth like this in the node tpl (where field_external_video is the name of your field):

<?php
       
if ($node->field_external_video[0]['embed']) {
           
$field_type = 'field_external_video';
           
$system_types = _content_type_info();
           
$field = $system_types['fields'][$field_type];
           
// To set custom video size, uncomment these lines
            // $field['widget']['video_width'] = 250;
            // $field['widget']['video_height'] = 150;
           
print theme('emvideo_video_video', $field, $node->field_external_video[0], 'emvideo_embed', $node);           
        }
?>

Eikaa, thx for this code. I

oeroek - November 21, 2008 - 17:20

Eikaa, thx for this code. I used it in contemplate and it worked fine.

The thing that is troubling me is how to use this code if I have multiple video;s. The following code clearly isn't working.

foreach ($node->field_video as $video) {
            $field_type = 'field_video';
            $system_types = _content_type_info();
            $field = $system_types['fields'][$field_type];
            // To set custom video size, uncomment these lines
            // $field['widget']['video_width'] = 250;
            // $field['widget']['video_height'] = 150;
            print theme('emvideo_video_video', $field, $video, 'emvideo_embed', $node);          
        }

emvideo, theming teaser with 'preview'

stattalk - March 28, 2009 - 02:47

This code just works superbly. I used it in the teaser for my video page. Needed a little change in the code:

<?php
       
if ($node->field_external_video[0]['embed']) {
           
$field_type = 'field_external_video';
           
$system_types = _content_type_info();
           
$field = $system_types['fields'][$field_type];           
            print
theme('emvideo_video_preview', $field, $node->field_external_video[0], 'emvideo_embed', $node);          
        }
?>

Notice that print theme('emvideo_video_preview'...) instead of print theme('emvideo_video_video'...) is the change that was required. However, if I specifically mention the 'emvideo_video_preview', then customizing the size does not work. It then takes the width and height of the video as set in the settings page. As usual, field_external_video should be the field that you created with CCK. In my case it is field_video_url

I have implemented it on www.nishorga.com/video

_________________________________
Let's talk statistics at www.stattalk.org

Need the first 3 lines

rpmute - April 3, 2009 - 22:26

Look in the lighbox module and copy the lines you need before your theme function. Don't even know why you would need to call another system function just to set a parameter, but haven't messed with it in D6 yet.

Yeah, only way I could get it working correctly in D5 as an image thumbnail is like:

<?php
$field
['field_name'] = 'field_external_video';
$field['widget']['video_width'] = 425;
$field['widget']['video_height'] = 350;
print
theme('lightbox2_video_cck', $field, $node->field_external_video[0], 'image_thumbnail', $node);
?>

where the only thing you'll change is 'field_external_video' wherever it appears.to match your field name.

Not the first time I've implemented theme code, mind you, but i do believe you shouldn't even have to type the three $field lines. Even 'image_thumbnail' parameter doesn't appear to be useful. Type in anything there. Someone prove me wrong.

Meh, so 3 more lines of code above. If you want a custom thumbnail size, give the last param an array:

<?php
print theme('lightbox2_video_cck', $field, $node->field_video_vendor[0], 'image_thumbnail', $node, array('width'=>120, 'height'=>90));
?>

theme video thumbnail in teaser template

rpmute - March 11, 2009 - 20:51

<?php
print theme('video_cck_video_thumbnail', $node->field_video, $node->field_video[0], 'video_thumbnail', $node);
?>

where you change instances of field_video to the machine-readable name of whatever your field is.

Just a note, the last snippet

pribeh - June 14, 2009 - 22:39

Just a note, the last snippet didn't work for me. I had to use the following:

<?php
       
if ($node->field_video[0]['embed']) {
           
$field_type = 'field_video';
           
$system_types = _content_type_info();
           
$field = $system_types['fields'][$field_type];          
            print
theme('emvideo_video_thumbnail', $field, $node->field_video[0], 'emvideo_thumbnails', $node);         
        }
?>

Take note of the use of "emvideo" instead of "video_cck".

Teaser layout

tqualizerstore - November 16, 2009 - 21:49

Have been fighting with trying to get the teaser output to display in columns - but I cannot find where to edit this! I have a node where about 10 YouTube videos are posted (not my ideal setup but we're doing baby steps here.) The teaser output creates the thumbnail links fine, they're just stacked one on top of the other and we're looking for the solution to make this display left to right. Any ideas?

The T-Qualizer Store - http://www.tqualizer.biz
Equalizer Shirt Info Guide - http://www.equalizer-tshirt.com

 
 

Drupal is a registered trademark of Dries Buytaert.