@mux/studio-embed
Advanced tools
Comparing version 0.4.2 to 0.4.3-alpha.1
@@ -1,1 +0,1 @@ | ||
var muxStudioEmbed=(()=>{var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var T=(n,e)=>{for(var t in e)s(n,t,{get:e[t],enumerable:!0})},v=(n,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of u(e))!f.call(n,r)&&r!==t&&s(n,r,{get:()=>e[r],enumerable:!(a=d(e,r))||a.enumerable});return n};var p=n=>v(s({},"__esModule",{value:!0}),n);var b={};T(b,{createStudio:()=>g});var i=["ERROR","LIVESTREAM_STARTED","LIVESTREAM_ENDED","PARTICIPANT_JOINED","PARTICIPANT_LEFT","LOADING_STATUS_CHANGED","CAMERA_STARTED","CAMERA_STOPPED","MIC_STARTED","MIC_STOPPED","CONNECTION_QUALITY_CHANGED","HEIGHT_CHANGED","REQUEST_THEME"];var g=async(n,e,t)=>{if(typeof n!="string")throw new Error("Token must be provided and be a string");if(document.querySelector("#mux-studio-embed")!==null)throw new Error("Studio already embedded. Only one studio can be embedded at a time");let a=null;if(e instanceof HTMLElement?a=e:typeof e=="string"&&(a=document.querySelector(e)),!a)throw new Error("Invalid target element supplied");return new l(n,a,t!=null?t:{})},l=class{constructor(e,t,a){this.autoSize=!0;this._setupIframe=()=>{if(this.iframe===null)return;let e=this.iframe;e.title="Mux Studio Embed",e.id="mux-studio-embed",e.allowFullscreen=!0,e.allow="camera; microphone; fullscreen; display-capture; allow-same-origin; allow-presentation",this.autoSize&&(e.style.width="100%",e.style.height="768px"),e.style.display="block",e.style.border="none";let t=`https://0-4-2.studio.mux.dev/iframe?token=${this.token}`;this.background&&(t+=`&bg=${encodeURIComponent(this.background)}`),this.overlay&&(t+=`&ov=${encodeURIComponent(this.overlay)}`),t+=`&as=${this.autoSize?"1":"0"}`,e.src=t,e.onload=this._iframeLoaded.bind(this),this.target.appendChild(e)};this._iframeLoaded=()=>{var e;this.iframe!==null&&((e=this.iframe.contentWindow)==null||e.postMessage("PORT_TRANSFER","*",[this.channel.port2]),this.channel.port1.onmessage=this._onRecieveMessage)};this._onRecieveMessage=e=>{let{name:t,data:a}=e.data;switch(t){case"HEIGHT_CHANGED":this._updateIframeHeight(a.height);break;case"REQUEST_THEME":this._sendTheme();break}this.eventCallbacks[t].forEach(r=>r(a))};this._updateIframeHeight=e=>{this.iframe===null||!this.autoSize||(this.iframe.style.height=e.toString(10)+"px")};this._sendTheme=()=>{let e={name:"THEME_UPDATE",theme:this.theme};this.channel.port1.postMessage(e)};this.on=(e,t)=>{this.eventCallbacks[e].has(t)||this.eventCallbacks[e].add(t)};this.offAll=()=>{i.forEach(e=>this.eventCallbacks[e].clear())};this.updateTheme=e=>{this.theme={...this.theme,...e},this._sendTheme()};this.remove=()=>{var e;this.offAll(),(e=this.iframe)==null||e.remove(),this.iframe=null};var m,h,o,E;this.token=e,this.target=t,this.iframe=document.createElement("iframe"),this.channel=new MessageChannel,this.background=(m=a==null?void 0:a.background)!=null?m:null,this.overlay=(h=a==null?void 0:a.overlay)!=null?h:null,this.autoSize=(o=a==null?void 0:a.autoSize)!=null?o:!0,this.theme=(E=a==null?void 0:a.theme)!=null?E:{};let r=i.map(c=>[c,new Set]);this.eventCallbacks=Object.fromEntries(r),this._setupIframe()}off(e,t){t?this.eventCallbacks[e].delete(t):this.eventCallbacks[e].clear()}};return p(b);})(); | ||
var muxStudioEmbed=(()=>{var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var T=(n,e)=>{for(var t in e)s(n,t,{get:e[t],enumerable:!0})},v=(n,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of u(e))!f.call(n,r)&&r!==t&&s(n,r,{get:()=>e[r],enumerable:!(a=d(e,r))||a.enumerable});return n};var p=n=>v(s({},"__esModule",{value:!0}),n);var b={};T(b,{createStudio:()=>g});var i=["ERROR","LIVESTREAM_STARTED","LIVESTREAM_ENDED","PARTICIPANT_JOINED","PARTICIPANT_LEFT","LOADING_STATUS_CHANGED","CAMERA_STARTED","CAMERA_STOPPED","MIC_STARTED","MIC_STOPPED","CONNECTION_QUALITY_CHANGED","HEIGHT_CHANGED","REQUEST_THEME"];var g=async(n,e,t)=>{if(typeof n!="string")throw new Error("Token must be provided and be a string");if(document.querySelector("#mux-studio-embed")!==null)throw new Error("Studio already embedded. Only one studio can be embedded at a time");let a=null;if(e instanceof HTMLElement?a=e:typeof e=="string"&&(a=document.querySelector(e)),!a)throw new Error("Invalid target element supplied");return new l(n,a,t!=null?t:{})},l=class{constructor(e,t,a){this.autoSize=!0;this._setupIframe=()=>{if(this.iframe===null)return;let e=this.iframe;e.title="Mux Studio Embed",e.id="mux-studio-embed",e.allowFullscreen=!0,e.allow="camera; microphone; fullscreen; display-capture; allow-same-origin; allow-presentation",this.autoSize&&(e.style.width="100%",e.style.height="768px"),e.style.display="block",e.style.border="none";let t=`https://0-4-3-alpha-1.studio.mux.dev/iframe?token=${this.token}`;this.background&&(t+=`&bg=${encodeURIComponent(this.background)}`),this.overlay&&(t+=`&ov=${encodeURIComponent(this.overlay)}`),t+=`&as=${this.autoSize?"1":"0"}`,e.src=t,e.onload=this._iframeLoaded.bind(this),this.target.appendChild(e)};this._iframeLoaded=()=>{var e;this.iframe!==null&&((e=this.iframe.contentWindow)==null||e.postMessage("PORT_TRANSFER","*",[this.channel.port2]),this.channel.port1.onmessage=this._onRecieveMessage)};this._onRecieveMessage=e=>{let{name:t,data:a}=e.data;switch(t){case"HEIGHT_CHANGED":this._updateIframeHeight(a.height);break;case"REQUEST_THEME":this._sendTheme();break}this.eventCallbacks[t].forEach(r=>r(a))};this._updateIframeHeight=e=>{this.iframe===null||!this.autoSize||(this.iframe.style.height=e.toString(10)+"px")};this._sendTheme=()=>{let e={name:"THEME_UPDATE",theme:this.theme};this.channel.port1.postMessage(e)};this.on=(e,t)=>{this.eventCallbacks[e].has(t)||this.eventCallbacks[e].add(t)};this.offAll=()=>{i.forEach(e=>this.eventCallbacks[e].clear())};this.updateTheme=e=>{this.theme={...this.theme,...e},this._sendTheme()};this.remove=()=>{var e;this.offAll(),(e=this.iframe)==null||e.remove(),this.iframe=null};var m,h,o,E;this.token=e,this.target=t,this.iframe=document.createElement("iframe"),this.channel=new MessageChannel,this.background=(m=a==null?void 0:a.background)!=null?m:null,this.overlay=(h=a==null?void 0:a.overlay)!=null?h:null,this.autoSize=(o=a==null?void 0:a.autoSize)!=null?o:!0,this.theme=(E=a==null?void 0:a.theme)!=null?E:{};let r=i.map(c=>[c,new Set]);this.eventCallbacks=Object.fromEntries(r),this._setupIframe()}off(e,t){t?this.eventCallbacks[e].delete(t):this.eventCallbacks[e].clear()}};return p(b);})(); |
{ | ||
"name": "@mux/studio-embed", | ||
"version": "0.4.2", | ||
"version": "0.4.3-alpha.1", | ||
"description": "", | ||
@@ -9,6 +9,6 @@ "license": "UNLICENSED", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs", | ||
"default": "./dist/index.cjs" | ||
"require": "./dist/index.cjs.js", | ||
"default": "./dist/index.cjs.js" | ||
}, | ||
"main": "./dist/index.cjs", | ||
"main": "./dist/index.cjs.js", | ||
"unpkg": "./dist/mux-studio-embed.js", | ||
@@ -47,5 +47,2 @@ "module": "./dist/mux-studio-embed.mjs", | ||
}, | ||
"dependencies": { | ||
"shared": "^0.3.0" | ||
}, | ||
"publishConfig": { | ||
@@ -52,0 +49,0 @@ "access": "restricted" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
15897
- Removedshared@^0.3.0