fix(iframe_api): Passing config params is not working
This commit is contained in:
parent
08531ee675
commit
dbcd19418c
|
@ -80,6 +80,27 @@ function changeParticipantNumber(APIInstance, number) {
|
||||||
APIInstance.numberOfParticipants += number;
|
APIInstance.numberOfParticipants += number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates array with URL params based on the passed config object that will
|
||||||
|
* be used for the Jitsi Meet URL generation.
|
||||||
|
*
|
||||||
|
* @param config {object} the config object.
|
||||||
|
* @returns {Array<string>} the array with URL param strings.
|
||||||
|
*/
|
||||||
|
function configToURLParamsArray(config) {
|
||||||
|
const params = [];
|
||||||
|
|
||||||
|
for (const key in config) {
|
||||||
|
try {
|
||||||
|
params.push(key + '='
|
||||||
|
+ encodeURIComponent(JSON.stringify(config[key])));
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(`Error encoding ${key}: ${e}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs new API instance. Creates iframe element that loads
|
* Constructs new API instance. Creates iframe element that loads
|
||||||
* Jitsi Meet.
|
* Jitsi Meet.
|
||||||
|
@ -130,24 +151,16 @@ function JitsiMeetExternalAPI(domain, room_name, width, height, parentNode,
|
||||||
|
|
||||||
this.url += "#jitsi_meet_external_api_id=" + id;
|
this.url += "#jitsi_meet_external_api_id=" + id;
|
||||||
|
|
||||||
var key;
|
const configURLParams = configToURLParamsArray(configOverwrite);
|
||||||
if (configOverwrite) {
|
if (configURLParams.length) {
|
||||||
for (key in configOverwrite) {
|
this.url += '&config.' + configURLParams.join('&config.');
|
||||||
if (!configOverwrite.hasOwnProperty(key) ||
|
|
||||||
typeof key !== 'string')
|
|
||||||
continue;
|
|
||||||
this.url += "&config." + key + "=" + configOverwrite[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interfaceConfigOverwrite) {
|
const interfaceConfigURLParams
|
||||||
for (key in interfaceConfigOverwrite) {
|
= configToURLParamsArray(interfaceConfigOverwrite);
|
||||||
if (!interfaceConfigOverwrite.hasOwnProperty(key) ||
|
if (interfaceConfigURLParams.length) {
|
||||||
typeof key !== 'string')
|
this.url += '&interfaceConfig.'
|
||||||
continue;
|
+ interfaceConfigURLParams.join('&interfaceConfig.');
|
||||||
this.url += "&interfaceConfig." + key + "=" +
|
|
||||||
interfaceConfigOverwrite[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.frame = document.createElement("iframe");
|
this.frame = document.createElement("iframe");
|
||||||
|
|
Loading…
Reference in New Issue