SmartVideo needs a JavaScript loader in your Moodle site’s <head>. With the loader installed and auto-replace on, SmartVideo replaces Vimeo embeds automatically. It imports Vimeo videos whose Who can watch setting is Anyone; password-protected and Only me videos stay on Vimeo. Open each course page containing a Vimeo embed once while logged in to start conversion. For any other video, add a <smartvideo> tag. You need a site administrator to install the loader, plus permission to edit the course content.
YouTube conversion is best-effort: YouTube’s download restrictions mean some videos convert and some don’t. For playback you can rely on, download the video, upload it to your SmartVideo library, and copy its SmartVideo tag for your course resource.
Step 1: Install the site-wide loader
- As a site administrator, open Site administration → Appearance → Additional HTML.
- Paste your SmartVideo snippet into Within HEAD, keeping any existing code in that field.
- Save the changes.
See Moodle’s Header and footer documentation.
Copy your snippet from the Configuration tab in the Swarmify dashboard, or use this template with your Swarm CDN Key:
<script data-cfasync="false">
var swarmoptions = {
swarmcdnkey: "YOUR_SWARM_CDN_KEY",
iframeReplacement: "iframe",
autoreplace: {
youtube: true
}
};
</script>
<script async data-cfasync="false" src="https://assets.swarmcdn.com/swarmcdn.js"></script>
Replace YOUR_SWARM_CDN_KEY with your actual key. If your Moodle hosting provider does not allow site-wide head scripts, this setup cannot run SmartVideo; ask the provider whether it can enable them before continuing.
Step 2: Add a video to the course
Use a Text and media area course resource, not a sidebar block:
- Open the course and turn on Edit mode.
- In the section where the video belongs, select Add content → Activity or resource (on sites without subsections, the button reads Add an activity or resource), then choose Text and media area.
- In the content editor, switch to HTML source editing:
- In TinyMCE, use Tools → Source code.
- If your site still uses Atto, use the HTML button.
- Paste the tag below into the HTML, replacing the example
srcwith your video file URL. - Apply the source edit and save the course resource.
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls>
</smartvideo>
The source must return the video bytes to an anonymous request, without a login, and remain available for as long as the video is embedded. Do not use an expiring or signed URL.
See Moodle’s Text and media area, TinyMCE editor, and Atto editor documentation for the course and editor controls.
Step 3: Check the saved course page
Open the saved course page and test playback. If the video tag disappears when you save, ask your Moodle administrator to check whether the editor or site HTML filtering is removing it. Keep the JavaScript loader in Within HEAD, not in the course editor.
If you need help, use the support widget in the bottom-right corner.
Hosting course video? See the LMS video hosting overview.