video embedding

Anything about what happens on the user and teacher side
hryhorash
Newbie
Posts: 9
Joined: Fri Aug 31, 2018 12:06 pm
Version: forma.lms 2.0

video embedding

Post 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?
User avatar
max
FormaLms Guru
Posts: 2735
Joined: Thu Mar 01, 2012 10:41 am
Version: forma.lms 2.4
Contact:

Re: video embedding

Post 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.
---------------------
Massimiliano Ferrari
Elearnit - Elearning e Knowledge Management
https://www.elearnit.net
https://www.linkedin.com/in/massimilianoferrari
m.ferrari[at]elearnit.net
Skype: m_ferrari_it
hryhorash
Newbie
Posts: 9
Joined: Fri Aug 31, 2018 12:06 pm
Version: forma.lms 2.0

Re: video embedding

Post by hryhorash »

thanks
hryhorash
Newbie
Posts: 9
Joined: Fri Aug 31, 2018 12:06 pm
Version: forma.lms 2.0

Re: video embedding

Post by hryhorash »

if there will be a quick fix for this issue in the code, please let me know.
hakangur
FormaLms User
Posts: 27
Joined: Sat Jul 21, 2018 1:27 pm
Version: forma.lms 2.0

Re: video embedding

Post 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.
alfa24
Senior Boarder
Posts: 1982
Joined: Fri Nov 24, 2017 8:45 am

Re: video embedding

Post by alfa24 »

Per supporto GRATUITO contattatemi in privato qui
hakangur
FormaLms User
Posts: 27
Joined: Sat Jul 21, 2018 1:27 pm
Version: forma.lms 2.0

Re: video embedding

Post 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.
User avatar
max
FormaLms Guru
Posts: 2735
Joined: Thu Mar 01, 2012 10:41 am
Version: forma.lms 2.4
Contact:

Re: video embedding

Post by max »

Thank you hakangur and thank you alfa24 for your contributions.
---------------------
Massimiliano Ferrari
Elearnit - Elearning e Knowledge Management
https://www.elearnit.net
https://www.linkedin.com/in/massimilianoferrari
m.ferrari[at]elearnit.net
Skype: m_ferrari_it
hryhorash
Newbie
Posts: 9
Joined: Fri Aug 31, 2018 12:06 pm
Version: forma.lms 2.0

Re: video embedding

Post 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
Attachments
lib.filterinput.zip
(2.76 KiB) Downloaded 321 times
hryhorash
Newbie
Posts: 9
Joined: Fri Aug 31, 2018 12:06 pm
Version: forma.lms 2.0

Re: video embedding

Post 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
Post Reply