Support for video in knowledge articles seems like it should be pretty straightforward but unfortunately history has proven otherwise. Standards have been shifting over time and the methods for displaying video in HTML have had varying levels of support depending on the browser. By default ServiceNow only supports out-of-date plugin methods of embedding video. While video support can certainly stand for some updating by ServiceNow, there are a few steps that can be taken now to allow for functional video use.
This method enables video to be used across the board in the HTML editor so it can be added wherever it is needed. It uses the HTML5 video tag and does require the user to be at least a little familiar with HTML but at this point that is difficult to avoid.
The first thing to do is whitelist the video and source tags in the HTMLSanitizerConfig script include. To do this replace this:
attribute:["width", "height", "controls", "autoplay", "loop", "muted", "poster", "preload", "src"],
attribute:["type", "src", "media", "sizes"],
To embed a video, open the article (or other record with an HTML field) and upload the video file.
Get the Sys ID of the attachment. An easy way that end users can do this is by clicking the “View” link next to the attachments.
Then copy the Sys ID from the URL.
Next click the “<>” icon to view the HTML source.
Paste in the following code, changing the value for the Sys ID parameter to that of the attachment.
<source src="/sys_attachment.do?sys_id=[Sys ID of the attachment goes here]&view=true" type="video/mp4" />
NOTE: mp4 video looks to have the best support across browsers at the time of writing. The video tag has a number of options that allow for tailoring the content to the browser, device size, and other things as needed.
Thanks for the info James, a couple of comments/questions. First it appears when we attach a video to a KB article it doesn’t work well on mobile(specifically iOS). Second performance seems to be pretty slow when hosting videos as attachments, even when my video is under 5MB it takes 10+ seconds for the video to buffer before playing. Any other suggestions as where to upload files within ServiceNow?
There are a lot of ins and outs of video across devices. iOS is pretty picky in what it will allow for video. I don’t have an immediate solution for you, but in the research I’ve done there are a couple possible fixes that can be made by optimizing the video for iOS and/or web. As I have time I’ll try and make some progress in that approach.
From the performance perspective some the same optimizations for the web could help, but it depends on ServiceNow’s support. Basically, some videos are set up to be able to stream well and some operate under the assumption that you’ll have the whole file available as when it’s stored on your computer. If you want to understand some of the details involved, here is an article that explains some of it pretty well.
As an alternative, most frequently, I’ve seen people host their video on YouTube so they don’t have to worry about those details. Instead of whitelisting the video and source tags, you’d need to whitelist the iframe tag. There are pros and cons to going this way but it’s certainly a lot simpler. The biggest potential downside I’ve heard is around security and the potential for someone to put in an iframe to malicious content. Generally the HTML fields are limited to folks that are part of your organization and for most organizations this hasn’t been a significant concern but for a few it has been. The advantage is that YouTube takes care of all the messy video support issues and it just works.
Here’s the snippet that can be added to the HTMLSanitizerConfig script include to whitelist the iframe tag:
attribute:["align", "frameborder", "height", "longdesc", "marginheight", "marginwidth", "name", "sandbox", "scrolling", "src", "srcdoc", "width"],
As I recall, I only had to make the HTMLSanitizerConfig change. I did it sometime ago and haven’t heard any complaints from my customers. Bill
Nice article, and it’s something I’ve come across again and again as the HTML Sanitizer just strips out any video links until you either switch it off for the KB description field, or set your White List correctly.
Generally the preferred solution has been YouTube hosting if your organizations information Security team will allow it. If you do place your videos on YouTube, remember to set your privacy setting for the videos and (stating the obvious) don’t show any personally identifiable or business confidential information (anonymizing your data before recording your video can take some time) and also wipe out your URL text on the video.
You will also need to configure some of the settings for the video on YouTube.
Ensure you have Selected ‘Unlisted’ under the Basic Info tab to stop anyone stumbling across your video, and under the Advanced Tab, under Distribution Options ensure ‘Allow Embedding’ is checked so that you can put it in your KB article. It’s also probably best to untick ‘Allow Comments’, the ‘Users can view ratings for this video’ and ‘Allow viewers to contribute translated titles, descriptions, and subtitles/CC’ options.
Using YouTube works seamlessly. Just put the link into your KB article and your are good to go. The video will start immediately once played (depending on your internet link).
YouTube Security info can be found here: https://support.google.com/youtube/answer/157177
Thanks, those are definitely good steps to consider.
Thanks James, you save my day !
We tried to do this, however, the load speed for files uploaded as attachment is pretty slow when used as a source for the video especially for 30 mins training videos (~100 – 140 GB).
Yeah, I’ve seen similar results. Unfortunately ServiceNow is not set up well for handling large video. For things like that I’ve most often seen companies use YouTube or some other video hosting solution.
This works well with some browsers (Firefox, Chrome …) but not with Chrome
There are a lot of potential places where things can break. When it’s just one browser then, from what I’ve seen and read, it is often a matter of support for the format of the video. Early on with the video tag in HTML 5 this was a major issue but has become less of an issue but not all formats for encoding a video are supported in all browsers. I believe mp4 videos using the H.264 format is the most common and generally supported across all browsers but there are a lot of alternatives and variations that may be causing a problem.
As has been discussed in some of the other comments, if you can use YouTube, Vimeo, or some other similar video service they generally handle these details for you.