Creating a Drupal 7 video gallery with the Media module
We've been testing different contributed Drupal 7 modules to assess the readiness of the ecosystem for production sites. The Media module is an ambitious and promising solution for managing and deploying a variety of media assets. It promises to be the successor to the very successful Embedded Media Field
After reading the extensive documentation it occurred to me there was a need for a tutorial in this area.
This tutorial will focus on creating a gallery of YouTube videos using the Media and Media YouTube modules. This is the end product we will be building:
In completing this tutorial I used Drupal 7.8 with the following contributed modules:
Install and enable these modules as usual.
Video content type
First we need to create a video content type. Go to Structure -> Content types -> Add content type and fill in the form. Call the content type 'YouTube video'. Leave all other settings unchanged and save the content type.
Video field
Next we'll create a field to hold our video. Click on the Manage Fields tab and add a new field 'video' of type 'Multimedia asset' with a widget of 'Media file selector'. Click Save.
Click on Save field settings button on the next page. You will now be on the settings screen for the new video field. Under 'Allowed media types' check the Video checkbox. In 'Allowed URI schemes' check the youtube:// URI box. The click on the Save settings button.
Field display settings
Now click on the Manage Display tab and select Media for the video format. Click Save. Now click on the gear icon in the Video row. Select the Default file view mode and click on the Update button.
File types
This next part is what trips people up and has caused confusion. We need to enable the displays for the Youtube video 'files'. To do this go to Configuration -> Media -> File types. Make sure the Default tab is select in the upper right. Check the YouTube Video and YouTube Preview Image checkboxes. Then check the YouTube Video Display setting and enter the width and height of your video. In the YouTube Preview Image tab enter the preview image style. Save the configuration.
Add videos to library
Our site is now ready to accept our videos. To add your videos go to Content -> Media -> Media browser. Click on the Web tab. Paste the URL of your video. Use the browser URL of the video. Don't use the embed code, as of today if you use the embed code you will get the WSOD.
Create video nodes
Now that we have video in our library we need to create a series on video nodes. The procedure is the following. Go to Content -> Add content. Click on the YouTube Video link. Fill in the title and body. In the the video section click on Select Media. Click on the Library tab and select your video. Save the node. Repeat this procedure for all your videos.

Comments
Thank u for this guide,i am
Thank u for this guide,i am thankful to u.
is there a way to do this by
is there a way to do this by directly uploading videos to your site
YES!!!! FINALLY!!! A GALLERY
YES!!!! FINALLY!!! A GALLERY THAT WORKS!!! THANKS A MILLION!!!
Hello! I'm getting the next
Hello! I'm getting the next error: media_fid_illegal_value. What should I do?. Thank you.
Thank you for the tutorial.
Thank you for the tutorial. It works fine ;)
There is only one point I can not understand:
In 'Allowed URI schemes' check the youtube:// URI box.
What are these URI schemes? Whats the sense of public:// or youtube://?
Thanks so much for your
Thanks so much for your tutorial, I have made the most progress all week after following your steps!
I too am getting this error message:
Notice: Undefined index: label in file_entity_file_display_form() (line 76 ....
Any ideas on how to fix?
Also do you know of a way to make the video pop-up in a lightbox?
Thanks for all your help!
really very nice this
really very nice this tutorials.. I followed dis steps to create a video gallery.. but video doesnt paly..
Can u help me to play a video?
Thanks
The tutorial is really good,
The tutorial is really good, thank you!
But I have a problem.. Before saving on the edit page video is displayed as a thumbnail, but after saving as a link. I use Media 7.x-1.0-rc2, and the order of files display is video, preview image, image and only then - url to file.
Can you help me? Thanks a lot!
Hello,, Im getting this error
Hello,, Im getting this error on the manage file display page.... Notice: Undefined index: label in file_entity_file_display_form() (line 76 .....and no options appear to check for youtube video or youtube preview. stumped.
Hello pferlito, The tutorial
Hello pferlito,
The tutorial was great.
But I dont know, it is not wokring with me. I have done all the steps you have said and then I gave a demo youtube url. But the video is not playing and it is just showing a small screenshot. Am I missing anything. What I need for the media to be played? And also I want not youtube but videos to be uploaded and shown from my server itself. What should I use?
It would be great if you can help me out.
Thanks in advance.
Go back to "Configuration ->
Go back to "Configuration -> Media -> File types" and drag "YouTube Video" above "YouTube Preview Image" under "Display precedence order" on the "Manage File Display" tab for the Video file type. That should solve your issue.
Thank you so much for this
Thank you so much for this tutorial. I am a newbie in Drupal and I was trying to get a youtube gallery in my site.. I have been trying this for a week... This tutorial helped to do it in no time!! Thank you so much...
Thank you so much for taking
Thank you so much for taking the time to make this great tutorial. It was exactly what I needed and I had a video gallery up and running in Drupal 7 in about 10 minutes!
Post new comment