Your Moodle version

TinyMCE: YouTube Anywhere

Maintained by Picture of Justin Hunt Justin Hunt
YouTube Anywhere enables direct recording and uploading into YouTube from the TinyMCE HTML editor.

YouTube Anywhere allows students and teachers to record directly from webcams and mobile devices, or to upload video files, into YouTube. 

YouTube takes care of the storage of the videos and handles all the pesky file conversions and playback stuff.

Care has been taken to give the Moodle administrator control over who can access YouTube Anywhere. Authentication with YouTube can be done  using the same Google keys as used in the Google Docs repository.

* Moodle 2.4 or greater
* Internet access
* Multimedia plugins filter enabled (to turn YouTube links into YouTube players)
* YouTube API keys (Public API Key, OAUTH2 client id, OAUTH2 client secret).
These are available free of charge from YouTube/Google.

The YouTube Anywhere plugin is contained in the youtube folder. That folder should be placed in the following directory of a Moodle installation: [PATH TO MOODLE]/lib/editor/tinymce/plugins
Other folders in that directory will include, spellchecker and moodlemedia.

Once the folder is in place Moodle will be able to install the plugin. Login as the site administrator. Moodle should detect the YouTube Anywhere plugin and present a page with plugin information and the option to proceed to install a new plugin. If Moodle does not automatically direct you to this page, you can go there from the Moodle menu:
Site Administration -> Notifications

Follow the prompts to install the plugin. On the last step Moodle will show the settings page for YouTube Anywhere. The settings can be accessed by the administrator at any time from the Moodle menu:
Site Administration -> Plugins -> Text Editors->TinyMCE HTML Editor -> YouTube Anywhere

Post Installation Settings
You will need several keys to authorize access to the YouTube API.
To get this go to:

You will need to create a project for your website. Only one is necessary for your Moodle site, and you can use the same keys for Google Docs or Picasa. If you are running either of those with Moodle, you can use the keys you already have. You will need to create and get:
i) a public api key
ii) an oauth2 client id
iii) an oauth2 client secret

This screenshot indicates how your API project on Google might look.

Google Developers Console

More information on getting Google OAuth2 set up for Moodle is here: 

There are two authentication methods possible, "master account" and "student account."
If using master account authentication, you will need to enter a valid YouTube username and password.

More detailed documentation can be found in a PDF file, that should accompany this plugin.




Picture of Justin Hunt
Justin Hunt (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Leon hedding
    Wed, Aug 14, 2013, 8:12 PM
    Justin, I am getting the following error when I try to insert a YouTube video into my post.

    Error 401

    I am certain I am logged into my YouTube account correctly as another tab is viewing YouTube and logged in. I am using student authentication in our site.

    Why would I use this plugin over the MyTube version or does this plugin replace it?
  • Picture of Justin Hunt
    Thu, Aug 15, 2013, 8:48 AM
    This and the Mytube repository do bascially the same thing. The YouTube Anywhere plugin requires fewer clicks to get it all done, and is easier to explain. But only works on 2.4 and above.
    I am not sure about that error. But I would try a few things.
    1) Completely close the browser and all browser windows. Then try again. That should make sure you are logging in as you think
    2) Are you using a full email address as your YouTube login. I think that is important.
    3) Check that your oath and client keys are all ok.

    Does that make a difference?
  • Picture of Roland Sherwood
    Mon, Aug 19, 2013, 11:38 PM
    Hi again Justin. Yes - if the plugin was somehow able to detect when https was in use I'm sure it would be useful for some; but please don't be too hard on yourself - what you've put together is still hugely impressive!

    If possible, I wonder if I could ask for one last bit of help before we release this plugin to our users. During trials with staff, a recurring request we came across had to do with making it possible for tutors to easily embed videos which already exist on YouTube (not necessarily their own). This functionality - simply entering a URL - was present in the beta release (i.e. via the $manual option) and is available in the YouTube submission plugin also. With this in mind, I've managed to restore the manual tab via uncommenting the relevant parts of youtubelib.php, but have hit a snag when it comes to the URL then being passed into the TinyMCE window itself. Basically, the desired URL becomes prefixed with the same address that's applied to uploaded or recorded vid IDs i.e. "", resulting in a broken player. I know this behaviour is controlled in /youtube/tinymce/js/youtube.js, but I just wondered if there's any easy fix for this (unfortunately, my own js skills are a bit limited)? Maybe something like an additional if statement that was able to parse manual URL entries? I do realise there are alternative approaches to doing what our tutors have in mind, but it would be really great in our eyes if YouTube Anywhere was a one-stop shop for all things YouTube-related.

    If you do have any ideas you'd be willing to share, I'd be very grateful.
  • Picture of Justin Hunt
    Tue, Aug 20, 2013, 11:03 AM
    Hi Roland

    I left that manual submit thing in because
    a) When testing it was quite useful to be able just paste a url rather than have to record something each time
    b) I thought somebody might like it, someday, somewhere

    So I am glad that some people do want to use it. Probably the simplest way of doing it is just to check if the length of the video id is greater then 11. If so consider it a URL and don't add the full youtube url.

    A quick "hack" to do this would be to add a line in /lib/editor/tinymce/plugins/youtube/tinymce/js/youtube.js:
    Around line 60, just after:
    var src = "";

    Add this line:
    if (vid.length > 11){src ="";}

    Next release of the plugin I will add switches and stuff to enable the manual tab.
  • Picture of Roland Sherwood
    Fri, Sep 6, 2013, 6:50 PM
    Hi again Justin. Apologies for the belated reply - the new term has kicked off here and it's been a little hectic these last few weeks...! Just to say, again, many thanks for all your help with my queries - especially with enabling the URL tab. This was the missing piece of the puzzle for us and staff are now happy to be able to embed videos so easily.

    It's plugins like this and developers like yourself that make Moodle so valuable, imo - so a big thanks for sharing your work with us!
  • Frankie's the name, Moodle's my game!
    Thu, Oct 17, 2013, 5:48 PM
    Hi Justin, I discovered that if I enabled Google's 2-step verification of my Google account, the Youtube Anywhere plugin can no longer be authenticated via Moodle. I have blogged on the solution here: Prior to solving the problem, I had spent more than 3 hours trying to fix the problem! LOL!!
  • Picture of Isabelle Langeveld
    Thu, Jan 16, 2014, 11:29 PM
    Hi Justin, I installed the plugin on 2.6 and followed all the instructions for the settings. I am logged in to Google/YouTube. Taking a recording and uploading it directly works fine. But I would also like to play my recording before I decide to upload and this doesn't seem to work. If I click on play it give a few seconds of sound, then breaks off I get the message that the connection is lost. Am I doing something wrong? My recordings were only about 10 seconds...
  • Picture of Justin Hunt
    Fri, Jan 17, 2014, 8:12 AM
    Isabelle, I have not encountered this myself. Generally once the connection is made it is pretty reliable. I have a lot of work to do on the plugin over the next few weeks and I will add looking at this to that. If you try from a different location is it better? ie Recording from behind a firewall gives a less reliable connection. But you might find it works better from home. That may not solve the problem, but it would give an idea of where it was coming from.
  • Picture of Dan Wheaton
    Fri, May 9, 2014, 12:55 PM
    I ahve been successfully using this all year, setup as a master account, but over the last couple of weeks it has stopped working.
    We have put in a new firewall, but the vendor is suggesting its not them.

    I can display videos fine via the plugin, but upload just gives me spinning bubbles forever. Are there are logs or anything I can look at to help troubleshoot ??
  • Picture of Dan Wheaton
    Fri, May 9, 2014, 12:55 PM
    Oh, I should also add, I can successfully upload to the same youtube account outside of moodle.
  • Picture of Dan Wheaton
    Fri, May 9, 2014, 2:05 PM
    Hi Justin
    Just 1 more thing, could you go into more detail about what needs to be commented to get the manual enter URL submission that Roland was referring to. I played aorund commenting in and out lines for about half an hour, but couldnt get the desired behavour.

  • Picture of Justin Hunt
    Mon, May 12, 2014, 8:35 AM
    Hi Dan

    One other user had a similar problem a few weeks ago where it just up and stopped working. After a lot of trying, we just couldn't find the problem. They also used master authentication. There is only the standard apache error logs, and they may not show anything. I sometimes get some information by using chrome developer tools, network tab, and seeing what happens with the request to the youtube server.

    I am not sure how better to explain the URL submission thing than I have above. Perhaps send me a "message" with your email address, and I can look at it.
  • Picture of Ricardo D
    Fri, Nov 21, 2014, 10:02 PM
    To: Leon hedding

    ERROR "NoLinkedYouTubeAccount" is described here:

    You need to create a channel in your youtube account.
  • feeling fuzzy
    Tue, Feb 3, 2015, 3:20 AM
    Hi Justin,

    I've just set-up Youtube anywhere with master authentication. I had expected that students would be able to record a video and that the result would be stored on the master account. However, when you start recording a video you are still asked to log in with your own google account - and the result gets stored there.

    Is this a known issue, or simply wrong expectation on my part (as in: there's no way to record video's this way without manually checking in with YouTube first)?
  • Picture of Justin Hunt
    Wed, Feb 4, 2015, 9:09 AM
    Hi Michael. Although it seems neat and simple to use master account authentication. In actual fact it is not so simple. The YouTube recorder does not use master account authentication. The user is required to login to YouTube.
1 2
Please login to post comments