@mux/mux-video-react 0.5.2-canary.8-0563c30 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Mux, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ var k=Object.create;var u=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var R=e=>u(e,"__esModule",{value:!0});var A=(e,t)=>{R(e);for(var o in t)u(e,o,{get:t[o],enumerable:!0})},N=(e,t,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of w(t))!I.call(e,s)&&s!=="default"&&u(e,s,{get:()=>t[s],enumerable:!(o=j(t,s))||o.enumerable});return e},l=e=>N(R(u(e!=null?k(H(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);A(exports,{default:()=>_});var f=l(require("react")),h=(...e)=>{let t=(0,f.useRef)(null);return(0,f.useEffect)(()=>{e.forEach(o=>{!o||(typeof o=="function"?o(t.current):o.current=t.current)})},[e]),t},P=h;var r=l(require("react")),a=l(require("prop-types")),n=l(require("@mux/playback-core"));var D=()=>{try{return"0.5.3"}catch{}return"UNKNOWN"},K=D(),g=()=>K;var U=g(),W="mux-video-react",x=r.default.forwardRef((e,t)=>{var M;let{envKey:o,debug:s,beaconCollectionDomain:z,playbackId:y,preferMse:B,type:Y,streamType:q,startTime:F,src:d,children:E,autoPlay:i,...V}=e,[v]=(0,r.useState)((0,n.generatePlayerInitTime)()),[T,O]=(0,r.useState)((M=(0,n.toMuxVideoURL)(y))!=null?M:d),m=(0,r.useRef)(void 0),S=(0,r.useRef)(null),[C,L]=(0,r.useState)(()=>c=>{}),b=P(S,t);return(0,r.useEffect)(()=>{var p;let c=(p=(0,n.toMuxVideoURL)(y))!=null?p:d;O(c)},[d,y]),(0,r.useEffect)(()=>{let c={...e,src:T,playerInitTime:v,playerSoftwareName:W,playerSoftwareVersion:U,autoplay:i},p=(0,n.initialize)(c,b.current,m.current);m.current=p,L(()=>(0,n.setupAutoplay)(b.current,i,m.current))},[T]),(0,r.useEffect)(()=>{C(i)},[i]),r.default.createElement("video",{ref:b,...V},E)});x.propTypes={envKey:a.default.string,debug:a.default.bool,metadata:a.default.any,beaconCollectionDomain:a.default.string,playbackId:a.default.string,playerInitTime:a.default.number,preferMse:a.default.bool,type:a.default.oneOf(n.allMediaTypes),streamType:a.default.oneOf(Object.values(n.StreamTypes)),startTime:a.default.number};var _=x;
2
+ //# sourceMappingURL=index.cjs.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.tsx", "../src/use-combined-refs.ts", "../src/env.ts"],
4
4
  "sourcesContent": ["import useCombinedRefs from './use-combined-refs';\nimport React, { useEffect, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n allMediaTypes,\n initialize,\n setupAutoplay,\n MuxMediaProps,\n StreamTypes,\n toMuxVideoURL,\n PlaybackEngine,\n generatePlayerInitTime,\n} from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n\nexport type Props = Omit<\n React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>,\n 'autoPlay'\n> &\n MuxMediaProps;\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-video-react';\n\nconst MuxVideo = React.forwardRef<HTMLVideoElement | undefined, Partial<Props>>((props, ref) => {\n const {\n envKey,\n debug,\n beaconCollectionDomain,\n playbackId,\n preferMse,\n type,\n streamType,\n startTime,\n src: outerSrc,\n children,\n autoPlay,\n ...restProps\n } = props;\n\n const [playerInitTime] = useState(generatePlayerInitTime());\n\n const [src, setSrc] = useState<MuxMediaProps['src']>(toMuxVideoURL(playbackId) ?? outerSrc);\n\n const playbackEngineRef = useRef<PlaybackEngine | undefined>(undefined);\n const innerMediaElRef = useRef<HTMLVideoElement>(null);\n const [updateAutoplay, setUpdateAutoplay] = useState(() => (x: any) => {});\n\n const mediaElRef = useCombinedRefs(innerMediaElRef, ref);\n\n useEffect(() => {\n const src = toMuxVideoURL(playbackId) ?? outerSrc;\n setSrc(src);\n }, [outerSrc, playbackId]);\n\n useEffect(() => {\n const propsWithState = {\n ...props,\n src,\n playerInitTime,\n playerSoftwareName,\n playerSoftwareVersion,\n autoplay: autoPlay,\n };\n const nextPlaybackEngineRef = initialize(propsWithState, mediaElRef.current, playbackEngineRef.current);\n playbackEngineRef.current = nextPlaybackEngineRef;\n setUpdateAutoplay(() => setupAutoplay(mediaElRef.current, autoPlay, playbackEngineRef.current));\n }, [src]);\n\n useEffect(() => {\n updateAutoplay(autoPlay);\n }, [autoPlay]);\n\n return (\n <video ref={mediaElRef} {...restProps}>\n {children}\n </video>\n );\n});\n\nMuxVideo.propTypes = {\n envKey: PropTypes.string,\n debug: PropTypes.bool,\n // Improve this by adding a full shape() definition for all metadata props\n // metadata: PropTypes.shape({}),\n metadata: PropTypes.any,\n beaconCollectionDomain: PropTypes.string,\n playbackId: PropTypes.string,\n playerInitTime: PropTypes.number,\n preferMse: PropTypes.bool,\n type: PropTypes.oneOf(allMediaTypes),\n streamType: PropTypes.oneOf(Object.values(StreamTypes)),\n startTime: PropTypes.number,\n};\n\nexport default MuxVideo;\n", "import { useEffect, useRef, MutableRefObject } from 'react';\n\ntype Maybe<T> = T | null | undefined;\ntype RefCb<T> = (instance: Maybe<T>) => void;\ntype RefObj<T> = MutableRefObject<Maybe<T>>;\ntype RefTypes<T> = RefObj<T> | RefCb<T>;\ninterface useCombinedRefs {\n <T>(...refs: Maybe<RefTypes<T>>[]): RefObj<T>;\n}\n\nexport const useCombinedRefs: useCombinedRefs = (...refs) => {\n const targetRef = useRef(null);\n\n useEffect(() => {\n refs.forEach((ref) => {\n if (!ref) return;\n\n if (typeof ref === 'function') {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n });\n }, [refs]);\n\n return targetRef;\n};\n\nexport default useCombinedRefs;\n", "export const isMaybeBrowser = () => typeof window != 'undefined';\n// @ts-ignore\nexport const isMaybeServer = () => typeof global != 'undefined';\n\nconst getEnvPlayerVersion = () => {\n try {\n // @ts-ignore\n return PLAYER_VERSION as string;\n } catch {}\n return 'UNKNOWN';\n};\n\nconst player_version: string = getEnvPlayerVersion();\n\nexport const getPlayerVersion = () => player_version;\n"],
5
- "mappings": "mlBAAA,2BCAA,MAAoD,oBAUvC,EAAmC,IAAI,IAAS,CAC3D,GAAM,GAAY,aAAO,MAEzB,sBAAU,IAAM,CACd,EAAK,QAAQ,AAAC,GAAQ,CACpB,AAAI,CAAC,GAEL,CAAI,MAAO,IAAQ,WACjB,EAAI,EAAU,SAEd,EAAI,QAAU,EAAU,YAG3B,CAAC,IAEG,GAGF,EAAQ,ED3Bf,MAAmD,oBACnD,EAAsB,yBACtB,EASO,iCERP,GAAM,GAAsB,IAAM,CAChC,GAAI,CAEF,MAAO,8BACP,EACF,MAAO,WAGH,EAAyB,IAElB,EAAmB,IAAM,EFOtC,GAAM,GAAwB,IACxB,EAAqB,kBAErB,EAAW,UAAM,WAAyD,CAAC,EAAO,IAAQ,CAxBhG,MAyBE,GAAM,CACJ,SACA,QACA,yBACA,aACA,YACA,OACA,aACA,YACA,IAAK,EACL,WACA,cACG,GACD,EAEE,CAAC,GAAkB,eAAS,gCAE5B,CAAC,EAAK,GAAU,eAA+B,uBAAc,KAAd,OAA6B,GAE5E,EAAoB,aAAmC,QACvD,EAAkB,aAAyB,MAC3C,CAAC,EAAgB,GAAqB,eAAS,IAAM,AAAC,GAAW,IAEjE,EAAa,EAAgB,EAAiB,GAEpD,sBAAU,IAAM,CAlDlB,MAmDI,GAAM,GAAM,uBAAc,KAAd,OAA6B,EACzC,EAAO,IACN,CAAC,EAAU,IAEd,gBAAU,IAAM,CACd,GAAM,GAAiB,IAClB,EACH,MACA,iBACA,qBACA,wBACA,SAAU,GAEN,EAAwB,iBAAW,EAAgB,EAAW,QAAS,EAAkB,SAC/F,EAAkB,QAAU,EAC5B,EAAkB,IAAM,oBAAc,EAAW,QAAS,EAAU,EAAkB,WACrF,CAAC,IAEJ,gBAAU,IAAM,CACd,EAAe,IACd,CAAC,IAGF,wBAAC,QAAD,CAAO,IAAK,KAAgB,GACzB,KAKP,EAAS,UAAY,CACnB,OAAQ,UAAU,OAClB,MAAO,UAAU,KAGjB,SAAU,UAAU,IACpB,uBAAwB,UAAU,OAClC,WAAY,UAAU,OACtB,eAAgB,UAAU,OAC1B,UAAW,UAAU,KACrB,KAAM,UAAU,MAAM,iBACtB,WAAY,UAAU,MAAM,OAAO,OAAO,gBAC1C,UAAW,UAAU,QAGvB,GAAO,GAAQ",
5
+ "mappings": "mlBAAA,2BCAA,MAAoD,oBAUvC,EAAmC,IAAI,IAAS,CAC3D,GAAM,GAAY,aAAO,MAEzB,sBAAU,IAAM,CACd,EAAK,QAAQ,AAAC,GAAQ,CACpB,AAAI,CAAC,GAEL,CAAI,MAAO,IAAQ,WACjB,EAAI,EAAU,SAEd,EAAI,QAAU,EAAU,YAG3B,CAAC,IAEG,GAGF,EAAQ,ED3Bf,MAAmD,oBACnD,EAAsB,yBACtB,EASO,iCERP,GAAM,GAAsB,IAAM,CAChC,GAAI,CAEF,MAAO,aACP,EACF,MAAO,WAGH,EAAyB,IAElB,EAAmB,IAAM,EFOtC,GAAM,GAAwB,IACxB,EAAqB,kBAErB,EAAW,UAAM,WAAyD,CAAC,EAAO,IAAQ,CAxBhG,MAyBE,GAAM,CACJ,SACA,QACA,yBACA,aACA,YACA,OACA,aACA,YACA,IAAK,EACL,WACA,cACG,GACD,EAEE,CAAC,GAAkB,eAAS,gCAE5B,CAAC,EAAK,GAAU,eAA+B,uBAAc,KAAd,OAA6B,GAE5E,EAAoB,aAAmC,QACvD,EAAkB,aAAyB,MAC3C,CAAC,EAAgB,GAAqB,eAAS,IAAM,AAAC,GAAW,IAEjE,EAAa,EAAgB,EAAiB,GAEpD,sBAAU,IAAM,CAlDlB,MAmDI,GAAM,GAAM,uBAAc,KAAd,OAA6B,EACzC,EAAO,IACN,CAAC,EAAU,IAEd,gBAAU,IAAM,CACd,GAAM,GAAiB,IAClB,EACH,MACA,iBACA,qBACA,wBACA,SAAU,GAEN,EAAwB,iBAAW,EAAgB,EAAW,QAAS,EAAkB,SAC/F,EAAkB,QAAU,EAC5B,EAAkB,IAAM,oBAAc,EAAW,QAAS,EAAU,EAAkB,WACrF,CAAC,IAEJ,gBAAU,IAAM,CACd,EAAe,IACd,CAAC,IAGF,wBAAC,QAAD,CAAO,IAAK,KAAgB,GACzB,KAKP,EAAS,UAAY,CACnB,OAAQ,UAAU,OAClB,MAAO,UAAU,KAGjB,SAAU,UAAU,IACpB,uBAAwB,UAAU,OAClC,WAAY,UAAU,OACtB,eAAgB,UAAU,OAC1B,UAAW,UAAU,KACrB,KAAM,UAAU,MAAM,iBACtB,WAAY,UAAU,MAAM,OAAO,OAAO,gBAC1C,UAAW,UAAU,QAGvB,GAAO,GAAQ",
6
6
  "names": []
7
7
  }
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{useEffect as C,useRef as L}from"react";var k=(...t)=>{let r=L(null);return C(()=>{t.forEach(n=>{!n||(typeof n=="function"?n(r.current):n.current=r.current)})},[t]),r},m=k;import T,{useEffect as l,useRef as M,useState as f}from"react";import e from"prop-types";import{allMediaTypes as H,initialize as I,setupAutoplay as A,StreamTypes as N,toMuxVideoURL as R,generatePlayerInitTime as h}from"@mux/playback-core";var j=()=>{try{return"0.5.3"}catch{}return"UNKNOWN"},w=j(),b=()=>w;var D=b(),K="mux-video-react",P=T.forwardRef((t,r)=>{var d;let{envKey:n,debug:U,beaconCollectionDomain:W,playbackId:i,preferMse:_,type:z,streamType:B,startTime:Y,src:c,children:g,autoPlay:o,...x}=t,[E]=f(h()),[y,V]=f((d=R(i))!=null?d:c),p=M(void 0),v=M(null),[O,S]=f(()=>a=>{}),u=m(v,r);return l(()=>{var s;let a=(s=R(i))!=null?s:c;V(a)},[c,i]),l(()=>{let a={...t,src:y,playerInitTime:E,playerSoftwareName:K,playerSoftwareVersion:D,autoplay:o},s=I(a,u.current,p.current);p.current=s,S(()=>A(u.current,o,p.current))},[y]),l(()=>{O(o)},[o]),T.createElement("video",{ref:u,...x},g)});P.propTypes={envKey:e.string,debug:e.bool,metadata:e.any,beaconCollectionDomain:e.string,playbackId:e.string,playerInitTime:e.number,preferMse:e.bool,type:e.oneOf(H),streamType:e.oneOf(Object.values(N)),startTime:e.number};var ne=P;export{ne as default};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/use-combined-refs.ts", "../src/index.tsx", "../src/env.ts"],
4
+ "sourcesContent": ["import { useEffect, useRef, MutableRefObject } from 'react';\n\ntype Maybe<T> = T | null | undefined;\ntype RefCb<T> = (instance: Maybe<T>) => void;\ntype RefObj<T> = MutableRefObject<Maybe<T>>;\ntype RefTypes<T> = RefObj<T> | RefCb<T>;\ninterface useCombinedRefs {\n <T>(...refs: Maybe<RefTypes<T>>[]): RefObj<T>;\n}\n\nexport const useCombinedRefs: useCombinedRefs = (...refs) => {\n const targetRef = useRef(null);\n\n useEffect(() => {\n refs.forEach((ref) => {\n if (!ref) return;\n\n if (typeof ref === 'function') {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n });\n }, [refs]);\n\n return targetRef;\n};\n\nexport default useCombinedRefs;\n", "import useCombinedRefs from './use-combined-refs';\nimport React, { useEffect, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n allMediaTypes,\n initialize,\n setupAutoplay,\n MuxMediaProps,\n StreamTypes,\n toMuxVideoURL,\n PlaybackEngine,\n generatePlayerInitTime,\n} from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n\nexport type Props = Omit<\n React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>,\n 'autoPlay'\n> &\n MuxMediaProps;\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-video-react';\n\nconst MuxVideo = React.forwardRef<HTMLVideoElement | undefined, Partial<Props>>((props, ref) => {\n const {\n envKey,\n debug,\n beaconCollectionDomain,\n playbackId,\n preferMse,\n type,\n streamType,\n startTime,\n src: outerSrc,\n children,\n autoPlay,\n ...restProps\n } = props;\n\n const [playerInitTime] = useState(generatePlayerInitTime());\n\n const [src, setSrc] = useState<MuxMediaProps['src']>(toMuxVideoURL(playbackId) ?? outerSrc);\n\n const playbackEngineRef = useRef<PlaybackEngine | undefined>(undefined);\n const innerMediaElRef = useRef<HTMLVideoElement>(null);\n const [updateAutoplay, setUpdateAutoplay] = useState(() => (x: any) => {});\n\n const mediaElRef = useCombinedRefs(innerMediaElRef, ref);\n\n useEffect(() => {\n const src = toMuxVideoURL(playbackId) ?? outerSrc;\n setSrc(src);\n }, [outerSrc, playbackId]);\n\n useEffect(() => {\n const propsWithState = {\n ...props,\n src,\n playerInitTime,\n playerSoftwareName,\n playerSoftwareVersion,\n autoplay: autoPlay,\n };\n const nextPlaybackEngineRef = initialize(propsWithState, mediaElRef.current, playbackEngineRef.current);\n playbackEngineRef.current = nextPlaybackEngineRef;\n setUpdateAutoplay(() => setupAutoplay(mediaElRef.current, autoPlay, playbackEngineRef.current));\n }, [src]);\n\n useEffect(() => {\n updateAutoplay(autoPlay);\n }, [autoPlay]);\n\n return (\n <video ref={mediaElRef} {...restProps}>\n {children}\n </video>\n );\n});\n\nMuxVideo.propTypes = {\n envKey: PropTypes.string,\n debug: PropTypes.bool,\n // Improve this by adding a full shape() definition for all metadata props\n // metadata: PropTypes.shape({}),\n metadata: PropTypes.any,\n beaconCollectionDomain: PropTypes.string,\n playbackId: PropTypes.string,\n playerInitTime: PropTypes.number,\n preferMse: PropTypes.bool,\n type: PropTypes.oneOf(allMediaTypes),\n streamType: PropTypes.oneOf(Object.values(StreamTypes)),\n startTime: PropTypes.number,\n};\n\nexport default MuxVideo;\n", "export const isMaybeBrowser = () => typeof window != 'undefined';\n// @ts-ignore\nexport const isMaybeServer = () => typeof global != 'undefined';\n\nconst getEnvPlayerVersion = () => {\n try {\n // @ts-ignore\n return PLAYER_VERSION as string;\n } catch {}\n return 'UNKNOWN';\n};\n\nconst player_version: string = getEnvPlayerVersion();\n\nexport const getPlayerVersion = () => player_version;\n"],
5
+ "mappings": "AAAA,8CAUO,GAAM,GAAmC,IAAI,IAAS,CAC3D,GAAM,GAAY,EAAO,MAEzB,SAAU,IAAM,CACd,EAAK,QAAQ,AAAC,GAAQ,CACpB,AAAI,CAAC,GAEL,CAAI,MAAO,IAAQ,WACjB,EAAI,EAAU,SAEd,EAAI,QAAU,EAAU,YAG3B,CAAC,IAEG,GAGF,EAAQ,EC3Bf,+DACA,0BACA,sJCCA,GAAM,GAAsB,IAAM,CAChC,GAAI,CAEF,MAAO,aACP,EACF,MAAO,WAGH,EAAyB,IAElB,EAAmB,IAAM,EDOtC,GAAM,GAAwB,IACxB,EAAqB,kBAErB,EAAW,EAAM,WAAyD,CAAC,EAAO,IAAQ,CAxBhG,MAyBE,GAAM,CACJ,SACA,QACA,yBACA,aACA,YACA,OACA,aACA,YACA,IAAK,EACL,WACA,cACG,GACD,EAEE,CAAC,GAAkB,EAAS,KAE5B,CAAC,EAAK,GAAU,EAA+B,KAAc,KAAd,OAA6B,GAE5E,EAAoB,EAAmC,QACvD,EAAkB,EAAyB,MAC3C,CAAC,EAAgB,GAAqB,EAAS,IAAM,AAAC,GAAW,IAEjE,EAAa,EAAgB,EAAiB,GAEpD,SAAU,IAAM,CAlDlB,MAmDI,GAAM,GAAM,KAAc,KAAd,OAA6B,EACzC,EAAO,IACN,CAAC,EAAU,IAEd,EAAU,IAAM,CACd,GAAM,GAAiB,IAClB,EACH,MACA,iBACA,qBACA,wBACA,SAAU,GAEN,EAAwB,EAAW,EAAgB,EAAW,QAAS,EAAkB,SAC/F,EAAkB,QAAU,EAC5B,EAAkB,IAAM,EAAc,EAAW,QAAS,EAAU,EAAkB,WACrF,CAAC,IAEJ,EAAU,IAAM,CACd,EAAe,IACd,CAAC,IAGF,gBAAC,QAAD,CAAO,IAAK,KAAgB,GACzB,KAKP,EAAS,UAAY,CACnB,OAAQ,EAAU,OAClB,MAAO,EAAU,KAGjB,SAAU,EAAU,IACpB,uBAAwB,EAAU,OAClC,WAAY,EAAU,OACtB,eAAgB,EAAU,OAC1B,UAAW,EAAU,KACrB,KAAM,EAAU,MAAM,GACtB,WAAY,EAAU,MAAM,OAAO,OAAO,IAC1C,UAAW,EAAU,QAGvB,GAAO,IAAQ",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.full.d.ts","../src/env.ts","../../../node_modules/@types/react/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/index.d.ts","../src/use-combined-refs.ts","../../../node_modules/hls.js/dist/hls.js.d.ts","../node_modules/@mux/playback-core/dist/types/autoplay.d.ts","../node_modules/@mux/playback-core/dist/types/errors.d.ts","../node_modules/@mux/playback-core/dist/types/tracks.d.ts","../node_modules/@mux/playback-core/dist/types/index.d.ts","../src/index.tsx","../../../types/media-chrome.d.ts","../../../types/mux-embed.d.ts","../../../types/mux.d.ts"],"fileInfos":[{"version":"3ac1b83264055b28c0165688fda6dfcc39001e9e7828f649299101c23ad0a0c3","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84",{"version":"72704b10d97777e15f1a581b73f88273037ef752d2e50b72287bd0a90af64fe6","affectsGlobalScope":true},{"version":"dbb73d4d99be496175cb432c74c2615f78c76f4272f1d83cba11ee0ed6dbddf0","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},"1f03b495671c3a1bd24510f38b8947f0991dfd6bf0278c68eca14af15b306e1f","1ee6056d39213c8481cc8af4adb2b1dc373e15e8b2b9864739e6c0b2da60cf1d",{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"ea0aa24a32c073b8639aa1f3130ba0add0f0f2f76b314d9ba988a5cb91d7e3c4","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"0bcebfaf66be25c793d0281a8dce761bc078d203f02c573e6ee3b844a5ad7fbc","affectsGlobalScope":true},"2cc645fb9925522f7c230c3e152d7c518665ed8efb09361b70d5edbcb687aa34","ece0cccc693a3364f05f68d7feb4d472e05b9f2eaea80f19fc10b17a0a6aa14d","e19277f843527448cadd35fd674e358d0d2a7f261e9631026ecc82feb85ecec8","8b1a6692156440f6585937b6b8de1c2692e7cac5c43aeb8893bfbd293f719552","16d89c2619e5c73fe784212aa78a4c3f6581d54e5bb566a942dfd4598c974370","6e7872c5ff282b768873500c6b800914f375037e346a733df49e544b084ef7cc","35dce311677c0883223eca98adfb8ec796eb4f3a81b04a6547a51eafd16112d7","3cf4c7825a6c0ef1965e8906b85844aafdcdda9d95c8b4bcfcb3a20811cfd0b1","c5a4764697efe3b6b4eaf19b3dc1880cf3df665d30ec93e212233c29a2fa7207",{"version":"ee8e401f800f3d48020eda76c4fd27afd5bab992195252939329ae56dc9d1889","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"jsx":2,"module":5,"noImplicitAny":true,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":6},"fileIdsList":[[37,38,39,40],[43],[43,44,45,46,50],[36,39,41,42,47],[41]],"referencedMap":[[41,1],[44,2],[47,3],[46,2],[48,4],[42,5],[51,2]],"exportedModulesMap":[[41,1],[44,2],[47,3],[46,2],[48,4],[42,5],[51,2]],"semanticDiagnosticsPerFile":[39,37,41,40,38,43,7,8,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,35,32,33,34,1,10,9,44,45,47,46,36,48,42,49,50,51]},"version":"4.6.4"}
1
+ {"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.full.d.ts","../src/env.ts","../../../node_modules/@types/react/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/index.d.ts","../src/use-combined-refs.ts","../../../node_modules/hls.js/dist/hls.js.d.ts","../../playback-core/dist/types/autoplay.d.ts","../../playback-core/dist/types/errors.d.ts","../../playback-core/dist/types/tracks.d.ts","../../playback-core/dist/types/index.d.ts","../src/index.tsx","../../../types/media-chrome.d.ts","../../../types/mux-embed.d.ts","../../../types/mux.d.ts"],"fileInfos":[{"version":"3ac1b83264055b28c0165688fda6dfcc39001e9e7828f649299101c23ad0a0c3","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84",{"version":"72704b10d97777e15f1a581b73f88273037ef752d2e50b72287bd0a90af64fe6","affectsGlobalScope":true},{"version":"dbb73d4d99be496175cb432c74c2615f78c76f4272f1d83cba11ee0ed6dbddf0","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},"1f03b495671c3a1bd24510f38b8947f0991dfd6bf0278c68eca14af15b306e1f","1ee6056d39213c8481cc8af4adb2b1dc373e15e8b2b9864739e6c0b2da60cf1d",{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"ea0aa24a32c073b8639aa1f3130ba0add0f0f2f76b314d9ba988a5cb91d7e3c4","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"0bcebfaf66be25c793d0281a8dce761bc078d203f02c573e6ee3b844a5ad7fbc","affectsGlobalScope":true},"2cc645fb9925522f7c230c3e152d7c518665ed8efb09361b70d5edbcb687aa34","ece0cccc693a3364f05f68d7feb4d472e05b9f2eaea80f19fc10b17a0a6aa14d","e19277f843527448cadd35fd674e358d0d2a7f261e9631026ecc82feb85ecec8","8b1a6692156440f6585937b6b8de1c2692e7cac5c43aeb8893bfbd293f719552","16d89c2619e5c73fe784212aa78a4c3f6581d54e5bb566a942dfd4598c974370","51781f2d796522117c57972bfabe36de652182f7bec8b73e026df3659de0481e","35dce311677c0883223eca98adfb8ec796eb4f3a81b04a6547a51eafd16112d7","3cf4c7825a6c0ef1965e8906b85844aafdcdda9d95c8b4bcfcb3a20811cfd0b1","c5a4764697efe3b6b4eaf19b3dc1880cf3df665d30ec93e212233c29a2fa7207",{"version":"ee8e401f800f3d48020eda76c4fd27afd5bab992195252939329ae56dc9d1889","affectsGlobalScope":true}],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"jsx":2,"module":5,"noImplicitAny":true,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":6},"fileIdsList":[[37,38,39,40],[36,39,41,42,47],[41],[43],[43,44,45,46,50]],"referencedMap":[[41,1],[48,2],[42,3],[44,4],[47,5],[46,4],[51,4]],"exportedModulesMap":[[41,1],[48,2],[42,3],[44,4],[47,5],[46,4],[51,4]],"semanticDiagnosticsPerFile":[39,37,41,40,38,43,7,8,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,35,32,33,34,1,10,9,36,48,42,44,45,47,46,49,50,51]},"version":"4.6.4"}
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@mux/mux-video-react",
3
- "version": "0.5.2-canary.8-0563c30",
3
+ "version": "0.5.3",
4
4
  "description": "A custom mux video element for React that Just Works™",
5
- "main": "dist/index.js",
5
+ "main": "./dist/index.cjs.js",
6
+ "module": "./dist/index.mjs",
7
+ "exports": {
8
+ "import": "./dist/index.mjs",
9
+ "require": "./dist/index.cjs.js",
10
+ "default": "./dist/index.cjs.js"
11
+ },
6
12
  "types": "dist/types-ts3.4/index.d.ts",
7
13
  "typesVersions": {
8
14
  ">=4.3.5": {
@@ -21,13 +27,15 @@
21
27
  "scripts": {
22
28
  "clean": "shx rm -rf dist/",
23
29
  "dev:cjs": "open-process | yarn build:cjs --watch",
30
+ "dev:esm": "open-process | yarn build:esm --watch",
24
31
  "dev:types": "yarn build:types -w",
25
- "dev": "npm-run-all --parallel dev:types dev:cjs",
26
- "build:cjs": "esbuild src/index.tsx --target=es2019 --bundle --sourcemap --metafile=./dist/cjs.json --format=cjs --outdir=dist --external:react --external:prop-types --external:@mux/* --define:PLAYER_VERSION=\"'$npm_package_version'\"",
27
- "build:types": "tsc --declaration --emitDeclarationOnly --outDir './dist/types' && downlevel-dts ./dist/types ./dist/types-ts3.4",
28
- "build": "npm-run-all --parallel build:types 'build:cjs -- --minify'",
32
+ "dev": "npm-run-all --parallel dev:types dev:cjs dev:esm",
33
+ "build:cjs": "esbuild src/index.tsx --target=es2019 --bundle --sourcemap --metafile=./dist/cjs.json --format=cjs --outdir=dist --out-extension:.js=.cjs.js --external:react --external:prop-types --external:@mux/* --define:PLAYER_VERSION=\"'$npm_package_version'\"",
34
+ "build:esm": "esbuild src/index.tsx --target=es2019 --bundle --sourcemap --metafile=./dist/esm.json --format=esm --outdir=dist --out-extension:.js=.mjs --external:react --external:prop-types --external:@mux/* --define:PLAYER_VERSION=\"'$npm_package_version'\"",
35
+ "build:types": "tsc --declaration --emitDeclarationOnly --outDir './dist/types'",
36
+ "postbuild:types": "downlevel-dts ./dist/types ./dist/types-ts3.4",
37
+ "build": "npm-run-all --parallel build:types 'build:cjs -- --minify' 'build:esm -- --minify'",
29
38
  "prebuild": "yarn clean",
30
- "prepublishOnly": "yarn build",
31
39
  "create-release-notes": "create-release-notes ./CHANGELOG.md",
32
40
  "publish-release": "../../scripts/publish.sh"
33
41
  },
@@ -45,7 +53,7 @@
45
53
  }
46
54
  },
47
55
  "dependencies": {
48
- "@mux/playback-core": "0.9.0",
56
+ "@mux/playback-core": "0.10.0",
49
57
  "prop-types": "^15.7.2"
50
58
  },
51
59
  "devDependencies": {
@@ -59,5 +67,6 @@
59
67
  "react-dom": "^17.0.2",
60
68
  "shx": "^0.3.4",
61
69
  "typescript": "^4.5.2"
62
- }
70
+ },
71
+ "gitHead": "72f1ae00a6c718fcaf8797a09f94aef8bfd9e0c6"
63
72
  }
package/CHANGELOG.md DELETED
@@ -1,83 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [0.5.1](https://github.com/muxinc/elements/compare/@mux/mux-video-react@0.5.0...@mux/mux-video-react@0.5.1) (2022-07-21)
7
-
8
- **Note:** Version bump only for package @mux/mux-video-react
9
-
10
- # 0.5.0 (2022-07-05)
11
-
12
- ### Bug Fixes
13
-
14
- - **mux-video-react:** use generateInitTime() instead of Date.now. ([0f159c2](https://github.com/muxinc/elements/commit/0f159c233244404faec13e61f1dbbd8b7c4adc81))
15
- - prettier format all elements files ([741d607](https://github.com/muxinc/elements/commit/741d607521ca9578cfad9f0a9216a6565b4c56a1))
16
- - switch cjs extension to .cjs.js ([30e83c3](https://github.com/muxinc/elements/commit/30e83c3ce0bd9bfda4817c30ffe0921e425619e4))
17
- - update react peerDependencies to allow ^18 ([1cfb019](https://github.com/muxinc/elements/commit/1cfb019b71cf9aa280abccaf4a7818d585b56d86))
18
-
19
- ### Features
20
-
21
- - add beaconCollectionDomain option to replace beaconDomain ([a44b699](https://github.com/muxinc/elements/commit/a44b699ae3138590b9d953f693f95971694658df))
22
- - Extended autoplay options ([#116](https://github.com/muxinc/elements/issues/116)) ([475e838](https://github.com/muxinc/elements/commit/475e83884f641c578fa601c9501147d485fc1831))
23
-
24
- ## [0.4.12](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.11...@mux-elements/mux-video-react@0.4.12) (2022-06-23)
25
-
26
- **Note:** Version bump only for package @mux-elements/mux-video-react
27
-
28
- ## [0.4.11](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.10...@mux-elements/mux-video-react@0.4.11) (2022-06-06)
29
-
30
- **Note:** Version bump only for package @mux-elements/mux-video-react
31
-
32
- ## [0.4.10](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.9...@mux-elements/mux-video-react@0.4.10) (2022-05-26)
33
-
34
- **Note:** Version bump only for package @mux-elements/mux-video-react
35
-
36
- ## [0.4.9](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.8...@mux-elements/mux-video-react@0.4.9) (2022-05-23)
37
-
38
- **Note:** Version bump only for package @mux-elements/mux-video-react
39
-
40
- ## [0.4.8](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.7...@mux-elements/mux-video-react@0.4.8) (2022-05-20)
41
-
42
- ### Bug Fixes
43
-
44
- - switch cjs extension to .cjs.js ([30e83c3](https://github.com/muxinc/elements/commit/30e83c3ce0bd9bfda4817c30ffe0921e425619e4))
45
-
46
- ## [0.4.7](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.6...@mux-elements/mux-video-react@0.4.7) (2022-05-10)
47
-
48
- **Note:** Version bump only for package @mux-elements/mux-video-react
49
-
50
- ## [0.4.6](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.5...@mux-elements/mux-video-react@0.4.6) (2022-05-03)
51
-
52
- **Note:** Version bump only for package @mux-elements/mux-video-react
53
-
54
- ## [0.4.5](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.4...@mux-elements/mux-video-react@0.4.5) (2022-04-22)
55
-
56
- **Note:** Version bump only for package @mux-elements/mux-video-react
57
-
58
- ## [0.4.4](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.3...@mux-elements/mux-video-react@0.4.4) (2022-04-18)
59
-
60
- **Note:** Version bump only for package @mux-elements/mux-video-react
61
-
62
- ## [0.4.3](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.2...@mux-elements/mux-video-react@0.4.3) (2022-04-12)
63
-
64
- **Note:** Version bump only for package @mux-elements/mux-video-react
65
-
66
- ## [0.4.2](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.1...@mux-elements/mux-video-react@0.4.2) (2022-04-01)
67
-
68
- **Note:** Version bump only for package @mux-elements/mux-video-react
69
-
70
- ## [0.4.1](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.4.0...@mux-elements/mux-video-react@0.4.1) (2022-03-29)
71
-
72
- **Note:** Version bump only for package @mux-elements/mux-video-react
73
-
74
- # [0.4.0](https://github.com/muxinc/elements/compare/@mux-elements/mux-video-react@0.3.0...@mux-elements/mux-video-react@0.4.0) (2022-03-28)
75
-
76
- ### Bug Fixes
77
-
78
- - **mux-video-react:** use generateInitTime() instead of Date.now. ([0f159c2](https://github.com/muxinc/elements/commit/0f159c233244404faec13e61f1dbbd8b7c4adc81))
79
- - prettier format all elements files ([741d607](https://github.com/muxinc/elements/commit/741d607521ca9578cfad9f0a9216a6565b4c56a1))
80
-
81
- ### Features
82
-
83
- - add beaconCollectionDomain option to replace beaconDomain ([a44b699](https://github.com/muxinc/elements/commit/a44b699ae3138590b9d953f693f95971694658df))
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- var k=Object.create;var u=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var R=e=>u(e,"__esModule",{value:!0});var A=(e,t)=>{R(e);for(var o in t)u(e,o,{get:t[o],enumerable:!0})},N=(e,t,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of w(t))!I.call(e,s)&&s!=="default"&&u(e,s,{get:()=>t[s],enumerable:!(o=j(t,s))||o.enumerable});return e},l=e=>N(R(u(e!=null?k(H(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);A(exports,{default:()=>_});var f=l(require("react")),h=(...e)=>{let t=(0,f.useRef)(null);return(0,f.useEffect)(()=>{e.forEach(o=>{!o||(typeof o=="function"?o(t.current):o.current=t.current)})},[e]),t},P=h;var r=l(require("react")),a=l(require("prop-types")),n=l(require("@mux/playback-core"));var D=()=>{try{return"0.5.2-canary.8-0563c30"}catch{}return"UNKNOWN"},K=D(),g=()=>K;var U=g(),W="mux-video-react",x=r.default.forwardRef((e,t)=>{var M;let{envKey:o,debug:s,beaconCollectionDomain:z,playbackId:y,preferMse:B,type:Y,streamType:q,startTime:F,src:d,children:E,autoPlay:i,...V}=e,[v]=(0,r.useState)((0,n.generatePlayerInitTime)()),[T,O]=(0,r.useState)((M=(0,n.toMuxVideoURL)(y))!=null?M:d),m=(0,r.useRef)(void 0),S=(0,r.useRef)(null),[C,L]=(0,r.useState)(()=>c=>{}),b=P(S,t);return(0,r.useEffect)(()=>{var p;let c=(p=(0,n.toMuxVideoURL)(y))!=null?p:d;O(c)},[d,y]),(0,r.useEffect)(()=>{let c={...e,src:T,playerInitTime:v,playerSoftwareName:W,playerSoftwareVersion:U,autoplay:i},p=(0,n.initialize)(c,b.current,m.current);m.current=p,L(()=>(0,n.setupAutoplay)(b.current,i,m.current))},[T]),(0,r.useEffect)(()=>{C(i)},[i]),r.default.createElement("video",{ref:b,...V},E)});x.propTypes={envKey:a.default.string,debug:a.default.bool,metadata:a.default.any,beaconCollectionDomain:a.default.string,playbackId:a.default.string,playerInitTime:a.default.number,preferMse:a.default.bool,type:a.default.oneOf(n.allMediaTypes),streamType:a.default.oneOf(Object.values(n.StreamTypes)),startTime:a.default.number};var _=x;
2
- //# sourceMappingURL=index.js.map
package/src/env.ts DELETED
@@ -1,15 +0,0 @@
1
- export const isMaybeBrowser = () => typeof window != 'undefined';
2
- // @ts-ignore
3
- export const isMaybeServer = () => typeof global != 'undefined';
4
-
5
- const getEnvPlayerVersion = () => {
6
- try {
7
- // @ts-ignore
8
- return PLAYER_VERSION as string;
9
- } catch {}
10
- return 'UNKNOWN';
11
- };
12
-
13
- const player_version: string = getEnvPlayerVersion();
14
-
15
- export const getPlayerVersion = () => player_version;
package/src/index.tsx DELETED
@@ -1,96 +0,0 @@
1
- import useCombinedRefs from './use-combined-refs';
2
- import React, { useEffect, useRef, useState } from 'react';
3
- import PropTypes from 'prop-types';
4
- import {
5
- allMediaTypes,
6
- initialize,
7
- setupAutoplay,
8
- MuxMediaProps,
9
- StreamTypes,
10
- toMuxVideoURL,
11
- PlaybackEngine,
12
- generatePlayerInitTime,
13
- } from '@mux/playback-core';
14
- import { getPlayerVersion } from './env';
15
-
16
- export type Props = Omit<
17
- React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>,
18
- 'autoPlay'
19
- > &
20
- MuxMediaProps;
21
-
22
- const playerSoftwareVersion = getPlayerVersion();
23
- const playerSoftwareName = 'mux-video-react';
24
-
25
- const MuxVideo = React.forwardRef<HTMLVideoElement | undefined, Partial<Props>>((props, ref) => {
26
- const {
27
- envKey,
28
- debug,
29
- beaconCollectionDomain,
30
- playbackId,
31
- preferMse,
32
- type,
33
- streamType,
34
- startTime,
35
- src: outerSrc,
36
- children,
37
- autoPlay,
38
- ...restProps
39
- } = props;
40
-
41
- const [playerInitTime] = useState(generatePlayerInitTime());
42
-
43
- const [src, setSrc] = useState<MuxMediaProps['src']>(toMuxVideoURL(playbackId) ?? outerSrc);
44
-
45
- const playbackEngineRef = useRef<PlaybackEngine | undefined>(undefined);
46
- const innerMediaElRef = useRef<HTMLVideoElement>(null);
47
- const [updateAutoplay, setUpdateAutoplay] = useState(() => (x: any) => {});
48
-
49
- const mediaElRef = useCombinedRefs(innerMediaElRef, ref);
50
-
51
- useEffect(() => {
52
- const src = toMuxVideoURL(playbackId) ?? outerSrc;
53
- setSrc(src);
54
- }, [outerSrc, playbackId]);
55
-
56
- useEffect(() => {
57
- const propsWithState = {
58
- ...props,
59
- src,
60
- playerInitTime,
61
- playerSoftwareName,
62
- playerSoftwareVersion,
63
- autoplay: autoPlay,
64
- };
65
- const nextPlaybackEngineRef = initialize(propsWithState, mediaElRef.current, playbackEngineRef.current);
66
- playbackEngineRef.current = nextPlaybackEngineRef;
67
- setUpdateAutoplay(() => setupAutoplay(mediaElRef.current, autoPlay, playbackEngineRef.current));
68
- }, [src]);
69
-
70
- useEffect(() => {
71
- updateAutoplay(autoPlay);
72
- }, [autoPlay]);
73
-
74
- return (
75
- <video ref={mediaElRef} {...restProps}>
76
- {children}
77
- </video>
78
- );
79
- });
80
-
81
- MuxVideo.propTypes = {
82
- envKey: PropTypes.string,
83
- debug: PropTypes.bool,
84
- // Improve this by adding a full shape() definition for all metadata props
85
- // metadata: PropTypes.shape({}),
86
- metadata: PropTypes.any,
87
- beaconCollectionDomain: PropTypes.string,
88
- playbackId: PropTypes.string,
89
- playerInitTime: PropTypes.number,
90
- preferMse: PropTypes.bool,
91
- type: PropTypes.oneOf(allMediaTypes),
92
- streamType: PropTypes.oneOf(Object.values(StreamTypes)),
93
- startTime: PropTypes.number,
94
- };
95
-
96
- export default MuxVideo;
@@ -1,29 +0,0 @@
1
- import { useEffect, useRef, MutableRefObject } from 'react';
2
-
3
- type Maybe<T> = T | null | undefined;
4
- type RefCb<T> = (instance: Maybe<T>) => void;
5
- type RefObj<T> = MutableRefObject<Maybe<T>>;
6
- type RefTypes<T> = RefObj<T> | RefCb<T>;
7
- interface useCombinedRefs {
8
- <T>(...refs: Maybe<RefTypes<T>>[]): RefObj<T>;
9
- }
10
-
11
- export const useCombinedRefs: useCombinedRefs = (...refs) => {
12
- const targetRef = useRef(null);
13
-
14
- useEffect(() => {
15
- refs.forEach((ref) => {
16
- if (!ref) return;
17
-
18
- if (typeof ref === 'function') {
19
- ref(targetRef.current);
20
- } else {
21
- ref.current = targetRef.current;
22
- }
23
- });
24
- }, [refs]);
25
-
26
- return targetRef;
27
- };
28
-
29
- export default useCombinedRefs;
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "rootDir": "src",
4
- "outDir": "dist",
5
- "incremental": true,
6
- "target": "ES2019",
7
- "module": "es6",
8
- "jsx": "react",
9
- "declaration": true,
10
- "sourceMap": true,
11
- "composite": true,
12
- "strict": true,
13
- "noImplicitAny": true,
14
- "moduleResolution": "Node",
15
- "baseUrl": "./packages",
16
- "esModuleInterop": true,
17
- "skipLibCheck": true,
18
- "forceConsistentCasingInFileNames": true,
19
- "typeRoots": ["node_modules/@types", "../../types"]
20
- },
21
- "include": ["src/**/*", "../../types"]
22
- }