Page 1 of 2

video embedding

Posted: Mon Sep 10, 2018 2:22 pm
by hryhorash
While testing Forma 2.0 I encountered this problem: when course admin is trying to embed video from youtube in the html page, the resulting video is shown in editor but after saving it disappeares.

When I try to do the same as system SuperAdmin - I have no problem.
Am I missing something or is it a bug?

Re: video embedding

Posted: Mon Sep 10, 2018 2:57 pm
by max
Hi,

it is very strange, but it's true.... I opened a bug in our bugtracker, we'll try to fix this issue for one of the next releases.

Re: video embedding

Posted: Mon Sep 10, 2018 3:20 pm
by hryhorash
thanks

Re: video embedding

Posted: Thu Sep 20, 2018 3:56 pm
by hryhorash
if there will be a quick fix for this issue in the code, please let me know.

Re: video embedding

Posted: Sat Mar 09, 2019 4:55 pm
by hakangur
Using Forma 2.1

I want to add an audio file to a test question - "multiple choice" or "title". By means of the editor, I upload the audio file and add it to the "Question" field. Everything is in order so far (the code <audio src="../files/common/users/11837_63_1552142627_pd-1.mp3" controls="controls"></audio> is visible in code view). When I save the question, this disappears, just as it is reported here for embedded video files. Apparently, the editor field is stripped off such codes probably because of security reasons - or, at least this is what people in various forums for different CMSs report. The solution might lie in TinyMCE itself.

Re: video embedding

Posted: Sat Mar 09, 2019 7:06 pm
by alfa24

Re: video embedding

Posted: Sun Mar 10, 2019 3:36 pm
by hakangur
I would like to thank alfa24 for the quick and useful response.

For those who might be as bad as I am in coding, the thing to do is:
(1) locate addons/tiny_mce in your FormaLMS installation,
(2) find the file titled "forma.js",
(3) open the file with a text editor and add this line to, for example, line 25, so that you will not break any code:
valid_elements : '*[*]',
(4) save the file.
You will be able to add multimedia elements into your questions.

Re: video embedding

Posted: Mon Mar 11, 2019 2:12 pm
by max
Thank you hakangur and thank you alfa24 for your contributions.

Re: video embedding

Posted: Tue Mar 12, 2019 9:10 am
by hryhorash
hryhorash wrote: Mon Sep 10, 2018 2:22 pm While testing Forma 2.0 I encountered this problem: when course admin is trying to embed video from youtube in the html page, the resulting video is shown in editor but after saving it disappeares.

When I try to do the same as system SuperAdmin - I have no problem.
Am I missing something or is it a bug?
Found a fix. Works for Forma 2.1:

1. You need to open file /lib/lib.filterinput.php
2. Add the following code

Code: Select all

$config->set('HTML.SafeIframe', true);
$config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%'); //allow YouTube and Vimeo
$config->set('HTML.AllowedElements', array('iframe'));// <-- IMPORTANT
$config->set('HTML.AllowedAttributes','iframe@src,iframe@allowfullscreen');
under the line

Code: Select all

$config = HTMLPurifier_Config::createDefault();
in

Code: Select all

protected function loadTool()
Or you can simply replace the file with the attached one

It will allow iframe ONLY from Youtube & Vimeo. Will not allow fullscreen though

Re: video embedding

Posted: Tue Aug 06, 2019 11:28 am
by hryhorash
After updating to FORMA 2.2.1 my video embedding problems restarted.

By default it is possible to insert youtube video only under superadmin.

Previously described fix is also not working:
- it allows iframe
- the iframe is empty after saving :(

Is there a solution?

Thanks