video embedding

Please report here problems and bugs
Post Reply
hryhorash
Newbie
Posts: 6
Joined: Fri Aug 31, 2018 12:06 pm
Version: forma.lms 2.0

video embedding

Post by hryhorash » 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?

User avatar
max
FormaLms Guru
Posts: 1912
Joined: Thu Mar 01, 2012 10:41 am

Re: video embedding

Post by max » Mon Sep 10, 2018 2:57 pm

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
http://www.elearnit.net
http://www.linkedin.com/in/massimilianoferrari
m.ferrari[at]elearnit.net
http://elearnit.wordpress.com
Skype: m_ferrari_it

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

Re: video embedding

Post by hryhorash » Mon Sep 10, 2018 3:20 pm

thanks

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

Re: video embedding

Post by hryhorash » Thu Sep 20, 2018 3:56 pm

if there will be a quick fix for this issue in the code, please let me know.

User avatar
hakangur
Newbie
Posts: 4
Joined: Sat Jul 21, 2018 1:27 pm
Version: forma.lms 2.0
Contact:

Re: video embedding

Post by hakangur » Sat Mar 09, 2019 4:55 pm

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
FormaLms Master
Posts: 257
Joined: Fri Nov 24, 2017 8:45 am
Version: forma.lms 1.4.2

Re: video embedding

Post by alfa24 » Sat Mar 09, 2019 7:06 pm

I'm Jasmines, the One

User avatar
hakangur
Newbie
Posts: 4
Joined: Sat Jul 21, 2018 1:27 pm
Version: forma.lms 2.0
Contact:

Re: video embedding

Post by hakangur » Sun Mar 10, 2019 3:36 pm

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: 1912
Joined: Thu Mar 01, 2012 10:41 am

Re: video embedding

Post by max » Mon Mar 11, 2019 2:12 pm

Thank you hakangur and thank you alfa24 for your contributions.
---------------------
Massimiliano Ferrari
Elearnit - Elearning e Knowledge Management
http://www.elearnit.net
http://www.linkedin.com/in/massimilianoferrari
m.ferrari[at]elearnit.net
http://elearnit.wordpress.com
Skype: m_ferrari_it

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

Re: video embedding

Post by hryhorash » Tue Mar 12, 2019 9:10 am

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 3 times

Post Reply