@ktt45678/vidstack
Version:
UI component library for building high-quality, accessible video and audio experiences on the web.
2 lines (1 loc) • 2.74 kB
JavaScript
import{X as n,j as i,aj as l,i as o}from"./vidstack-DgnIG4vb.js";const f=navigator?.userAgent.toLowerCase()||"",c=/iphone|ipad|ipod|ios|crios|fxios/i.test(f),w=/(iphone|ipod)/gi.test(navigator?.platform||""),g=!!window.chrome,v=!!window.safari||c;function E(){return y()&&n(screen.orientation.unlock)}function y(){return!i(window.screen.orientation)&&!i(window.screen.orientation.lock)}function I(e,t){return e||(e=document.createElement("audio")),e.canPlayType(t).length>0}function b(e,t){return e||(e=document.createElement("video")),e.canPlayType(t).length>0}function u(e){return e||(e=document.createElement("video")),e.canPlayType("application/vnd.apple.mpegurl").length>0}function P(e){return!!document.pictureInPictureEnabled&&!e?.disablePictureInPicture}function h(e){return n(e?.webkitSupportsPresentationMode)&&n(e?.webkitSetPresentationMode)}async function O(){const e=document.createElement("video");return e.volume=.5,await l(0),e.volume===.5}function T(){return window?.ManagedMediaSource??window?.MediaSource??window?.WebKitMediaSource}function _(){return window?.SourceBuffer??window?.WebKitSourceBuffer}function s(){const e=T();if(i(e))return!1;const t=e&&n(e.isTypeSupported)&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=_(),S=i(a)||!i(a.prototype)&&n(a.prototype.appendBuffer)&&n(a.prototype.remove);return!!t&&!!S}function A(){return s()}const D=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx|flac)($|\?)/i,H=new Set(["audio/mpeg","audio/ogg","audio/3gp","audio/mp3","audio/webm","audio/flac"]),M=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,x=new Set(["video/mp4","video/webm","video/3gp","video/ogg","video/avi","video/mpeg"]),N=/\.(m3u8)($|\?)/i,V=/\.(mpd)($|\?)/i,j=new Set(["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"]),L=new Set(["application/dash+xml","application/xml","video/dash+xml","video/xml","video/dash"]);function p({src:e,type:t}){return o(e)?D.test(e)||H.has(t)||e.startsWith("blob:")&&t==="audio/object":t==="audio/object"}function d(e){return o(e.src)?M.test(e.src)||x.has(e.type)||e.src.startsWith("blob:")&&e.type==="video/object"||r(e)&&u():e.type==="video/object"}function r({src:e,type:t}){return o(e)&&N.test(e)||j.has(t)}function U({src:e,type:t}){return m(e)||o(e)&&V.test(e)||L.has(t)}function k(e){return o(e.src)&&(p(e)||d(e)||r(e))}function X(e){return typeof window.MediaStream<"u"&&e instanceof window.MediaStream}function m(e){return typeof e=="object"&&"protocol"in e&&e.protocol==="DASH"}export{w as I,g as a,c as b,E as c,k as d,O as e,I as f,d as g,b as h,p as i,A as j,U as k,s as l,r as m,m as n,P as o,h as p,u as q,v as r,X as s};