Images Adapted from: http://goo.gl/A5G0P and http://goo.gl/ziz58
Although, by this time, the advice in this blog entry is second-nature to me, especially since I first wrote about it in regards to Moodle 1.9.x, it’s still a question that pops up periodically:

How do you embed video in Moodle?

This blog entry shares one approach that can be accomplished in 3 steps:
  1. Turn on Multimedia Filters
  2. Allow embedding of third party code
  3. Modifying your PHP.ini file to allow larger file sizes.
And, of course, there’s a 4th possibility that’s optional for low-tech folks who may not be able to edit their PHP.ini file.

1-TURN ON MULTIMEDIA FILTERS
To display HTML5 Video/Audio, MP4, AVI, WMF, MPG, SWF, FLV and other video formats easily just enable your Multimedia Plugins. 

To accomplish that, go to SITE ADMINISTRATION->PLUGINS->MANAGE FILTERS in your Moodle 2.2x site as shown below:


Find the greyed out Multimedia Plugins and turn them ON:

Then click on the SETTINGS and adjust them as follows:
2-GRANT EMBED CODE PERMISSION
If you plan to embed videos from sources like YouTube/Vimeo or elsewhere, you will want to make one more modification in your SITE ADMINISTRATION->SECURITY->SITE POLICIES:
Then, scroll down and enable these settings as shown below:
Making this change will allow you to embed content from other sources that have the EMBED CODE button.
If you want to embed your own video, you can also use this sample embed code here – http://goo.gl/GWq2L
Note that I’ve had mixed results with this embed code; it works with SWF, but probably not with other video formats. 
Here is a screenshot:


Another solution for embedding video that works quite well is JWPlayer:

  1. Download JWPLAYER, a free Flash video player and put it on your server in a directory somewhere that’s easy to link to.
  2. Use this embed code (copy-n-paste the code into HTML block while in HTML view) replacing the the 2 links. The first link goes to the location of JWPlayer’s “player.swf” file and the second link to your video
  3. Try it out!

I like JWPlayer quite a bit…well worth trying out.




3-ADJUSTING YOUR PHP.INI FILE

One final adjustment you will want to make. Often, video files are quite large. Uploading them to a Moodle 2.2 site may mean putting video files that are 50 megs or more on the server. To upload such large file sizes, you will certainly need to adjust the PHP.ini file on your server:
To find the PHP.ini file on an Ubuntu server, look here:
and then make the following adjustments:
post_max_size = 2000M
mysql.connect_timeout = -1
max_execution_time = 5000
max_input_time = 5000
memory_limit = 500M

file_uploads = On
upload_max_filesize = 2000M

Note that 2000M is the equivalent of 2gigs, far more than you should be trying to upload. I like to have space to play, however. Feel free to adjust the actual amount to whatever you deem appropriate. If you’re going to be placing a lot of videos in your Moodle course, I recommend considering #4 alternative below. The reason why is that uploading videos into your Moodle instance will “balloon” the size of the Moodle instance, which can be a pain when making a backup of a course)
4-AN ALTERNATIVE TO ADJUSTING YOUR PHP.INI FILE
If you don’t have access to your PHP.INI file, then I would recommend you use a video hosting service (e.g. YouTube, Vimeo Plus for $60 annual cost). I’ve investigated lots of alternative video-hosting providers and keep coming back to these two as great solutions. Whether they will work depends on your environment (e.g. in some school districts, YouTube is blocked).
If neither of these is an option, you have another approach you can take that involves you hosting your videos in a server directory. This approach means that you have some way to get videos onto the server, and it could take any one of the following approaches:
  • A mapped drive/directory that allows you to link to the videos. Note that the “drive mapping” really needs you to be able to have access to a folder on the web server that is accessible via the Web. You 
  • FTP rights to a video folder where you’re going to store content. The FTP approach will allow you to upload your files to a server directory, then use the absolute link so that you don’t end up embedding lots of videos in your Moodle.
  • Use PMWiki Storage Approach outlined below:
PMWiki Solution:
PMWiki.org–a PHP only wiki, no MySQL needed–has a great self-hosted wiki solution that would work as a video repository without having to grant anyone FTP rights. I use PMWiki when I need a simple, non-MySQL-based wiki.

With the addition of a few add-ons to PMWiki, I had a simple solution that allowed end users to access a single page, upload their documents, images, whatever, but that they had to login to. It looks like this:

Reflecting on this solution, I’m reminded about how important it is to be aware of the capabilities of all the tools in your arsenal. . .implementing this solution–training the end users–was FAR easier than the Moodle solution I jumped to. And, Moodle was only arrived at extensive efforts at customizing SFTP settings.

 If you’re interested in this approach, let me know! I can bottle up a PMWiki all setup and share that so you can save yourself some PMWiki configuration work.

UPDATE – Comment from Jon Fila (Moodleshare.org):

Jon Fila shared this in an email (my apologies to those who have trouble leaving comments):

Hi Miguel, I just read your blog post on embedding video in Moodle 2.2:
http://www.mguhlin.org/2012/01/embedding-videos-in-moodle-22.html
I’ve had some trouble with that so that it would display in all browsers on all devices. I tried to leave a comment on your blog but the presence of my HTML tags didn’t work so well.
Feel free to spread this if you find it works:
It’s difficult to embed videos from a file in a way that will work in every browser on all devices. One thing I’ve done is to make sure my video’s dimension (I use MP4 so they’re iPad accessible) for width is around 800 or less. Also, I’ve been changing the embed code

This was the only way I could get it to show up in FireFox; Chrome; IE; Safari on PC & Mac.
I hope that makes sense,
Jon


Get Blog Updates via Email!

Enter your email address:

Delivered by FeedBurner



Everything posted on Miguel Guhlin’s blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure
Advertisements