Page 1 of 1

How Can I add Video on Knowledge base

Posted: Sat Jan 30, 2016 5:10 am
by clio_pasta
Hi,

instead of posting a link for video, I want customer see the video and just click "play" to watch the tutorial.

Please advise if possible

Re: How Can I add Video on Knowledge base

Posted: Sat Jan 30, 2016 12:07 pm
by Klemen
There is a "HTML" button allowing you to modify article source code directly.

For example to show a Youtube video, you can add such an iframe:

Code: Select all

<iframe width="330" height="240" src="http://www.youtube.com/embed/9ZIrYLiv9lI" frameborder="0" allowfullscreen></iframe>

Re: How Can I add Video on Knowledge base

Posted: Mon May 30, 2016 11:57 am
by faruxx
i used jvideo.com for my local videos

Re: How Can I add Video on Knowledge base

Posted: Fri Aug 26, 2016 4:57 pm
by greghl
The solution provided here is only a partial solution - because once submitted cleanup is done within the 'admin/manage_knowledgebase.php' file - and no amount of tinkering with the javascript function tinyMCE.init was seemingly able to let me save a kb article with an embedded video.

The knowledge base article is 'cleaned' using the HTMLpurifier library with default settings:

Code: Select all

        // Clean the HTML code
        require(HESK_PATH . 'inc/htmlpurifier/HTMLPurifier.standalone.php');
        $purifier = new HTMLPurifier();
        $content = $purifier->purify($content);
This has the effect of removing your iframe and it took me quite a while late last night to work out that this was the problem, not the original tinyMCE issue.

So - my fix was to alter 'admin/manage_knowledgebase.php' to allow iframe embeds of videos, but only from vimeo + youtube - my code is now:

Code: Select all

        // Clean the HTML code
        require(HESK_PATH . 'inc/htmlpurifier/HTMLPurifier.standalone.php');
        $config = HTMLPurifier_Config::createDefault();
//allow iframes from trusted sources
        $config->set('HTML.SafeIframe', true);
        $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%'); //allow YouTube and Vimeo
        $purifier = new HTMLPurifier($config);
        $content = $purifier->purify($content);
Voila - I can now save KB articles with youtube/vimeo videos. My hint came from a lot of searching and the solution eventually 'clicked' after reading section 4.3 of the HTMLPurifier installation guide:

http://htmlpurifier.org/live/INSTALL

I hope this helps - and would encourage the Hesk developer teams to incorporate limited embeds within the next release, and possibly upgrading tinyMCE to the latest version with a customizable editor for admins to set different editors for our staff members.

Re: How Can I add Video on Knowledge base

Posted: Fri Aug 26, 2016 5:59 pm
by Klemen
This used to work before 2.6.8 when HTMLPurifier was implemented.

Thanks for sharing your solution. The video embedding will indeed be supported back in 2.7.0 using a custom filter (to also allow properties such as allowfullscreen).

Re: How Can I add Video on Knowledge base

Posted: Fri Aug 26, 2016 6:14 pm
by greghl
Thank you for the info Klemen!