Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mux/studio-embed

Package Overview
Dependencies
Maintainers
39
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/studio-embed - npm Package Compare versions

Comparing version 0.4.6 to 0.4.7

2

dist/index.cjs.js

@@ -1,1 +0,1 @@

var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(a,e)=>{for(var t in e)m(a,t,{get:e[t],enumerable:!0})},u=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of v(e))!g.call(a,i)&&i!==t&&m(a,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return a};var T=a=>u(m({},"__esModule",{value:!0}),a);var I={};p(I,{createStudio:()=>S});module.exports=T(I);var r=["BROADCAST_STARTED","BROADCAST_ENDED","PARTICIPANT_JOINED","PARTICIPANT_LEFT","CAMERA_STARTED","CAMERA_STOPPED","MIC_STARTED","MIC_STOPPED","NAME_CHANGED"],f=["HEIGHT_CHANGED","REQUEST_THEME"],N=[...r,...f];var S=async(a,e,t)=>{if(typeof a!="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 n=null;if(e instanceof HTMLElement?n=e:typeof e=="string"&&(n=document.querySelector(e)),!n)throw new Error("Invalid target element supplied");return new s(a,n,t!=null?t:{})},s=class{constructor(e,t,n){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-6.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=>{var n;let{name:t}=e.data;switch(t){case"HEIGHT_CHANGED":let{data:i}=e.data;this._updateIframeHeight(i.height);break;case"REQUEST_THEME":this._sendTheme();break}(n=this.eventCallbacks[t])==null||n.forEach(i=>{i(e.data)})};this._updateIframeHeight=e=>{this.iframe===null||!this.autoSize||(this.iframe.style.height=e.toString(10)+"px")};this._sendTheme=()=>{this._sendEvent({name:"THEME_UPDATE",data:{theme:this.theme}})};this._sendEvent=e=>{this.channel.port1.postMessage(e)};this._onAny=e=>{r.forEach(t=>{this.on(t,e)})};this.on=(e,t)=>{this.eventCallbacks[e].has(t)||this.eventCallbacks[e].add(t)};this.offAll=()=>{r.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 o,E,l,c;this.token=e,this.target=t,this.iframe=document.createElement("iframe"),this.channel=new MessageChannel,this.background=(o=n==null?void 0:n.background)!=null?o:null,this.overlay=(E=n==null?void 0:n.overlay)!=null?E:null,this.autoSize=(l=n==null?void 0:n.autoSize)!=null?l:!0,this.theme=(c=n==null?void 0:n.theme)!=null?c:{};let i=r.map(h=>[h,new Set]);this.eventCallbacks=Object.fromEntries(i),this._setupIframe()}off(e,t){t?this.eventCallbacks[e].delete(t):this.eventCallbacks[e].clear()}};
var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(a,e)=>{for(var t in e)m(a,t,{get:e[t],enumerable:!0})},u=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of v(e))!g.call(a,i)&&i!==t&&m(a,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return a};var T=a=>u(m({},"__esModule",{value:!0}),a);var I={};p(I,{createStudio:()=>S});module.exports=T(I);var r=["BROADCAST_STARTED","BROADCAST_ENDED","PARTICIPANT_JOINED","PARTICIPANT_LEFT","CAMERA_STARTED","CAMERA_STOPPED","MIC_STARTED","MIC_STOPPED","NAME_CHANGED"],f=["HEIGHT_CHANGED","REQUEST_THEME"],N=[...r,...f];var S=async(a,e,t)=>{if(typeof a!="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 n=null;if(e instanceof HTMLElement?n=e:typeof e=="string"&&(n=document.querySelector(e)),!n)throw new Error("Invalid target element supplied");return new s(a,n,t!=null?t:{})},s=class{constructor(e,t,n){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-7.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=>{var n;let{name:t}=e.data;switch(t){case"HEIGHT_CHANGED":let{data:i}=e.data;this._updateIframeHeight(i.height);break;case"REQUEST_THEME":this._sendTheme();break}(n=this.eventCallbacks[t])==null||n.forEach(i=>{i(e.data)})};this._updateIframeHeight=e=>{this.iframe===null||!this.autoSize||(this.iframe.style.height=e.toString(10)+"px")};this._sendTheme=()=>{this._sendEvent({name:"THEME_UPDATE",data:{theme:this.theme}})};this._sendEvent=e=>{this.channel.port1.postMessage(e)};this._onAny=e=>{r.forEach(t=>{this.on(t,e)})};this.on=(e,t)=>{this.eventCallbacks[e].has(t)||this.eventCallbacks[e].add(t)};this.offAll=()=>{r.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 o,E,l,c;this.token=e,this.target=t,this.iframe=document.createElement("iframe"),this.channel=new MessageChannel,this.background=(o=n==null?void 0:n.background)!=null?o:null,this.overlay=(E=n==null?void 0:n.overlay)!=null?E:null,this.autoSize=(l=n==null?void 0:n.autoSize)!=null?l:!0,this.theme=(c=n==null?void 0:n.theme)!=null?c:{};let i=r.map(h=>[h,new Set]);this.eventCallbacks=Object.fromEntries(i),this._setupIframe()}off(e,t){t?this.eventCallbacks[e].delete(t):this.eventCallbacks[e].clear()}};

@@ -1,1 +0,1 @@

var muxStudioEmbed=(()=>{var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(a,e)=>{for(var t in e)m(a,t,{get:e[t],enumerable:!0})},u=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of v(e))!g.call(a,i)&&i!==t&&m(a,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return a};var T=a=>u(m({},"__esModule",{value:!0}),a);var I={};p(I,{createStudio:()=>S});var r=["BROADCAST_STARTED","BROADCAST_ENDED","PARTICIPANT_JOINED","PARTICIPANT_LEFT","CAMERA_STARTED","CAMERA_STOPPED","MIC_STARTED","MIC_STOPPED","NAME_CHANGED"],f=["HEIGHT_CHANGED","REQUEST_THEME"],N=[...r,...f];var S=async(a,e,t)=>{if(typeof a!="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 n=null;if(e instanceof HTMLElement?n=e:typeof e=="string"&&(n=document.querySelector(e)),!n)throw new Error("Invalid target element supplied");return new s(a,n,t!=null?t:{})},s=class{constructor(e,t,n){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-6.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=>{var n;let{name:t}=e.data;switch(t){case"HEIGHT_CHANGED":let{data:i}=e.data;this._updateIframeHeight(i.height);break;case"REQUEST_THEME":this._sendTheme();break}(n=this.eventCallbacks[t])==null||n.forEach(i=>{i(e.data)})};this._updateIframeHeight=e=>{this.iframe===null||!this.autoSize||(this.iframe.style.height=e.toString(10)+"px")};this._sendTheme=()=>{this._sendEvent({name:"THEME_UPDATE",data:{theme:this.theme}})};this._sendEvent=e=>{this.channel.port1.postMessage(e)};this._onAny=e=>{r.forEach(t=>{this.on(t,e)})};this.on=(e,t)=>{this.eventCallbacks[e].has(t)||this.eventCallbacks[e].add(t)};this.offAll=()=>{r.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 o,E,l,c;this.token=e,this.target=t,this.iframe=document.createElement("iframe"),this.channel=new MessageChannel,this.background=(o=n==null?void 0:n.background)!=null?o:null,this.overlay=(E=n==null?void 0:n.overlay)!=null?E:null,this.autoSize=(l=n==null?void 0:n.autoSize)!=null?l:!0,this.theme=(c=n==null?void 0:n.theme)!=null?c:{};let i=r.map(h=>[h,new Set]);this.eventCallbacks=Object.fromEntries(i),this._setupIframe()}off(e,t){t?this.eventCallbacks[e].delete(t):this.eventCallbacks[e].clear()}};return T(I);})();
var muxStudioEmbed=(()=>{var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(a,e)=>{for(var t in e)m(a,t,{get:e[t],enumerable:!0})},u=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of v(e))!g.call(a,i)&&i!==t&&m(a,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return a};var T=a=>u(m({},"__esModule",{value:!0}),a);var I={};p(I,{createStudio:()=>S});var r=["BROADCAST_STARTED","BROADCAST_ENDED","PARTICIPANT_JOINED","PARTICIPANT_LEFT","CAMERA_STARTED","CAMERA_STOPPED","MIC_STARTED","MIC_STOPPED","NAME_CHANGED"],f=["HEIGHT_CHANGED","REQUEST_THEME"],N=[...r,...f];var S=async(a,e,t)=>{if(typeof a!="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 n=null;if(e instanceof HTMLElement?n=e:typeof e=="string"&&(n=document.querySelector(e)),!n)throw new Error("Invalid target element supplied");return new s(a,n,t!=null?t:{})},s=class{constructor(e,t,n){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-7.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=>{var n;let{name:t}=e.data;switch(t){case"HEIGHT_CHANGED":let{data:i}=e.data;this._updateIframeHeight(i.height);break;case"REQUEST_THEME":this._sendTheme();break}(n=this.eventCallbacks[t])==null||n.forEach(i=>{i(e.data)})};this._updateIframeHeight=e=>{this.iframe===null||!this.autoSize||(this.iframe.style.height=e.toString(10)+"px")};this._sendTheme=()=>{this._sendEvent({name:"THEME_UPDATE",data:{theme:this.theme}})};this._sendEvent=e=>{this.channel.port1.postMessage(e)};this._onAny=e=>{r.forEach(t=>{this.on(t,e)})};this.on=(e,t)=>{this.eventCallbacks[e].has(t)||this.eventCallbacks[e].add(t)};this.offAll=()=>{r.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 o,E,l,c;this.token=e,this.target=t,this.iframe=document.createElement("iframe"),this.channel=new MessageChannel,this.background=(o=n==null?void 0:n.background)!=null?o:null,this.overlay=(E=n==null?void 0:n.overlay)!=null?E:null,this.autoSize=(l=n==null?void 0:n.autoSize)!=null?l:!0,this.theme=(c=n==null?void 0:n.theme)!=null?c:{};let i=r.map(h=>[h,new Set]);this.eventCallbacks=Object.fromEntries(i),this._setupIframe()}off(e,t){t?this.eventCallbacks[e].delete(t):this.eventCallbacks[e].clear()}};return T(I);})();
{
"name": "@mux/studio-embed",
"version": "0.4.6",
"version": "0.4.7",
"description": "",

@@ -5,0 +5,0 @@ "license": "UNLICENSED",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc