The Media Module is one of the most hyped new modules for Drupal 7. It is often talked about as the best option for handling images, video and audio files in Drupal 7.
However, available information about the Media Module is long on 90 minute conference presentations and short on quick, practical guides. So, in this tutorial we’re going to get right to the point. We’re going show you how to set up the Media Module, what it does and how to use it to add YouTube videos to your content. Let’s go ….
Install the Media Module
Understand the Media Module
Go to Structure > Content types > click Manage fields next to a content type.
You’ll see that a new field option called “Multimedia asset” is now available.
This field type will allow you to upload a variety of file types. Click Save and you can decide that those file types are:
If you create a “Multimedia asset” field for you content, the image below shows what it will look like when you go to add content.
Click on “Select media” and you can upload new files.
Most importantly, you can also browse a Library of all the files that you’ve uploaded.
This Library feature is the real reason for using Media. As explained on the Media FAQ page: http://groups.drupal.org/node/19746
“The Media module provides an engine that can be used to manage files and metadata. Individual Media module plugins, as well as the modules they integrate with, will handle media display.”
So the only thing this field can do at the moment is upload files to the library. If you want to actually show the files, you’ll need to rely on extra modules. Let’s see how that works.
Go to Structure > Content types > click Manage fields next to a content type. If you choose to add a File field you’ll now have a Media file selector option.
If you choose to add a Image field you’ll now have a Media file selector option.
Here’s what the Image field will look like when you go to add content.
You’ll be able to browse your new media library and insert an image just as you would do normally.
Adding Video to Content via the Media Module
Adding external videos to the Media module relies on the Embedded Media Field module: http://drupal.org/project/emfield.
That module allows you to hook into all sorts of external sites, provided you have the appropriate module. In this example, we’ll use YouTube so install this module as well: http://drupal.org/project/media_youtube.
Install and enable both of those modules.
Go to Structure > Content types and add a Multimedia asset field.
As you choose the settings, make sure to check both the Video and youtube boxes.
Save that new field.
There is one important thing you must now do to make sure that the videos display. Click on Manage Display at the top of the page.
Normally settings for the video field would be available but in this case I had to click Save before they appeared. Then you can click the cog on the right-hand side, next to the video field.
Set the File view mode to Small, Large or Original and click Update.
Click Save so that your changes aren’t lost.
Now you can go to Add content and use the new video field.
Once you’ve inserted the YouTube URL and clicked Submit, you should see a video thumbnail as in the image below.
Save the content and your video will be showing on the page.
YouTube is a simple and popular example. If you want to use other sources for video or audio, head to http://drupal.org/project/emfield and you’ll see a list of all the options and the modules that they require.
A note of caution: Media is under heavy development. There isn’t yet a stable version of Media. As of mid-February, there is a Release Candidate 3 but not yet a stable version.