iframes, Questionnaire, site policies

iframes, Questionnaire, site policies

by Matt Fedorko -
Number of replies: 7

All, I'm not sure which version of Moodle I'm using -- it's not my "normal Moodle," but a project that I'm working on, and I'm just a Teacher. Pretty sure it's some flavor of 2.6. (Maybe there's a way to figure it out without being an admin? Would appreciate knowing).

I've got an open post over in the Questionnaire forum about youtube videos not embedding there because, I think, it's stripping the iframe (https://moodle.org/mod/forum/discuss.php?d=310668). I'm working on what to do if the problem isn't repairable from the Questionnaire side of things, and I stumbled upon two settings in the Site Admin > Security > Site Policies section that might help me, and I was wondering if anyone could illuminate me:

1. Allow EMBED and OBJECT tags -- I don't think this is the ticket, but maybe so.

2. Enable trusted content. -- https://docs.moodle.org/22/en/Site_policies#Enable_trusted_content

My reading of that seems to say that if I have the admin give "Teachers"  the appropriate Capability (or create a special role that's a clone of Teachers with the added capability that the Docs mentions), then turn that setting on, then iframes won't be scrubbed from Questionnaires. Is that accurate?

I will be trying to test this out if I can on a different Moodle, but I was hoping someone could just tell me as well, so I know if it'll work on this other Moodle.

Thanks.

Average of ratings: -
In reply to Matt Fedorko

Re: iframes, Questionnaire, site policies

by Matt Fedorko -

I tried my solution on my own Moodle (2.6.9 with an up-to-date Questionnaire plugin), and it did not work. I'm not sure if it would work in other places where iframes may be getting stripped, but it had no affect on Questionnaires. 


In reply to Matt Fedorko

Re: iframes, Questionnaire, site policies

by john Simpson -

A simple way of displaying a youtube video on moodle is to copy the link, press control- click right with mouse - and select paste.

In reply to Matt Fedorko

Re: iframes, Questionnaire, site policies

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

iframes get stripped at the html editor level. When you save the html content.

That is why when you paste in the iframe you can see it immediately, but after saving it is suddenly gone. I think there is somewhere in the settings to turn this off, at least there used to be. 

But for Youtube videos just inserting YouTube links is enough. Moodle will spot the link and replace it with the iframe for you. So just make a text link that points to the youtube video. Or even easier, use the YouTube repository from the MoodleMedia icon on the html editor to select the Youtube video. You will need the multimedia plugins filter enabled. This is enabled by default usually though.

In reply to Justin Hunt

Re: iframes, Questionnaire, site policies

by Matt Fedorko -

Thank you both for your replies.

I understand how Moodle's Multimedia filters work, though I generally keep them off because of the unpredictable nature of them. I much prefer to just work with the embed code, which is simple, easy to understand, and easy to customize. It is also not stripped in numerous places -- I can put YouTube videos inside quiz questions, inside Lessons, inside Pages and Books, inside Labels on the main page, and so on. Just not in Questionnaires, apparently.

Again, it is true that turning on the multimedia filter would get me to where I want inside a Questionnaire. However, what I did not say here, but did in the other posting, is that the areas I would like to embed videos also include numerous links to other videos that I DO NOT want to embed. Turning on the multimedia filters turns all of those links automatically into embedded videos. So where I want a page with one embedded video and external links to 7 videos, I now have a page that's trying to load 8 embedded videos. 

See what I mean by the multimedia filter wrestling control from the user? 

Is there a way to make the multimedia filter ignore certain links? That would be a solution for me...

In reply to Matt Fedorko

Re: iframes, Questionnaire, site policies

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Matt,

Easiest way I have found to stop the Multimedia plug-in converting your links into embedded videos is to send the YouTube link through a URL shortening service like Bitly... You can then have embedded YouTube videos and all of your non-embedded videos as bit.ly links underneath...

For example:

-----------------------

http://bit.ly/1FGkqos

Jon

Average of ratings: Useful (1)