Community Documentation

Embedded Media Field: Third Party Videos, Audio & Images

Last updated May 11, 2010. Created by betz on October 17, 2007.
Edited by GoddamnNoise, Francewhoa, LeeHunter, happydrupal. Log in to edit this page.

The Embedded Media Field (emfield) creates a field 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:

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

Comments

Node Theming with emvideo in Drupal 6

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

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);          
        }

Im not sure what youre trying

Im not sure what youre trying to do but i used this code to print out MULTIPLE VIDEOS in node-template from unlimited cck emfield.

<?php
   
if($node->field_page_video[0]["view"]){
   
$i = 0;
    foreach (
$node->field_page_video as $video) {
        print
"<div class='videoholder clear'><div class='videofalt'>".$node->field_page_video[$i]["view"]."</div><div class='videotext'>".$node->field_page_videotext[$i]["view"]."</div></div>";
       
$i++;
    }           
    }
?>

emvideo, theming teaser with 'preview'

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

Need the first 3 lines

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));
?>

Worked perfectly!!

Worked perfectly for me, thank you :)

Beyerz

theme video thumbnail in teaser template

<?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

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".

this worked for me, and even

this worked for me, and even shows the video (from youtube) on iphone.

However, I dont want the thumbnail size - I would like normal size. When I change emvideo_video_thumbnail to emvideo_video_video and emvideo_thumbnails to emvideo_embed - it does not show up in iphone, just shows the funky flash symbol...

(iphone and flash dont mix)

So why does thumnail version work but not normal embed?

am i missing something here?

You won't get the video to

You won't get the video to show up until the iphone browser supports Flash. The thumbnail works because it's simply a jpeg loaded from youtube's server.

yes, i see now that the

yes, i see now that the umbnail was just an image, and not the video the size of a thumbnail...

However, I have visited a few sites in the past that do show a youtube video, when i click it, it shows the youtube video in full screen on my iphone. So there MUST be a way it can be done... If you have an iPhone i can suggest a few sites as an example of what im talked about.

Yes, you are correct.

Yes, you are correct. Canada's CBC.ca does it. But I believe this would have to be posted as a feature request in the emfield issue queue. I would be interested in this as well. Here is some more info about the API from Youtube: http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps....

Teaser layout

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

Haven't yet started

Haven't yet started configuring this module yet, but throwing this suggestion out in the 2 secs that I have.

Check to see if there is a View set up for it. If not, try creating one using the "Grid" formatting. (That was what I had planned to do.)

Question about files being created

I have been running Embedded Media Field (just updated to 1.19) with Youtube on a D6.16 site for a few weeks now and there are currently *thousands* of files of the format emvideo-youtube-xxxxxxxxx_XXX.jpg in my sites/default/files directory. Is this normal? Doesn't seem to be a problem if I delete them. Is it emfield or the youtube plugin that's the problem? Anything I can do to help? Thanks, John.

Does anyone knows where to remove this warning message?
It comes right after you click on create content/video.

warning: Parameter 1 to emthumb_emfield_widget_extra() expected to be a reference, value given in E:\wamp\www\includes\module.inc on line 462.

Thank you.
Losman

Same here

Got the same error.. Parameter 1 to emthumb_emfield_widget_extra() expected to be a reference, value given in C:\xampp\htdocs\drupal\includes\module.inc on line 462. Is this a php 5.3 issue?

EXACTLY THE SAME ERROR parameter 1

I tried this on my fresh test site to be sure if its really working with no bugs. But it turned out it did [[[[ paramater 1 to emthumb_emfield_widget_extra() ]]]]].... anyone can help? thanks in advance... hoping for someone to reply....

I am trying to get video from youtube to play on my website when a user is on an iPhone / iPad (sans flash)

I read an article here http://learningtheworld.eu/2009/youtube-embed/ so it looks pretty simple for youtube anyway - I kind of got it to work. My site has youtube content and H.264 content that I'm playing with flowplayer, I assume for this I'd have to add some HTML5 trickery or get the browser to load an embeded quicktime player???

I use this to place the media

I use this to place the media field anywhere in node.tpl:

<?php print $field_video_rendered; ?>

You have to exclude it from $content in the Display settings to avoid double, of course, or use this to exclude all fields and manually add one by one, replacing the $content:

<?php print $node->content['body']['#value']; ?>

love, light n laughter

Display problem

Hi,
I am trying to have video gallery (using emfield and flv player).. as said above

I created a content type (named mytube)) then added a field "Embedded Video" of 3rd party to it.

I created a page of the type mytube and provied links of youtube vids.

When I tried to view the page that I just created, its working fine as long as I log-in(with admin privileges) once I logout ... Page is turning-up but without the media. I grant the access permissions to that page/node ... but of no use...

Can someone tell me how to troubleshoot it. (should give permissions of usage of emfield etc ?? flv player etc.)

By the way I am working on Drupal 6

Thanks n Regards
SRK

Search videos in youtube

hello,

I'm new in Drupal und I want use the media_youtube module to find some videos in youtube.
I don't know the exactly youtube ID for these videos and I would like to search them doing a query to youtube with media_youtube module. I would like to send some parameters, like in the youtube data api, and select the results list first video.

If is possible to do it with this module? I have tried a lot of times, but I haven't found the way to do it.

tanks in advance

albamu

preview size

Love this module but can't seem to get a decent preview size - it's the same size now as the video player. Can someone help me get a smaller preview for my front page like the Drupal Hub?

http://www.ocscreenwriters.com (the video is on the site - I'd want the front page "teaser" to be smaller than the node.

Thanks,
Mark

+1 for this request.

+1 for this request.

HowTo create a block with a thumbnail linking to its node? I did a custom view, but I cant theme the block anyone know the php code to place the thumbnail into the block?

Custom Form with Embed Media field

How can I create this emvideo field with a youtube provider on my custom module? Thanks in advance.

--
Rafael Gomes
Web Developer

this worked for me...

     <?php if ($node->field_project_video[0]['embed']) {
           
$field_type = 'field_project_video';
           
$system_types = _content_type_info();
           
$field = $system_types['fields'][$field_type];                
            print
$node->field_project_video[0]['view'];  
        }
?>

awillem

Yes the above script worked

Yes the above script worked for me

About this page

Drupal version
Drupal 4.7.x, Drupal 5.x, Drupal 6.x

Site Building Guide

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.
nobody click here