From 44425b0267b0cae7647034b37c4bba50156dff9a Mon Sep 17 00:00:00 2001 From: Rajan Surani Date: Mon, 8 Apr 2024 12:46:28 +0530 Subject: [PATCH] meta data param added --- src/index.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index e073bbe..eeb063a 100755 --- a/src/index.js +++ b/src/index.js @@ -60,7 +60,14 @@ export class VideoSDKMeeting { }); } - async fetchToken({ apiKey, askJoin, participantCanToggleOtherWebcam, participantCanToggleOtherMic, partcipantCanToogleOtherScreenShare, apiBaseUrl }) { + async fetchToken({ + apiKey, + askJoin, + participantCanToggleOtherWebcam, + participantCanToggleOtherMic, + partcipantCanToogleOtherScreenShare, + apiBaseUrl, + }) { let BASE_URL = apiBaseUrl || "https://api.videosdk.live"; let urlToken = `${BASE_URL}/v1/prebuilt/token`; @@ -73,7 +80,11 @@ export class VideoSDKMeeting { permissions.push("allow_join"); } - if ( participantCanToggleOtherWebcam || participantCanToggleOtherMic || partcipantCanToogleOtherScreenShare) { + if ( + participantCanToggleOtherWebcam || + participantCanToggleOtherMic || + partcipantCanToogleOtherScreenShare + ) { permissions.push("allow_mod"); } else { permissions.push("allow_join"); @@ -180,6 +191,7 @@ export class VideoSDKMeeting { embedBaseUrl: _embedBaseUrl, apiBaseUrl, mode, + metaData, } = {}, myWindow ) { @@ -303,7 +315,16 @@ export class VideoSDKMeeting { throw new Error(`Any one of "token" or "apiKey" must be provided.`); } - token = token || (await this.fetchToken({ apiKey, askJoin, participantCanToggleOtherWebcam, participantCanToggleOtherMic, partcipantCanToogleOtherScreenShare, apiBaseUrl })); + token = + token || + (await this.fetchToken({ + apiKey, + askJoin, + participantCanToggleOtherWebcam, + participantCanToggleOtherMic, + partcipantCanToogleOtherScreenShare, + apiBaseUrl, + })); const rawUserAgent = myWindow?.navigator?.userAgent; @@ -682,6 +703,12 @@ export class VideoSDKMeeting { value: screenShareOptimizationMode || "motion", }, { key: "micQuality", value: micQuality || "speech_standard" }, + { + key: "metaData", + value: JSON.stringify( + typeof metaData === "object" ? metaData : {} ?? {} + ), + }, ] .map(({ key, value }) => { return `${key}=${encodeURIComponent(value)}`;