More work on proof of concept for Jitsi meetings in IDAA's Novi site.
This commit is contained in:
@@ -8,25 +8,29 @@
|
||||
<body>
|
||||
|
||||
|
||||
<h1>Jitsi Meetings External API</h1>
|
||||
<p>The URL parameters are passed from the Novi page that (will) contains this as an iframe.</p>
|
||||
<h1>Testing the Jitsi Meet iframe API</h1>
|
||||
<p>The URL parameters are passed from the Novi page that (will) contains this as an iframe. This will automatically set the attendees name, email address, and moderator status. The UUID is not currently used. There are <strong>many</strong> other options that can be set through the Jitsi API.</p>
|
||||
|
||||
<div id="jitsi_meet_external_api_container" style="height: 750px; width: 100%;"></div>
|
||||
<script src="https://jitsi.dgrzone.com/external_api.js"></script>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
// Get user info from URL parameters. Generated by the Novi page that contains this iframe.
|
||||
let novi_url_params = new URLSearchParams(document.location.search);
|
||||
let user_id = novi_url_params.get('uuid');
|
||||
let user_full_name = novi_url_params.get('full_name');
|
||||
let user_email = novi_url_params.get('email');
|
||||
let user_moderator = novi_url_params.get('moderator') ?? false;
|
||||
let user_moderator = novi_url_params.get('moderator');
|
||||
|
||||
// Jitsi Meet External API variables
|
||||
let domain = 'jitsi.dgrzone.com';
|
||||
let room_name = 'it-is-hot-outside';
|
||||
let display_name = user_full_name ?? 'Not My Name';
|
||||
let email = user_email ?? 'test+john@oneskyit.com';
|
||||
let isModerator = (user_moderator === 'true' || user_moderator === true) ? true : false;
|
||||
let email = user_email ?? 'test+unknown@oneskyit.com';
|
||||
// Replace spaces with plus symbol in email addresses
|
||||
email = email.replace(/\s+/g, '+');
|
||||
let is_moderator = (user_moderator === 'true' || user_moderator === true) ? true : false;
|
||||
|
||||
// 1. Function to fetch the JWT from your backend
|
||||
async function getJitsiJwt() {
|
||||
@@ -39,8 +43,9 @@ async function getJitsiJwt() {
|
||||
room: room_name,
|
||||
name: display_name,
|
||||
email: email,
|
||||
is_moderator: isModerator
|
||||
is_moderator: is_moderator
|
||||
};
|
||||
console.log("Requesting JWT with payload:", payload);
|
||||
|
||||
try {
|
||||
const response = await fetch(tokenEndpoint, {
|
||||
@@ -66,12 +71,15 @@ async function getJitsiJwt() {
|
||||
|
||||
// 2. Main function to initialize the Jitsi API with the JWT
|
||||
async function initJitsiApi() {
|
||||
const jwtToken = await getJitsiJwt();
|
||||
let jwtToken = null;
|
||||
if (is_moderator) {
|
||||
jwtToken = await getJitsiJwt();
|
||||
|
||||
if (!jwtToken) {
|
||||
// Handle the error (e.g., show a message to the user)
|
||||
document.getElementById('jitsi_meet_external_api_container').innerHTML = "<h1>Authentication Failed. Please try again.</h1>";
|
||||
return;
|
||||
if (!jwtToken) {
|
||||
// Handle the error (e.g., show a message to the user)
|
||||
document.getElementById('jitsi_meet_external_api_container').innerHTML = "<h1>Authentication Failed. Please try again.</h1>";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const options = {
|
||||
@@ -90,13 +98,14 @@ async function initJitsiApi() {
|
||||
enablePrejoinPage: false,
|
||||
enableWelcomePage: false,
|
||||
enableClosePage: false,
|
||||
enableLobby: isModerator,
|
||||
enableLobby: is_moderator,
|
||||
},
|
||||
// Pass the fetched JWT to the Jitsi API
|
||||
jwt: jwtToken
|
||||
};
|
||||
|
||||
const api = new JitsiMeetExternalAPI(domain, options);
|
||||
console.log("Jitsi API initialized with options:", options);
|
||||
}
|
||||
|
||||
// 3. Call the initialization function when the page loads
|
||||
|
||||
Reference in New Issue
Block a user