@vime/core
Version:
Customizable, extensible, accessible and framework agnostic media player.
1 lines • 1.64 kB
JavaScript
import{e as o,p as i,l as n,q as e}from"./p-b018976f.js";var d,t;const s="undefined"!=typeof window,r=s?null===(d=window.navigator)||void 0===d?void 0:d.userAgent.toLowerCase():"",w=/iphone|ipad|ipod|ios|CriOS|FxiOS/.test(r),a=/android/.test(r),u=s&&(w||a),c=s&&/(iPhone|iPod)/gi.test(null===(t=window.navigator)||void 0===t?void 0:t.platform);/firefox/.test(r);const f=s&&window.chrome;s&&!f&&(window.safari||w||/(apple|safari)/.test(r));const m=e=>!s||o(window.ResizeObserver)?(e(u),i):(e(window.innerWidth<=480||u),n(window,"resize",(function(){e(window.innerWidth<=480||u)}))),p=o=>{if(!s)return i;let e=0;const d=n(document,"touchstart",(()=>{e=(new Date).getTime(),o(!0)}),!0),t=n(document,"mousemove",(()=>{(new Date).getTime()-e<500||o(!1)}),!0);return()=>{d(),t()}},l=()=>s&&window.screen.orientation&&!!window.screen.orientation.lock,v=()=>{if(!s)return!1;const o=document.createElement("video");return!!document.pictureInPictureEnabled&&!o.disablePictureInPicture},h=()=>{if(!s)return!1;const o=document.createElement("video");return e(o.webkitSupportsPresentationMode)&&e(o.webkitSetPresentationMode)&&!c},P=()=>v()||h(),x=(o=!0,n=!0)=>{if(!s)return Promise.resolve(!1);const e=document.createElement("video");return o&&(e.setAttribute("muted",""),e.muted=!0),n&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")),e.setAttribute("height","0"),e.setAttribute("width","0"),e.style.position="fixed",e.style.top="0",e.style.width="0",e.style.height="0",e.style.opacity="0",new Promise((o=>o(e.play()))).catch(i),Promise.resolve(!e.paused)};export{s as I,p as a,l as b,x as c,w as d,v as e,h as f,P as g,m as o}