How to Embed a LiveClass Session in Moodle
Embed a specific LiveClass session directly into Moodle so learners can join without leaving their course. This requires a server-side Moodle activity or local plugin to securely request a fresh embed URL for each page load.
Who this is for: Moodle administrators and developers
Before You Begin
Make sure you have completed the following:
Create a LiveClass session. Note its session ID. You do not need to retrieve or store the attendee invite token.
Allow your Moodle site. In LiveClass, go to Integrations → Embed → Allowed sites and add your Moodle origin, such as
https://learn.example.edu. Include the scheme and hostname, but not a path. Each subdomain is a separate origin.Generate an Embed API key. Go to Integrations → Embed and generate a key. Store it in your server-side Moodle/plugin configuration or secret manager. You can rotate or revoke it from the same page.
Test the embed. Under Integrations → Embed → Quick test, select the session and allowed origin. Use the temporary iframe snippet to check the browser behavior.
Important: The Embed API key is separate from the general LiveClass API keys under Integrations → API keys. It works only with the embed-launch endpoint and creates attendee access. Never expose it in Moodle page content, browser-side JavaScript, source control, or logs.
Step 1: Configure the Moodle Activity
Configure your Moodle activity or plugin with the relevant LiveClass session ID. Store the ID in private activity settings or maintain a server-side mapping between Moodle activities and LiveClass sessions.
A static Moodle Page or URL resource cannot safely store an expiring embed URL.
📸 Screenshot: Moodle activity settings with the LiveClass session ID field.
Step 2: Request an Embed URL
When Moodle renders the activity, its server must request a fresh embed URL from LiveClass.
Send a POST request to the following endpoint:
POST https://api.liveclass.io/v1/integrations/embed-launch
Authorization: Bearer <LIVECLASS_EMBED_API_KEY>
Content-Type: application/json
{
"sessionId": "<LIVECLASS_SESSION_ID>",
"embedOrigin": "https://learn.example.edu"
}
Keep the API key in server-side configuration. Check that the request succeeds before using the returned embedPath.
Build the iframe URL using https://app.liveclass.io as the base URL and the returned path.
📸 Screenshot: LiveClass Embed settings showing the API key and allowed Moodle origin.
Step 3: Add the Session to an Iframe
Render the returned URL in an iframe on the Moodle activity page.
Use the following iframe configuration:
<iframe
src="FRESH_URL_RETURNED_BY_LIVECLASS"
title="LiveClass session"
allow="camera; microphone; display-capture; autoplay; fullscreen; clipboard-write"
referrerpolicy="no-referrer"
style="width:100%;min-height:640px;border:0"
></iframe>
Replace FRESH_URL_RETURNED_BY_LIVECLASS with the URL generated by your server. Do not construct the URL manually.
Important security requirements:
Embed URLs expire after 10 minutes. Generate a fresh URL each time the activity page is rendered.
Exclude the rendered activity from page and CDN caching to prevent expired URLs from being reused.
Never store the embed URL in Moodle content or course backups.
Do not put an attendee invite token in the browser or iframe URL.
Use HTTPS for camera and microphone access.
📸 Screenshot: A LiveClass session displayed inside a Moodle activity.
Step 4: Map Moodle Activities to LiveClass Sessions
Choose the mapping method that fits your setup:
One session: Store the session ID in the activity's private settings.
Multiple sessions: Create a separate Moodle activity for each LiveClass session, or maintain a server-side mapping for each activity.
Each activity opens only the LiveClass session associated with its configured session ID. The embed does not provide a session catalog.
Step 5: Test the Embed
Sign in as an enrolled learner and open the Moodle activity from the configured HTTPS origin.
Allow camera and microphone access in the browser.
Confirm the iframe includes the required permissions, including
display-captureif learners need to share their screens.Check that the activity is not serving a cached, expired embed URL.
Test from an unregistered origin. The browser should refuse to frame the session.
Verify the session inside the Moodle page. Opening the embed URL in a separate browser tab does not test the
frame-ancestorspolicy.
📸 Screenshot: A learner viewing the embedded LiveClass session in Moodle.
Troubleshooting
| Issue | What to check |
|---|---|
| Embed URL has expired | Generate a fresh URL on the server and disable page/CDN caching for the rendered activity. |
| Embedding is not configured | Confirm the exact Moodle origin is registered under Integrations → Embed → Allowed sites. |
| Camera or microphone does not work | Use HTTPS and check browser permissions and iframe settings. |
| Session cannot load or returns a 504 error | Contact LiveClass support to check the /embed* API/CDN route. Moodle cannot add the required response security header itself. |
| Embed works in a tab but not inside Moodle | Test it within the Moodle page and verify the configured origin and framing policy. |
Alternative Without a Moodle Plugin
If you cannot develop a Moodle plugin, share the attendee join link through a restricted Moodle activity instead. Limit access to the intended learners, and do not paste an expiring iframe URL into Moodle content.
Conclusion
Embedding LiveClass in Moodle requires an approved Moodle origin, a server-side Embed API key, and a fresh URL for each activity page render. Configure session mappings carefully, disable caching for rendered embed URLs, and test access as an enrolled learner to provide a secure joining experience.