UNPKG

@videosdk.live/rtc-js-prebuilt

Version:

<h1 align="center"> <img src="https://static.videosdk.live/videosdk_logo_website_black.png"/><br/> <p align="center"> Video SDK No Code Prebuilt<br/> <a href="https://videosdk.live/">videosdk.live</a> </p> </h1>

1 lines 8.81 kB
function _objectWithoutPropertiesLoose(e,a){if(null==e)return{};var t,l,n={},o=Object.keys(e);for(l=0;l<o.length;l++)t=o[l],a.indexOf(t)>=0||(n[t]=e[t]);return n}var _excluded=["containerId"],VideoSDKMeeting=function(){function e(){}var a=e.prototype;return a.init=function e(a){var t=void 0===a?{}:a,l=t.containerId,n=_objectWithoutPropertiesLoose(t,_excluded);try{var o=parent.document,r=parent.window;if(void 0===r||void 0===o)throw Error("No browser detected!");return Promise.resolve(this.generatePrebuiltSrc(n,r,o)).then(function(e){var a=o.createElement("iframe");a.id="videosdk-frame",a.src=e,a.allowfullscreen=!0,a.width="100%",a.height="100%",a.allow="camera *; microphone *; fullscreen; display-capture; allow-same-origin; allow-presentation; encrypted-media; midi; encrypted-media ",a.style.border=0,a.allowusermedia="allowusermedia";var t=null;if(l){var n=o.getElementById(l);if(!n)throw Error("No Container found with id "+l);t=n,n.appendChild(a)}else{var i=o.createElement("div");i.style.position="fixed",i.style.left=0,i.style.right=0,i.style.bottom=0,i.style.top=0,t=i,i.appendChild(a),o.body.style.margin="0px",o.body.style.padding="0px",o.body.style.height="100%",o.body.style.overflow="hidden",o.body.appendChild(i)}r.addEventListener("popstate",function(e){t.remove()})})}catch(i){return Promise.reject(i)}},a.fetchToken=function e(a){var t=a.apiKey,l=a.askJoin,n=a.apiBaseUrl;try{var o=[];l?o.push("ask_join"):o.push("allow_join");var r={apiKey:t};return o.length&&(r.permissions=o),Promise.resolve(fetch((n||"https://api.videosdk.live")+"/v1/prebuilt/token",{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify(r)})).then(function(e){var a,t=function(){if(200===e.status)return Promise.resolve(e.json()).then(function(e){a=e.token});throw Error("Could not fetch token.")}();return t&&t.then?t.then(function(e){return a}):a})}catch(i){return Promise.reject(i)}},a.generatePrebuiltSrc=function e(a,t){var l=void 0===a?{}:a,n=l.name,o=l.apiKey,r=l.meetingId,i=l.token,u=l.region,y=l.preferredProtocol,d=l.redirectOnLeave,s=l.micEnabled,c=l.webcamEnabled,p=l.participantCanToggleSelfWebcam,v=l.participantCanToggleSelfMic,f=l.participantTabPanelEnabled,b=l.participantCanLeave,k=l.chatEnabled,g=l.screenShareEnabled,h=l.pollEnabled,m=l.whiteboardEnabled,S=l.raiseHandEnabled,E=l.theme,w=l.branding,T=l.livestream,$=l.recording,L=l.hls,P=l.waitingScreen,C=l.permissions,U=l.joinScreen,j=l.leftScreen,A=l.layout,O=l.maxResolution,R=l.debug,B=l.isRecorder,W=l.maintainVideoAspectRatio,M=l.maintainLandscapeVideoAspectRatio,D=l.networkBarEnabled,I=l.participantId,x=l.meetingLayoutTopic,V=l.joinWithoutUserInteraction,K=l.notificationSoundEnabled,_=l.notificationAlertsEnabled,H=l.animationsEnabled,z=l.topbarEnabled,F=l.hideLocalParticipant,J=l.alwaysShowOverlay,N=l.sideStackSize,G=l.reduceEdgeSpacing,Y=l.embedBaseUrl,q=l.apiBaseUrl,Q=l.mode;try{var X=function e(a){i=a;var l,o=null==t?void 0:null===(l=t.navigator)||void 0===l?void 0:l.userAgent,w=[{key:"micEnabled",value:s?"true":"false"},{key:"webcamEnabled",value:c?"true":"false"},{key:"name",value:n},{key:"meetingId",value:r||""},{key:"region",value:u||"sg001"},{key:"preferredProtocol",value:y||"UDP_ONLY"},{key:"canChangeLayout",value:ep?"true":"false"},{key:"meetingId",value:r||""},{key:"redirectOnLeave",value:d||""},{key:"chatEnabled",value:k?"true":"false"},{key:"theme",value:E||"DEFAULT"},{key:"screenShareEnabled",value:g?"true":"false"},{key:"pollEnabled",value:"boolean"==typeof h?h?"true":"false":"true"},{key:"whiteboardEnabled",value:m?"true":"false"},{key:"participantCanToggleSelfWebcam",value:p?"true":"false"},{key:"participantCanToggleSelfMic",value:v?"true":"false"},{key:"raiseHandEnabled",value:S?"true":"false"},{key:"token",value:i||""},{key:"recordingEnabled",value:ex?"true":"false"},{key:"recordingWebhookUrl",value:eV||""},{key:"recordingAWSDirPath",value:eK||""},{key:"autoStartRecording",value:e_?"true":"false"},{key:"recordingTheme",value:e8||"DEFAULT"},{key:"participantCanToggleRecording",value:"boolean"==typeof ey&&(ey?"true":"false")},{key:"brandingEnabled",value:e1?"true":"false"},{key:"brandLogoURL",value:eG||""},{key:"brandName",value:eY},{key:"participantCanLeave",value:"boolean"==typeof b?b?"true":"false":"true"},{key:"poweredBy",value:"boolean"==typeof eq?eq?"true":"false":"true"},{key:"liveStreamEnabled",value:ek?"true":"false"},{key:"autoStartLiveStream",value:eg?"true":"false"},{key:"liveStreamOutputs",value:JSON.stringify(eh||[])},{key:"liveStreamTheme",value:em||"DEFAULT"},{key:"participantCanToggleOtherMic",value:et?"true":"false"},{key:"participantTabPanelEnabled",value:"boolean"==typeof f?f?"true":"false":"true"},{key:"partcipantCanToogleOtherScreenShare",value:el?"true":"false"},{key:"participantCanToggleOtherWebcam",value:ea?"true":"false"},{key:"participantCanToggleOtherMode",value:en?"true":"false"},{key:"askJoin",value:ee?"true":"false"},{key:"joinScreenEnabled",value:e$?"true":"false"},{key:"joinScreenMeetingUrl",value:eL||""},{key:"joinScreenTitle",value:eP||""},{key:"notificationSoundEnabled",value:"boolean"==typeof K?K?"true":"false":"true"},{key:"canPin",value:ec?"true":"false"},{key:"canCreatePoll",value:ev?"true":"false"},{key:"canToggleParticipantTab",value:"boolean"==typeof ef?ef?"true":"false":"true"},{key:"layoutType",value:eW},{key:"mode",value:Q},{key:"participantCanEndMeeting",value:"boolean"==typeof er&&er?"true":"false"},{key:"canDrawOnWhiteboard",value:"boolean"==typeof ei?ei?"true":"false":"true"},{key:"canToggleWhiteboard",value:"boolean"==typeof eu?eu?"true":"false":"true"},{key:"canRemoveOtherParticipant",value:"boolean"==typeof eo&&eo?"true":"false"},{key:"leftScreenActionButtonLabel",value:eO},{key:"leftScreenActionButtonHref",value:eR},{key:"maxResolution",value:O||"sd"},{key:"animationsEnabled",value:"boolean"!=typeof H||H},{key:"topbarEnabled",value:"boolean"!=typeof z||z},{key:"notificationAlertsEnabled",value:"boolean"!=typeof _||_},{key:"debug",value:"boolean"==typeof R&&R},{key:"participantId",value:I||""},{key:"layoutPriority",value:eM||""},{key:"layoutGridSize",value:eD||"0"},{key:"hideLocalParticipant",value:"boolean"==typeof F&&F?"true":"false"},{key:"alwaysShowOverlay",value:"boolean"==typeof J&&J?"true":"false"},{key:"sideStackSize",value:N},{key:"reduceEdgeSpacing",value:"boolean"==typeof G&&G?"true":"false"},{key:"isRecorder",value:"boolean"==typeof B&&B?"true":"false"},{key:"maintainVideoAspectRatio",value:"boolean"==typeof W?W?"true":"false":"true"},{key:"maintainLandscapeVideoAspectRatio",value:"boolean"==typeof M&&M?"true":"false"},{key:"networkBarEnabled",value:"boolean"==typeof D?D?"true":"false":"true"},{key:"leftScreenRejoinButtonEnabled",value:"boolean"==typeof ej?ej?"true":"false":"true"},{key:"joinWithoutUserInteraction",value:"boolean"==typeof V&&V?"true":"false"},{key:"rawUserAgent",value:o||""},{key:"meetingLayoutTopic",value:x||""},{key:"canChangeLayout",value:"boolean"==typeof ep&&ep?"true":"false"},{key:"participantCanToggleLivestream",value:"boolean"==typeof ed&&ed?"true":"false"},{key:"hlsEnabled",value:ez?"true":"false"},{key:"autoStartHls",value:eF?"true":"false"},{key:"participantCanToggleHls",value:"boolean"==typeof es&&es?"true":"false"},{key:"hlsPlayerControlsVisible",value:"boolean"==typeof eJ&&eJ?"true":"false"},{key:"hlsTheme",value:eN||"DEFAULT"},{key:"waitingScreenImageUrl",value:eE||""},{key:"waitingScreenText",value:ew||""}].map(function(e){var a=e.key,t=e.value;return a+"="+encodeURIComponent(t)}).join("&");return(Y||"https://embed.videosdk.live/rtc-js-prebuilt/0.3.23/")+"/?"+w};T||(T={}),C||(C={}),U||(U={}),j||(j={}),A||(A={}),$||($={}),L||(L={}),P||(P={}),w||(w={});var Z=C,ee=Z.askToJoin,ea=Z.toggleParticipantWebcam,et=Z.toggleParticipantMic,el=Z.toggleParticipantScreenshare,en=Z.toggleParticipantMode,eo=Z.removeParticipant,er=Z.endMeeting,ei=Z.drawOnWhiteboard,eu=Z.toggleWhiteboard,ey=Z.toggleRecording,ed=Z.toggleLivestream,es=Z.toggleHls,ec=Z.pin,ep=Z.changeLayout,ev=Z.canCreatePoll,ef=Z.canToggleParticipantTab;ee&&(ea=!1,et=!1,el=!1);var eb=T,ek=eb.enabled,eg=eb.autoStart,eh=eb.outputs,em=eb.theme,eS=P,eE=eS.imageUrl,ew=eS.text,eT=U,e$=eT.visible,eL=eT.meetingUrl,eP=eT.title,eC=j,eU=eC.actionButton,ej=eC.rejoinButtonEnabled,eA=eU=eU||{},eO=eA.label,eR=eA.href,eB=A,eW=eB.type,eM=eB.priority,eD=eB.gridSize,eI=$,ex=eI.enabled,eV=eI.webhookUrl,eK=eI.awsDirPath,e_=eI.autoStart,e8=eI.theme,eH=L,ez=eH.enabled,eF=eH.autoStart,eJ=eH.playerControlsVisible,eN=eH.theme,e0=w,e1=e0.enabled,eG=e0.logoURL,eY=e0.name,eq=e0.poweredBy;if(!i&&!o)throw Error('Any one of "token" or "apiKey" must be provided.');var eQ=i;return Promise.resolve(eQ?X(eQ):Promise.resolve(this.fetchToken({apiKey:o,askJoin:ee,apiBaseUrl:q})).then(X))}catch(eX){return Promise.reject(eX)}},e}();exports.VideoSDKMeeting=VideoSDKMeeting;