react-loom-player
Version:
This package provides a hassle-free way to implement a Loom player in your React application. By utilizing this package, you can easily embed Loom videos with various configuration options.
2 lines (1 loc) • 1.65 kB
JavaScript
import e from"react";"function"==typeof SuppressedError&&SuppressedError;const t=t=>{var r=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(o=Object.getOwnPropertySymbols(e);l<o.length;l++)t.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(e,o[l])&&(r[o[l]]=e[o[l]])}return r}(t,[]);const o=((e,t)=>{const r=[];return e&&(e.startsWith("https://www.loom.com/embed/")||e.startsWith("https://www.loom.com/share/"))?(e=e.replace("https://www.loom.com/share/","https://www.loom.com/embed/"),(null==t?void 0:t.autoplay)&&r.push("autoplay=true"),(null==t?void 0:t.timestamps)&&("number"==typeof t.timestamps?r.push(`t=${encodeURIComponent(t.timestamps)}s`):r.push(`t=${encodeURIComponent(t.timestamps)}`)),(null==t?void 0:t.muted)&&r.push("muted=true"),(null==t?void 0:t.hideEmbedTopBar)&&r.push("hideEmbedTopBar=true"),(null==t?void 0:t.hideTitle)&&r.push("hide_title=true"),(null==t?void 0:t.hideOwner)&&r.push("hide_owner=true"),(null==t?void 0:t.hideShare)&&r.push("hide_share=true"),`${e.split("?")[0]}?${r.join("&")}`):null})(r.src,{autoplay:r.autoplay,timestamps:r.timestamps,muted:r.muted,hideEmbedTopBar:r.hideEmbedTopBar,hideTitle:r.hideTitle,hideOwner:r.hideOwner,hideShare:r.hideShare});return e.createElement("div",{className:"react-loom-player-wrapper"},o?e.createElement("iframe",Object.assign({},r,{src:o,sandbox:"allow-scripts allow-same-origin",style:Object.assign({border:"none",width:960,height:540},r.style),className:"react-loom-player",allowFullScreen:!0})):null)};export{t as default};