Insert Iframe instead of file

Insert Iframe instead of file

by Nuno Horta -
Number of replies: 4

I developed a Repository plugin that lists video files. But instead of copy/download the file to moodle, I want to choose the video and to be displayed a specific iframe that I'm returning externally.

But it needs the source parameter for each file and it only accepts specific formats (.mpg, .mp4, etc). How can I solve this?

Average of ratings: -
In reply to Nuno Horta

Re: Insert Iframe instead of file

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Other repositories achieve this via filters. Just make sure you output a URL you can later identify via a filter.
In reply to Davo Smith

Re: Insert Iframe instead of file

by Nuno Horta -

from what I've looked into multimedia filters...they just filters certain type of videos. Example: if you insert a link referring youtube, it will use the youtube player or if you have a link with a .mp3, it will use the mp3 player. 

What I have is a link that has my own player, so I have to displayed as an iframe.

In reply to Nuno Horta

Re: Insert Iframe instead of file

by Matt Bury -
Picture of Plugin developers

I think iframes are well worth looking into for embedding content. Despite the notion that some web developers think they should be deprecated, they have some unforeseen benefits especially for supporting media types.

I discovered an strange browser behaviour with supposedly unsupported video formats that I shared here: https://moodle.org/mod/forum/discuss.php?d=232352

They're good for all kinds of objects and there are loads of iframe plugins for Wordpress.

Another thing is that iframes allow for W3C.org compliant object and media embed methods that require Javascript to run in the head section of the page. The way that Moodle's page rendering works, it makes many JS embed methods ugly, hacky, and/or unworkable.

In reply to Matt Bury

Re: Insert Iframe instead of file

by Nuno Horta -

Hey !

I managed to solve this via a specific filter. That strange behaviour that you shared it may be related with the multimedia filter that read the format and because it's unsupported by moodle an error was showing up.

Now a quick question about filters. How can I filter the content on the preview? Like youtube repository does?