This might be related to the embedding code you use and some flash parameters you define there. I had to play around with some parameters to get my flash object working on the html editor. Not sure this is the case in the wiki modukle as well.
Does this work when you try to embed the object in a regular HTML page on moodle.
Yup, works fine on the center activity. Appears to be only an issue within the Wiki activity.
do you have access to the code ?
so you can check something for me...
like... that you filter out swf files with format_text() function ?
look for something like :
format_text($this->content, FORMAT_HTML);
i had this issue on several places (3rd party plugins)
here is a link to a patch that adds a new "insert embed" button
to the toolbar of the internal "HTML Area" editor (moodle versions 1.9.x)
http://tracker.moodle.org/browse/MDL-20363
enjoy
Hope that helps.
I've had no trouble inserting YouTube and similar videos into OUwiki in the same way as I do in the other HTMLarea editors (forums, Glossaries, Blogs...) on Moodle:
- Copy the URL of the video (not the embed code) on YouTube
- In the text editor in Ouwiki, write a word (any word, it won't be visible later),
- Select the word,
- Click on the link icon in the toolbar,
- Paste in the URL of the video, click on OK
- You'll see your word has become a link but you won't see the video until you ...
- Click on Save changes.
Cheers,
Glenys
Those steps just don't work for me in the Wiki or OuWiki activities, but work fine on other html areas like you said.
This work around doesn't work on my Moodle account either. Is there some setting in the Adminstration area that I need to change?
this problem is related to the filtering capacities of the moodle code.
It's just erasing your <iframe> tag or whatever your using to embed video.
to solve the <iframe> filtering of moodle :
Just add <iframe> in the allowed tag list in moodle/lib/weblib.php about line 88
http://moodle.org/mod/forum/discuss.php?d=138083
now I'm able to embed an iframe in wiki or database and probably others activities.
Be sure of knowing what you're doing with this small hack, it's not very safe to do that, that's why moodle is filtering this type of tag... but it's work.
Denis
A couple follow-up questions:
We recently upgraded to Moodle 2.0. We would like to embed glogster pages in our student wikis (projects).
The embed codes are all iframes.
- Is the safety issue with iframes in wikis a security issue or a problem that I might mess something up if I edit moodle/lib/weblib.php (around line 88)
- Does this hack still work in v. 2.0?
- It appears that there are 3 different wiki versions. Do they deal with iframes differently?
- Is there a non-iframe way to embed these files that wouldn't require this hack?
An example of the embed code would be:
<iframe src= "url of glog here" width="960" height="1300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style="overflow: hidden;"></iframe>
Thanks
Yes, in Site Administration > Modules > Filters > Manage filters enable Mutlitmedia Plugins.
Cheers,
Glenys
See further down...
Has anyone found a solution to this yet? I have tried all the solutions and there is no change. The video is displayed in the editor but does not appear when previewed and saved.
It is possible i have found where the error occurs?
Editing the file ../mod/wiki/ewiki/ewiki.php
and changing the line n. 729 from:
$o .= $ewiki_plugins["render"][0] ($data["content"], $render_args);
to:
$o .= $data["content"];
works in my environment.
Is this a step toward a workaround?
Hi All,
Reading through this thread, this appears to be a pretty vexed issue that has not yet gone away! It certainly appears to be the case that in Moodle 2.0(.1) YouTube videos are handled differently inside a wiki to the way they are handled in a course topic or similar general location.
In a course topic the whole object/embed content (or even the iframe) copied from youtube's embed panel can be pasted into the html editor, saved and displayed as a video. This object takes its size and settings from the copied code, and so even 3D glasses options will work INSIDE moodle without the need to link out.
Of course, you cannot paste such content in at all if object/embed code is specifically outlawed in...
Admin -> Security -> Site Policies 'Allow EMBED and OBJECT tags' = No
unless also in the same site policies 'Enable trusted content' = Yes,
AND the user's role settings say their content will be trusted!
More strictly, you can paste it in, but you find it remove or deactivated. But aside from these permissions issues, this embedding method of getting youtube content into a topic works a treat!
In the wiki, however, we do not seem to be playing by the same rules! This may well be forced onto the situation by the notion of the wiki being a collaborative activity (generally speaking), so if you can't 'trust' the content from one user, how can you trust the content from another! If this is the view taken, which seems likely, then object/embed & iframe entries pose a security risk (or at least the risk of unacceptable content), and these get removed even if you are a trusted being! So what about using other possible routes?
Yes, you can enable the Multimedia plugin filter for youtube videos and that works consistantly inside and outside a wiki. As we know, this means that if you enter some text, highlight it, click the hyperlink button, and then paste in the url of the video. Such as: youtube.com/watch?v=0GcLW0g_c1s. Note however, that this url needs to be take from youtube's 'share' panel, not the 'embed panel' because they are quite different. The 'share' version works with the filter, whereas the embed version youtube.com/embed/0GcLW0g_c1s does not! This is simply because the filter is looking for ?v= in the url, and in the latter version it isn't gong to find it! [note I've had to cut the http etc to stop this link linking!!!]
So for moodle to behave consistantly we need to be consistant too. And there is obviously room for confusion here.
There is also a method involving the use of a [youtube] tag each side of the url, as explained here: http://docs.moodle.org/en/Multimedia_plugins#YouTube_Link_Filter
but I'm still not clear as to how that is different from simply using the media filter described above.
However, the multimedia filter may solve one problem, but it creates another. Elsewhere it has been explained that you can change the size of the display in some types of media by trailing it with d=400x300 (or similar), but the youtube instance of the filter strips these out. in fact it strips out all the content after the ? except the v=#### video reference. This means that using the multimedia filter to give youtube content results in a loss of control of the size of the video in the wiki, and leaves out all the options (such as the colour of your 3D glasses)!
So we appear to have away to go on this as yet.
Regards,
John
The default embedding code provided by YouTube is now with the iframe tag, not the object or embed tag.
The iframe tag to embed videos works in a label or page in Moodle, but not in the wiki.
After following the above suggestions from John, I embedded a YouTube video using the object tag.
For example:
<object data="
Then it worked for me
To learn more about these tags, see http://www.w3schools.com/html/html_youtube.asp
Having thought about this a bit more, I think Franco's solution above may work but will have unintended consequences (such as switching off filtering you want left on).
So I have set about finding a fix for the underlying problems.
Firstly, not being able to supply dimensions to the youtube filter the way you can to Quicktime or Flash video. This only really requires a few changes to the file /filter/mediaplugin/filter.php
We find the line
if (!empty($CFG->filter_mediaplugin_enable_youtube)) {
and make changes as highlighted (copy and paste, but only in a proper HTML editor, eg Smultron, Fraise, Ultraedit)
if (!empty($CFG->filter_mediaplugin_enable_youtube)) {
//see MDL-23903 for description of recent changes to this regex
//$search = '/<a.*?href="([^<]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
$search = '/<a[^>]*href="([^<]*?)youtube.com\/watch\?v=([^&"]*)(&d=([\d]{1,3}%?)x([\d]{1,3}%?))?"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_callback', $newtext);
$search = '/<a[^>]*href="([^<]*)youtube.com\/v\/([^"\?]*)(\?d=([\d]{1,3}%?)x([\d]{1,3}%?))?"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_callback', $newtext);
}
Then we find the callback function filter_mediaplugin_youtube_callback and make these changes...
function filter_mediaplugin_youtube_callback($link, $autostart=false) {
$site = addslashes_js($link[1]);
$url = addslashes_js($link[2]);
$info = addslashes_js(strip_tags($link[3]));//strip out html tags as they won't work in the title attribute
if (empty($link[4]) or empty($link[5])) {
$size = 'width="425" height="344"';
} else {
$size = 'width="'.$link[4].'" height="'.$link[5].'"';
}
return '<object title="'.$info.'"
class="mediaplugin mediaplugin_youtube" type="application/x-shockwave-flash"
data="'.$site.'youtube.com/v/'.$url.'&fs=1&rel=0" '.$size.'>'.
'<param name="movie" value="'.$site.'youtube.com/v/'.$url.'&fs=1&rel=0" />'.
'<param name="FlashVars" value="playerMode=embedded" />'.
'<param name="wmode" value="transparent" />'.
'<param name="allowFullScreen" value="true" />'.
'</object>';
}
This should allow dimensions to but put in either in the form
http:// www .youtube.com/watch?v=6RFuRY7azgA&d=450x300
or
http:// www .youtube.com/v/6RFuRY7azgA?d=450x300
Note thank this depends entirely on the url you get from 'share' in youtube!
Finally we can also get Moodle to do the work on putting in an iframe that users are generally blocked from (along with object and embed). My reasoning here is that it must be safe for moodle to do in the say way as it embeds to object safely for you!
Here we add an extra trap in the filtering process inside the same braces as before (top of this post)
$search = '/<a[^>]*href="([^<]*)youtube.com\/embed\/([^"\?]*)(\?d=([\d]{1,3}%?)x([\d]{1,3}%?))?"[^>]*>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_embed_callback', $newtext);
Note this adds a NEW function call so them we add a new callback function (below the current youtube one)
/**
* Change links to embedding Youtube content into iframe Youtube videos
*/
function filter_mediaplugin_youtube_embed_callback($link, $autostart=false) {
$site = addslashes_js($link[1]);
$url = addslashes_js($link[2]);
$info = addslashes_js(strip_tags($link[3]));//strip out html tags as they won't work in the title attribute
if (empty($link[4]) or empty($link[5])) {
$size = 'width="640" height="390"';
} else {
$size = 'width="'.$link[4].'" height="'.$link[5].'"';
}
return '<iframe title="YouTube video player" class="youtube-player" type="text/html" '.
'src="'.$site.'youtube.com/embed/'.$url.'" '.
'frameborder="0" '.$size.'>'.
'</iframe>';
}
And THIS allows you to use the youtube embed content, BUT WITHOUT THE IFRAME STUFF ARROUND IT. Like so:
http:// www .youtube.com/embed/6RFuRY7azgA
And add dimensions, like so:
http:// www .youtube.com/embed/6RFuRY7azgA?d=640x390
I've tested this moderately well though only on Firefox.
Thats all for now.
John
[note: I have inserted a couple of spaces in urls to stop them linking! - there must be a better way?]
I don't know if this will help anyone but it started working for me (in 1.9.10) when I disabled CamelCase linking.
Yes! Thank you! This helped me! I have been adding videos to a wiki that my pupils have been creating about our lessons. The first one was added as a simple link (to the video file uploaded in the file area of the course) and it worked! But then any subsequent links were not showing. Disabling the Camel Case links works wonders-I can now see all videos!
Phew! I was getting a bit worried when seeing all the technical changes mentioned in the previous posts. Thanks Ruth!
Hi D Vass,
Will you please explain how I can disable Camel Case links?
Thanks
In Moodle 2.5, I too am having the same problem. Any suggestions for correction?
Thanks,
Toni
Hey all,
This drove me nuts- I knew how to embed code and it works great on pages and labels, however this is the missing piece when I tried to embed video code in a glossary:
- For security reasons, iframe code is not allowed in Moodle activities to which all class members can contribute, including Assignment submissions, Wiki, Forum, Database andGlossary activities. In these activities iframe-embedded video displays in the HTML editor, but will be stripped out when posts or submissions are saved.
Found on UMass Amherst site https://www.it.umass.edu/support/moodle/embed-video-or-audio-a-moodle-page#Embed Media Using iFrame Code (Instructors Only)
Joe
So embedding of youtube into wiki is not possible.
Is it possible to use a normal link to a youtube-video and the moodle-filter converts the link into an embeded video?