@mux/mux-audio-react 0.4.3 → 0.5.0-canary.0-a6790e7

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/CHANGELOG.md ADDED
@@ -0,0 +1,97 @@
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.0](https://github.com/muxinc/elements/compare/@mux/mux-audio-react@0.4.3...@mux/mux-audio-react@0.5.0) (2022-10-05)
7
+
8
+ ### Bug Fixes
9
+
10
+ - preload playback core change ([15313ea](https://github.com/muxinc/elements/commit/15313eaad81f748b5853a0fdaabfe141963f885e))
11
+
12
+ ### Features
13
+
14
+ - add `prefer-playback` attribute ([#402](https://github.com/muxinc/elements/issues/402)) ([8da36d6](https://github.com/muxinc/elements/commit/8da36d6b597ddbc4ae006873fee13a971b7ec2f3))
15
+
16
+ ## [0.4.3](https://github.com/muxinc/elements/compare/@mux/mux-audio-react@0.4.2...@mux/mux-audio-react@0.4.3) (2022-09-16)
17
+
18
+ **Note:** Version bump only for package @mux/mux-audio-react
19
+
20
+ ## [0.4.2](https://github.com/muxinc/elements/compare/@mux/mux-audio-react@0.4.1...@mux/mux-audio-react@0.4.2) (2022-08-31)
21
+
22
+ **Note:** Version bump only for package @mux/mux-audio-react
23
+
24
+ ## [0.4.1](https://github.com/muxinc/elements/compare/@mux/mux-audio-react@0.4.0...@mux/mux-audio-react@0.4.1) (2022-07-21)
25
+
26
+ **Note:** Version bump only for package @mux/mux-audio-react
27
+
28
+ # 0.4.0 (2022-07-05)
29
+
30
+ ### Bug Fixes
31
+
32
+ - **mux-audio-react:** use generateInitTime() instead of Date.now. ([d60f98c](https://github.com/muxinc/elements/commit/d60f98c3f9d626c2a0cb656ccafbb21b4802ca13))
33
+ - prettier format all elements files ([741d607](https://github.com/muxinc/elements/commit/741d607521ca9578cfad9f0a9216a6565b4c56a1))
34
+ - switch cjs extension to .cjs.js ([30e83c3](https://github.com/muxinc/elements/commit/30e83c3ce0bd9bfda4817c30ffe0921e425619e4))
35
+ - update react peerDependencies to allow ^18 ([1cfb019](https://github.com/muxinc/elements/commit/1cfb019b71cf9aa280abccaf4a7818d585b56d86))
36
+
37
+ ### Features
38
+
39
+ - add beaconCollectionDomain option to replace beaconDomain ([a44b699](https://github.com/muxinc/elements/commit/a44b699ae3138590b9d953f693f95971694658df))
40
+ - Extended autoplay options ([#116](https://github.com/muxinc/elements/issues/116)) ([475e838](https://github.com/muxinc/elements/commit/475e83884f641c578fa601c9501147d485fc1831))
41
+
42
+ ## [0.3.11](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.10...@mux-elements/mux-audio-react@0.3.11) (2022-06-23)
43
+
44
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
45
+
46
+ ## [0.3.10](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.9...@mux-elements/mux-audio-react@0.3.10) (2022-06-06)
47
+
48
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
49
+
50
+ ## [0.3.9](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.8...@mux-elements/mux-audio-react@0.3.9) (2022-05-26)
51
+
52
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
53
+
54
+ ## [0.3.8](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.7...@mux-elements/mux-audio-react@0.3.8) (2022-05-23)
55
+
56
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
57
+
58
+ ## [0.3.7](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.6...@mux-elements/mux-audio-react@0.3.7) (2022-05-20)
59
+
60
+ ### Bug Fixes
61
+
62
+ - switch cjs extension to .cjs.js ([30e83c3](https://github.com/muxinc/elements/commit/30e83c3ce0bd9bfda4817c30ffe0921e425619e4))
63
+
64
+ ## [0.3.6](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.5...@mux-elements/mux-audio-react@0.3.6) (2022-05-10)
65
+
66
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
67
+
68
+ ## [0.3.5](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.4...@mux-elements/mux-audio-react@0.3.5) (2022-05-03)
69
+
70
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
71
+
72
+ ## [0.3.4](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.3...@mux-elements/mux-audio-react@0.3.4) (2022-04-22)
73
+
74
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
75
+
76
+ ## [0.3.3](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.2...@mux-elements/mux-audio-react@0.3.3) (2022-04-18)
77
+
78
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
79
+
80
+ ## [0.3.2](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.1...@mux-elements/mux-audio-react@0.3.2) (2022-04-12)
81
+
82
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
83
+
84
+ ## [0.3.1](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.3.0...@mux-elements/mux-audio-react@0.3.1) (2022-04-01)
85
+
86
+ **Note:** Version bump only for package @mux-elements/mux-audio-react
87
+
88
+ # [0.3.0](https://github.com/muxinc/elements/compare/@mux-elements/mux-audio-react@0.2.0...@mux-elements/mux-audio-react@0.3.0) (2022-03-28)
89
+
90
+ ### Bug Fixes
91
+
92
+ - **mux-audio-react:** use generateInitTime() instead of Date.now. ([d60f98c](https://github.com/muxinc/elements/commit/d60f98c3f9d626c2a0cb656ccafbb21b4802ca13))
93
+ - prettier format all elements files ([741d607](https://github.com/muxinc/elements/commit/741d607521ca9578cfad9f0a9216a6565b4c56a1))
94
+
95
+ ### Features
96
+
97
+ - add beaconCollectionDomain option to replace beaconDomain ([a44b699](https://github.com/muxinc/elements/commit/a44b699ae3138590b9d953f693f95971694658df))
package/README.md CHANGED
@@ -90,11 +90,11 @@ const MuxAudioExample = () => {
90
90
 
91
91
  In addition, any props that you would use on a `<audio>` element like `poster`, `controls`, `muted` and `autoPlay` are available and should work the same as they do when using a audio element in react. One sidenote about `autoPlay` though -- [read this to understand why that might not always work as expected](https://docs.mux.com/guides/video/web-autoplay-your-videos).
92
92
 
93
- ### Advanced: preferMse
93
+ ### Advanced: preferPlayback
94
94
 
95
95
  By default `<MuxAudio/>` will try to use native playback via the underlying `<audio/>` tag whenever possible. However, it can also instead use an in-code player as long as the browser supports [Media Source Extensions](https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API). This includes MSE in Mac OS Safari.
96
96
 
97
- If you prefer to use the in-code MSE-based engine (currently hls.js) whenever possible, then simply set the `preferMse` prop.
97
+ If you prefer to use the in-code MSE-based engine (currently hls.js) whenever possible, then simply set the `preferPlayback` prop to `mse`.
98
98
 
99
99
  ```jsx
100
100
  <MuxAudio
@@ -104,7 +104,7 @@ If you prefer to use the in-code MSE-based engine (currently hls.js) whenever po
104
104
  video_title: 'Super Interesting Audio',
105
105
  viewer_user_id: 'user-id-bc-789',
106
106
  }}
107
- preferMse
107
+ preferPlayback="mse"
108
108
  controls
109
109
  />
110
110
  ```
package/dist/cjs.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "inputs": {
3
+ "src/use-combined-refs.ts": {
4
+ "bytes": 831,
5
+ "imports": []
6
+ },
7
+ "src/env.ts": {
8
+ "bytes": 391,
9
+ "imports": []
10
+ },
11
+ "src/index.tsx": {
12
+ "bytes": 2638,
13
+ "imports": [
14
+ {
15
+ "path": "src/use-combined-refs.ts",
16
+ "kind": "import-statement"
17
+ },
18
+ {
19
+ "path": "src/env.ts",
20
+ "kind": "import-statement"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ "outputs": {
26
+ "dist/index.cjs.js.map": {
27
+ "imports": [],
28
+ "exports": [],
29
+ "inputs": {},
30
+ "bytes": 6647
31
+ },
32
+ "dist/index.cjs.js": {
33
+ "imports": [],
34
+ "exports": [],
35
+ "entryPoint": "src/index.tsx",
36
+ "inputs": {
37
+ "src/index.tsx": {
38
+ "bytesInOutput": 1335
39
+ },
40
+ "src/use-combined-refs.ts": {
41
+ "bytesInOutput": 171
42
+ },
43
+ "src/env.ts": {
44
+ "bytesInOutput": 67
45
+ }
46
+ },
47
+ "bytes": 2182
48
+ }
49
+ }
50
+ }
package/dist/esm.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "inputs": {
3
+ "src/use-combined-refs.ts": {
4
+ "bytes": 831,
5
+ "imports": []
6
+ },
7
+ "src/env.ts": {
8
+ "bytes": 391,
9
+ "imports": []
10
+ },
11
+ "src/index.tsx": {
12
+ "bytes": 2638,
13
+ "imports": [
14
+ {
15
+ "path": "src/use-combined-refs.ts",
16
+ "kind": "import-statement"
17
+ },
18
+ {
19
+ "path": "src/env.ts",
20
+ "kind": "import-statement"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ "outputs": {
26
+ "dist/index.mjs.map": {
27
+ "imports": [],
28
+ "exports": [],
29
+ "inputs": {},
30
+ "bytes": 6872
31
+ },
32
+ "dist/index.mjs": {
33
+ "imports": [],
34
+ "exports": [
35
+ "default"
36
+ ],
37
+ "entryPoint": "src/index.tsx",
38
+ "inputs": {
39
+ "src/use-combined-refs.ts": {
40
+ "bytesInOutput": 174
41
+ },
42
+ "src/index.tsx": {
43
+ "bytesInOutput": 1122
44
+ },
45
+ "src/env.ts": {
46
+ "bytesInOutput": 67
47
+ }
48
+ },
49
+ "bytes": 1420
50
+ }
51
+ }
52
+ }
package/dist/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var k=Object.create;var f=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},M=(e,t,r,y)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of H(t))!U.call(e,i)&&i!==r&&f(e,i,{get:()=>t[i],enumerable:!(y=w(t,i))||y.enumerable});return e};var P=(e,t,r)=>(r=e!=null?k(I(e)):{},M(t||!e||!e.__esModule?f(r,"default",{value:e,enumerable:!0}):r,e)),N=e=>M(f({},"__esModule",{value:!0}),e);var z={};V(z,{default:()=>_});module.exports=N(z);var l=require("react"),g=(...e)=>{let t=(0,l.useRef)(null);return(0,l.useEffect)(()=>{e.forEach(r=>{!r||(typeof r=="function"?r(t.current):r.current=t.current)})},[e]),t};var n=P(require("react")),a=P(require("prop-types")),o=require("@mux/playback-core");var h=()=>{try{return"0.4.3"}catch{}return"UNKNOWN"},D=h(),E=()=>D;var K=E(),W="mux-audio-react",x=n.default.forwardRef((e,t)=>{var R;let{envKey:r,debug:y,beaconCollectionDomain:i,playbackId:d,preferMse:B,type:Y,streamType:q,startTime:F,src:m,children:A,autoPlay:s,...O}=e,[C]=(0,n.useState)((0,o.generatePlayerInitTime)()),[T,S]=(0,n.useState)((R=(0,o.toMuxVideoURL)(d))!=null?R:m),b=(0,n.useRef)(void 0),L=(0,n.useRef)(null),u=g(L,t),G=(0,n.useRef)(void 0),[v,j]=(0,n.useState)(()=>p=>{});return(0,n.useEffect)(()=>{var c;let p=(c=(0,o.toMuxVideoURL)(d))!=null?c:m;S(p)},[m,d]),(0,n.useEffect)(()=>{let p={...e,src:T,playerInitTime:C,playerSoftwareName:W,playerSoftwareVersion:K,autoplay:s},c=(0,o.initialize)(p,u.current,b.current);b.current=c,j(()=>{!u.current||(0,o.setupAutoplay)(u.current,s,b.current)})},[T]),(0,n.useEffect)(()=>{v(s)},[s]),n.default.createElement("audio",{ref:u,...O},A)});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(o.allMediaTypes),streamType:a.default.oneOf(Object.values(o.StreamTypes)),startTime:a.default.number};var _=x;
1
+ "use strict";var v=Object.create;var c=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},M=(e,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of j(t))!H.call(e,s)&&s!==r&&c(e,s,{get:()=>t[s],enumerable:!(l=L(t,s))||l.enumerable});return e};var P=(e,t,r)=>(r=e!=null?v(w(e)):{},M(t||!e||!e.__esModule?c(r,"default",{value:e,enumerable:!0}):r,e)),V=e=>M(c({},"__esModule",{value:!0}),e);var W={};I(W,{default:()=>U});module.exports=V(W);var p=require("react"),x=(...e)=>{let t=(0,p.useRef)(null);return(0,p.useEffect)(()=>{e.forEach(r=>{!r||(typeof r=="function"?r(t.current):r.current=t.current)})},[e]),t};var o=P(require("react")),a=P(require("prop-types")),n=require("@mux/playback-core");var N=()=>{try{return"0.5.0"}catch{}return"UNKNOWN"},h=N(),g=()=>h;var D=g(),K="mux-audio-react",E=o.default.forwardRef((e,t)=>{var R;let{envKey:r,debug:l,beaconCollectionDomain:s,playbackId:f,preferPlayback:_,type:z,streamType:B,startTime:Y,src:y,children:O,autoPlay:d,preload:m,...C}=e,[k]=(0,o.useState)((0,n.generatePlayerInitTime)()),[b,A]=(0,o.useState)((R=(0,n.toMuxVideoURL)(f))!=null?R:y),u=(0,o.useRef)(void 0),S=(0,o.useRef)(null),T=x(S,t);return(0,o.useEffect)(()=>{var i;A((i=(0,n.toMuxVideoURL)(f))!=null?i:y)},[y,f]),(0,o.useEffect)(()=>{let i={...e,src:b,playerInitTime:k,playerSoftwareName:K,playerSoftwareVersion:D,autoplay:d};u.current=(0,n.initialize)(i,T.current,u.current)},[b]),(0,o.useEffect)(()=>{var i;(i=u.current)==null||i.setAutoplay(d)},[d]),(0,o.useEffect)(()=>{var i;(i=u.current)==null||i.setPreload(m)},[m]),o.default.createElement("audio",{ref:T,...C},O)});E.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,preferPlayback:a.default.oneOf(Object.values(n.PlaybackTypes)),type:a.default.oneOf(n.allMediaTypes),streamType:a.default.oneOf(Object.values(n.StreamTypes)),startTime:a.default.number};var U=E;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.tsx", "../src/use-combined-refs.ts", "../src/env.ts"],
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 type Autoplay,\n type UpdateAutoplay,\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.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>,\n 'autoPlay'\n> &\n MuxMediaProps;\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio-react';\n\nconst MuxAudio = React.forwardRef<HTMLAudioElement | 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<HTMLAudioElement>(null);\n\n const mediaElRef = useCombinedRefs(innerMediaElRef, ref);\n const updateAutoplayRef = useRef<UpdateAutoplay | undefined>(undefined);\n const [updateAutoplay, setUpdateAutoplay] = useState(() => (x: any) => {});\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(() => {\n if (!mediaElRef.current) return;\n setupAutoplay(mediaElRef.current, autoPlay, playbackEngineRef.current);\n });\n }, [src]);\n\n useEffect(() => {\n updateAutoplay(autoPlay);\n }, [autoPlay]);\n\n return (\n /** @TODO Fix types relationships (CJP) */\n <audio ref={mediaElRef as typeof innerMediaElRef} {...restProps}>\n {children}\n </audio>\n );\n});\n\nMuxAudio.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 MuxAudio;\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\n// TS assumed default export was interface def instead of function value (CJP)\nconst defaultUseCombinedRefs = useCombinedRefs;\nexport default defaultUseCombinedRefs;\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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAoD,iBAUvCC,EAAmC,IAAIC,IAAS,CAC3D,IAAMC,KAAY,UAAO,IAAI,EAE7B,sBAAU,IAAM,CACdD,EAAK,QAASE,GAAQ,CAChB,CAACA,IAED,OAAOA,GAAQ,WACjBA,EAAID,EAAU,OAAO,EAErBC,EAAI,QAAUD,EAAU,QAE5B,CAAC,CACH,EAAG,CAACD,CAAI,CAAC,EAEFC,CACT,EDzBA,IAAAE,EAAmD,oBACnDC,EAAsB,yBACtBC,EAWO,8BEVP,IAAMC,EAAsB,IAAM,CAChC,GAAI,CAEF,MAAO,OACT,MAAE,CAAO,CACT,MAAO,SACT,EAEMC,EAAyBD,EAAoB,EAEtCE,EAAmB,IAAMD,EFStC,IAAME,EAAwBC,EAAiB,EACzCC,EAAqB,kBAErBC,EAAW,EAAAC,QAAM,WAAyD,CAACC,EAAOC,IAAQ,CA1BhG,IAAAC,EA2BE,GAAM,CACJ,OAAAC,EACA,MAAAC,EACA,uBAAAC,EACA,WAAAC,EACA,UAAAC,EACA,KAAAC,EACA,WAAAC,EACA,UAAAC,EACA,IAAKC,EACL,SAAAC,EACA,SAAAC,KACGC,CACL,EAAId,EAEE,CAACe,CAAc,KAAI,eAAS,0BAAuB,CAAC,EAEpD,CAACC,EAAKC,CAAM,KAAI,aAA+Bf,KAAA,iBAAcI,CAAU,IAAxB,KAAAJ,EAA6BS,CAAQ,EAEpFO,KAAoB,UAAmC,MAAS,EAChEC,KAAkB,UAAyB,IAAI,EAE/CC,EAAaC,EAAgBF,EAAiBlB,CAAG,EACjDqB,KAAoB,UAAmC,MAAS,EAChE,CAACC,EAAgBC,CAAiB,KAAI,YAAS,IAAOC,GAAW,CAAC,CAAC,EAEzE,sBAAU,IAAM,CArDlB,IAAAvB,EAsDI,IAAMc,GAAMd,KAAA,iBAAcI,CAAU,IAAxB,KAAAJ,EAA6BS,EACzCM,EAAOD,CAAG,CACZ,EAAG,CAACL,EAAUL,CAAU,CAAC,KAEzB,aAAU,IAAM,CACd,IAAMoB,EAAiB,CACrB,GAAG1B,EACH,IAAAgB,EACA,eAAAD,EACA,mBAAAlB,EACA,sBAAAF,EACA,SAAUkB,CACZ,EACMc,KAAwB,cAAWD,EAAgBN,EAAW,QAASF,EAAkB,OAAO,EACtGA,EAAkB,QAAUS,EAC5BH,EAAkB,IAAM,CAClB,CAACJ,EAAW,YAChB,iBAAcA,EAAW,QAASP,EAAUK,EAAkB,OAAO,CACvE,CAAC,CACH,EAAG,CAACF,CAAG,CAAC,KAER,aAAU,IAAM,CACdO,EAAeV,CAAQ,CACzB,EAAG,CAACA,CAAQ,CAAC,EAIX,EAAAd,QAAA,cAAC,SAAM,IAAKqB,EAAuC,GAAGN,GACnDF,CACH,CAEJ,CAAC,EAEDd,EAAS,UAAY,CACnB,OAAQ,EAAA8B,QAAU,OAClB,MAAO,EAAAA,QAAU,KAGjB,SAAU,EAAAA,QAAU,IACpB,uBAAwB,EAAAA,QAAU,OAClC,WAAY,EAAAA,QAAU,OACtB,eAAgB,EAAAA,QAAU,OAC1B,UAAW,EAAAA,QAAU,KACrB,KAAM,EAAAA,QAAU,MAAM,eAAa,EACnC,WAAY,EAAAA,QAAU,MAAM,OAAO,OAAO,aAAW,CAAC,EACtD,UAAW,EAAAA,QAAU,MACvB,EAEA,IAAOC,EAAQ/B",
6
- "names": ["src_exports", "__export", "src_default", "__toCommonJS", "import_react", "useCombinedRefs", "refs", "targetRef", "ref", "import_react", "import_prop_types", "import_playback_core", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "MuxAudio", "React", "props", "ref", "_a", "envKey", "debug", "beaconCollectionDomain", "playbackId", "preferMse", "type", "streamType", "startTime", "outerSrc", "children", "autoPlay", "restProps", "playerInitTime", "src", "setSrc", "playbackEngineRef", "innerMediaElRef", "mediaElRef", "useCombinedRefs", "updateAutoplayRef", "updateAutoplay", "setUpdateAutoplay", "x", "propsWithState", "nextPlaybackEngineRef", "PropTypes", "src_default"]
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 MuxMediaProps,\n StreamTypes,\n PlaybackTypes,\n toMuxVideoURL,\n generatePlayerInitTime,\n} from '@mux/playback-core';\nimport type { PlaybackCore } from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n\nexport type Props = Omit<\n React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>,\n 'autoPlay'\n> &\n MuxMediaProps;\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio-react';\n\nconst MuxAudio = React.forwardRef<HTMLAudioElement | undefined, Partial<Props>>((props, ref) => {\n const {\n envKey,\n debug,\n beaconCollectionDomain,\n playbackId,\n preferPlayback,\n type,\n streamType,\n startTime,\n src: outerSrc,\n children,\n autoPlay,\n preload,\n ...restProps\n } = props;\n\n const [playerInitTime] = useState(generatePlayerInitTime());\n const [src, setSrc] = useState<MuxMediaProps['src']>(toMuxVideoURL(playbackId) ?? outerSrc);\n const playbackCoreRef = useRef<PlaybackCore | undefined>(undefined);\n const innerMediaElRef = useRef<HTMLAudioElement>(null);\n const mediaElRef = useCombinedRefs(innerMediaElRef, ref);\n\n useEffect(() => {\n setSrc(toMuxVideoURL(playbackId) ?? outerSrc);\n }, [outerSrc, playbackId]);\n\n useEffect(() => {\n const propsWithState = {\n ...props,\n src,\n playerInitTime,\n playerSoftwareName,\n playerSoftwareVersion,\n autoplay: autoPlay,\n };\n playbackCoreRef.current = initialize(propsWithState, mediaElRef.current, playbackCoreRef.current);\n }, [src]);\n\n useEffect(() => {\n playbackCoreRef.current?.setAutoplay(autoPlay);\n }, [autoPlay]);\n\n useEffect(() => {\n playbackCoreRef.current?.setPreload(preload);\n }, [preload]);\n\n return (\n /** @TODO Fix types relationships (CJP) */\n <audio ref={mediaElRef as typeof innerMediaElRef} {...restProps}>\n {children}\n </audio>\n );\n});\n\nMuxAudio.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 preferPlayback: PropTypes.oneOf(Object.values(PlaybackTypes)),\n type: PropTypes.oneOf(allMediaTypes),\n streamType: PropTypes.oneOf(Object.values(StreamTypes)),\n startTime: PropTypes.number,\n};\n\nexport default MuxAudio;\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\n// TS assumed default export was interface def instead of function value (CJP)\nconst defaultUseCombinedRefs = useCombinedRefs;\nexport default defaultUseCombinedRefs;\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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAoD,iBAUvCC,EAAmC,IAAIC,IAAS,CAC3D,IAAMC,KAAY,UAAO,IAAI,EAE7B,sBAAU,IAAM,CACdD,EAAK,QAASE,GAAQ,CAChB,CAACA,IAED,OAAOA,GAAQ,WACjBA,EAAID,EAAU,OAAO,EAErBC,EAAI,QAAUD,EAAU,QAE5B,CAAC,CACH,EAAG,CAACD,CAAI,CAAC,EAEFC,CACT,EDzBA,IAAAE,EAAmD,oBACnDC,EAAsB,yBACtBC,EAQO,8BEPP,IAAMC,EAAsB,IAAM,CAChC,GAAI,CAEF,MAAO,OACT,MAAE,CAAO,CACT,MAAO,SACT,EAEMC,EAAyBD,EAAoB,EAEtCE,EAAmB,IAAMD,EFOtC,IAAME,EAAwBC,EAAiB,EACzCC,EAAqB,kBAErBC,EAAW,EAAAC,QAAM,WAAyD,CAACC,EAAOC,IAAQ,CAxBhG,IAAAC,EAyBE,GAAM,CACJ,OAAAC,EACA,MAAAC,EACA,uBAAAC,EACA,WAAAC,EACA,eAAAC,EACA,KAAAC,EACA,WAAAC,EACA,UAAAC,EACA,IAAKC,EACL,SAAAC,EACA,SAAAC,EACA,QAAAC,KACGC,CACL,EAAIf,EAEE,CAACgB,CAAc,KAAI,eAAS,0BAAuB,CAAC,EACpD,CAACC,EAAKC,CAAM,KAAI,aAA+BhB,KAAA,iBAAcI,CAAU,IAAxB,KAAAJ,EAA6BS,CAAQ,EACpFQ,KAAkB,UAAiC,MAAS,EAC5DC,KAAkB,UAAyB,IAAI,EAC/CC,EAAaC,EAAgBF,EAAiBnB,CAAG,EAEvD,sBAAU,IAAM,CA/ClB,IAAAC,EAgDIgB,GAAOhB,KAAA,iBAAcI,CAAU,IAAxB,KAAAJ,EAA6BS,CAAQ,CAC9C,EAAG,CAACA,EAAUL,CAAU,CAAC,KAEzB,aAAU,IAAM,CACd,IAAMiB,EAAiB,CACrB,GAAGvB,EACH,IAAAiB,EACA,eAAAD,EACA,mBAAAnB,EACA,sBAAAF,EACA,SAAUkB,CACZ,EACAM,EAAgB,WAAU,cAAWI,EAAgBF,EAAW,QAASF,EAAgB,OAAO,CAClG,EAAG,CAACF,CAAG,CAAC,KAER,aAAU,IAAM,CA/DlB,IAAAf,GAgEIA,EAAAiB,EAAgB,UAAhB,MAAAjB,EAAyB,YAAYW,EACvC,EAAG,CAACA,CAAQ,CAAC,KAEb,aAAU,IAAM,CAnElB,IAAAX,GAoEIA,EAAAiB,EAAgB,UAAhB,MAAAjB,EAAyB,WAAWY,EACtC,EAAG,CAACA,CAAO,CAAC,EAIV,EAAAf,QAAA,cAAC,SAAM,IAAKsB,EAAuC,GAAGN,GACnDH,CACH,CAEJ,CAAC,EAEDd,EAAS,UAAY,CACnB,OAAQ,EAAA0B,QAAU,OAClB,MAAO,EAAAA,QAAU,KAGjB,SAAU,EAAAA,QAAU,IACpB,uBAAwB,EAAAA,QAAU,OAClC,WAAY,EAAAA,QAAU,OACtB,eAAgB,EAAAA,QAAU,OAC1B,eAAgB,EAAAA,QAAU,MAAM,OAAO,OAAO,eAAa,CAAC,EAC5D,KAAM,EAAAA,QAAU,MAAM,eAAa,EACnC,WAAY,EAAAA,QAAU,MAAM,OAAO,OAAO,aAAW,CAAC,EACtD,UAAW,EAAAA,QAAU,MACvB,EAEA,IAAOC,EAAQ3B",
6
+ "names": ["src_exports", "__export", "src_default", "__toCommonJS", "import_react", "useCombinedRefs", "refs", "targetRef", "ref", "import_react", "import_prop_types", "import_playback_core", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "MuxAudio", "React", "props", "ref", "_a", "envKey", "debug", "beaconCollectionDomain", "playbackId", "preferPlayback", "type", "streamType", "startTime", "outerSrc", "children", "autoPlay", "preload", "restProps", "playerInitTime", "src", "setSrc", "playbackCoreRef", "innerMediaElRef", "mediaElRef", "useCombinedRefs", "propsWithState", "PropTypes", "src_default"]
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{useEffect as L,useRef as v}from"react";var b=(...t)=>{let n=v(null);return L(()=>{t.forEach(r=>{!r||(typeof r=="function"?r(n.current):r.current=n.current)})},[t]),n};import R,{useEffect as f,useRef as l,useState as y}from"react";import e from"prop-types";import{allMediaTypes as w,initialize as H,setupAutoplay as I,StreamTypes as U,toMuxVideoURL as M,generatePlayerInitTime as V}from"@mux/playback-core";var j=()=>{try{return"0.4.3"}catch{}return"UNKNOWN"},k=j(),T=()=>k;var N=T(),h="mux-audio-react",P=R.forwardRef((t,n)=>{var m;let{envKey:r,debug:D,beaconCollectionDomain:K,playbackId:u,preferMse:W,type:_,streamType:z,startTime:B,src:p,children:g,autoPlay:o,...E}=t,[x]=y(V()),[d,A]=y((m=M(u))!=null?m:p),c=l(void 0),O=l(null),a=b(O,n),Y=l(void 0),[C,S]=y(()=>i=>{});return f(()=>{var s;let i=(s=M(u))!=null?s:p;A(i)},[p,u]),f(()=>{let i={...t,src:d,playerInitTime:x,playerSoftwareName:h,playerSoftwareVersion:N,autoplay:o},s=H(i,a.current,c.current);c.current=s,S(()=>{!a.current||I(a.current,o,c.current)})},[d]),f(()=>{C(o)},[o]),R.createElement("audio",{ref:a,...E},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(w),streamType:e.oneOf(Object.values(U)),startTime:e.number};var re=P;export{re as default};
1
+ import{useEffect as k,useRef as A}from"react";var d=(...r)=>{let o=A(null);return k(()=>{r.forEach(n=>{!n||(typeof n=="function"?n(o.current):n.current=o.current)})},[r]),o};import b,{useEffect as i,useRef as T,useState as R}from"react";import t from"prop-types";import{allMediaTypes as L,initialize as j,StreamTypes as w,PlaybackTypes as H,toMuxVideoURL as M,generatePlayerInitTime as I}from"@mux/playback-core";var S=()=>{try{return"0.5.0"}catch{}return"UNKNOWN"},v=S(),m=()=>v;var V=m(),N="mux-audio-react",P=b.forwardRef((r,o)=>{var y;let{envKey:n,debug:h,beaconCollectionDomain:D,playbackId:s,preferPlayback:K,type:U,streamType:W,startTime:_,src:u,children:x,autoPlay:c,preload:p,...g}=r,[E]=R(I()),[l,O]=R((y=M(s))!=null?y:u),a=T(void 0),C=T(null),f=d(C,o);return i(()=>{var e;O((e=M(s))!=null?e:u)},[u,s]),i(()=>{let e={...r,src:l,playerInitTime:E,playerSoftwareName:N,playerSoftwareVersion:V,autoplay:c};a.current=j(e,f.current,a.current)},[l]),i(()=>{var e;(e=a.current)==null||e.setAutoplay(c)},[c]),i(()=>{var e;(e=a.current)==null||e.setPreload(p)},[p]),b.createElement("audio",{ref:f,...g},x)});P.propTypes={envKey:t.string,debug:t.bool,metadata:t.any,beaconCollectionDomain:t.string,playbackId:t.string,playerInitTime:t.number,preferPlayback:t.oneOf(Object.values(H)),type:t.oneOf(L),streamType:t.oneOf(Object.values(w)),startTime:t.number};var $=P;export{$ as default};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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\n// TS assumed default export was interface def instead of function value (CJP)\nconst defaultUseCombinedRefs = useCombinedRefs;\nexport default defaultUseCombinedRefs;\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 type Autoplay,\n type UpdateAutoplay,\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.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>,\n 'autoPlay'\n> &\n MuxMediaProps;\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio-react';\n\nconst MuxAudio = React.forwardRef<HTMLAudioElement | 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<HTMLAudioElement>(null);\n\n const mediaElRef = useCombinedRefs(innerMediaElRef, ref);\n const updateAutoplayRef = useRef<UpdateAutoplay | undefined>(undefined);\n const [updateAutoplay, setUpdateAutoplay] = useState(() => (x: any) => {});\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(() => {\n if (!mediaElRef.current) return;\n setupAutoplay(mediaElRef.current, autoPlay, playbackEngineRef.current);\n });\n }, [src]);\n\n useEffect(() => {\n updateAutoplay(autoPlay);\n }, [autoPlay]);\n\n return (\n /** @TODO Fix types relationships (CJP) */\n <audio ref={mediaElRef as typeof innerMediaElRef} {...restProps}>\n {children}\n </audio>\n );\n});\n\nMuxAudio.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 MuxAudio;\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,OAAS,aAAAA,EAAW,UAAAC,MAAgC,QAU7C,IAAMC,EAAmC,IAAIC,IAAS,CAC3D,IAAMC,EAAYH,EAAO,IAAI,EAE7B,OAAAD,EAAU,IAAM,CACdG,EAAK,QAASE,GAAQ,CAChB,CAACA,IAED,OAAOA,GAAQ,WACjBA,EAAID,EAAU,OAAO,EAErBC,EAAI,QAAUD,EAAU,QAE5B,CAAC,CACH,EAAG,CAACD,CAAI,CAAC,EAEFC,CACT,ECzBA,OAAOE,GAAS,aAAAC,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QACnD,OAAOC,MAAe,aACtB,OACE,iBAAAC,EACA,cAAAC,EAGA,iBAAAC,EAEA,eAAAC,EACA,iBAAAC,EAEA,0BAAAC,MACK,qBCVP,IAAMC,EAAsB,IAAM,CAChC,GAAI,CAEF,MAAO,OACT,MAAE,CAAO,CACT,MAAO,SACT,EAEMC,EAAyBD,EAAoB,EAEtCE,EAAmB,IAAMD,EDStC,IAAME,EAAwBC,EAAiB,EACzCC,EAAqB,kBAErBC,EAAWC,EAAM,WAAyD,CAACC,EAAOC,IAAQ,CA1BhG,IAAAC,EA2BE,GAAM,CACJ,OAAAC,EACA,MAAAC,EACA,uBAAAC,EACA,WAAAC,EACA,UAAAC,EACA,KAAAC,EACA,WAAAC,EACA,UAAAC,EACA,IAAKC,EACL,SAAAC,EACA,SAAAC,KACGC,CACL,EAAId,EAEE,CAACe,CAAc,EAAIC,EAASC,EAAuB,CAAC,EAEpD,CAACC,EAAKC,CAAM,EAAIH,GAA+Bd,EAAAkB,EAAcd,CAAU,IAAxB,KAAAJ,EAA6BS,CAAQ,EAEpFU,EAAoBC,EAAmC,MAAS,EAChEC,EAAkBD,EAAyB,IAAI,EAE/CE,EAAaC,EAAgBF,EAAiBtB,CAAG,EACjDyB,EAAoBJ,EAAmC,MAAS,EAChE,CAACK,EAAgBC,CAAiB,EAAIZ,EAAS,IAAOa,GAAW,CAAC,CAAC,EAEzE,OAAAC,EAAU,IAAM,CArDlB,IAAA5B,EAsDI,IAAMgB,GAAMhB,EAAAkB,EAAcd,CAAU,IAAxB,KAAAJ,EAA6BS,EACzCQ,EAAOD,CAAG,CACZ,EAAG,CAACP,EAAUL,CAAU,CAAC,EAEzBwB,EAAU,IAAM,CACd,IAAMC,EAAiB,CACrB,GAAG/B,EACH,IAAAkB,EACA,eAAAH,EACA,mBAAAlB,EACA,sBAAAF,EACA,SAAUkB,CACZ,EACMmB,EAAwBC,EAAWF,EAAgBP,EAAW,QAASH,EAAkB,OAAO,EACtGA,EAAkB,QAAUW,EAC5BJ,EAAkB,IAAM,CAClB,CAACJ,EAAW,SAChBU,EAAcV,EAAW,QAASX,EAAUQ,EAAkB,OAAO,CACvE,CAAC,CACH,EAAG,CAACH,CAAG,CAAC,EAERY,EAAU,IAAM,CACdH,EAAed,CAAQ,CACzB,EAAG,CAACA,CAAQ,CAAC,EAIXd,EAAA,cAAC,SAAM,IAAKyB,EAAuC,GAAGV,GACnDF,CACH,CAEJ,CAAC,EAEDd,EAAS,UAAY,CACnB,OAAQqC,EAAU,OAClB,MAAOA,EAAU,KAGjB,SAAUA,EAAU,IACpB,uBAAwBA,EAAU,OAClC,WAAYA,EAAU,OACtB,eAAgBA,EAAU,OAC1B,UAAWA,EAAU,KACrB,KAAMA,EAAU,MAAMC,CAAa,EACnC,WAAYD,EAAU,MAAM,OAAO,OAAOE,CAAW,CAAC,EACtD,UAAWF,EAAU,MACvB,EAEA,IAAOG,GAAQxC",
6
- "names": ["useEffect", "useRef", "useCombinedRefs", "refs", "targetRef", "ref", "React", "useEffect", "useRef", "useState", "PropTypes", "allMediaTypes", "initialize", "setupAutoplay", "StreamTypes", "toMuxVideoURL", "generatePlayerInitTime", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "MuxAudio", "React", "props", "ref", "_a", "envKey", "debug", "beaconCollectionDomain", "playbackId", "preferMse", "type", "streamType", "startTime", "outerSrc", "children", "autoPlay", "restProps", "playerInitTime", "useState", "generatePlayerInitTime", "src", "setSrc", "toMuxVideoURL", "playbackEngineRef", "useRef", "innerMediaElRef", "mediaElRef", "useCombinedRefs", "updateAutoplayRef", "updateAutoplay", "setUpdateAutoplay", "x", "useEffect", "propsWithState", "nextPlaybackEngineRef", "initialize", "setupAutoplay", "PropTypes", "allMediaTypes", "StreamTypes", "src_default"]
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\n// TS assumed default export was interface def instead of function value (CJP)\nconst defaultUseCombinedRefs = useCombinedRefs;\nexport default defaultUseCombinedRefs;\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 MuxMediaProps,\n StreamTypes,\n PlaybackTypes,\n toMuxVideoURL,\n generatePlayerInitTime,\n} from '@mux/playback-core';\nimport type { PlaybackCore } from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n\nexport type Props = Omit<\n React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>,\n 'autoPlay'\n> &\n MuxMediaProps;\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio-react';\n\nconst MuxAudio = React.forwardRef<HTMLAudioElement | undefined, Partial<Props>>((props, ref) => {\n const {\n envKey,\n debug,\n beaconCollectionDomain,\n playbackId,\n preferPlayback,\n type,\n streamType,\n startTime,\n src: outerSrc,\n children,\n autoPlay,\n preload,\n ...restProps\n } = props;\n\n const [playerInitTime] = useState(generatePlayerInitTime());\n const [src, setSrc] = useState<MuxMediaProps['src']>(toMuxVideoURL(playbackId) ?? outerSrc);\n const playbackCoreRef = useRef<PlaybackCore | undefined>(undefined);\n const innerMediaElRef = useRef<HTMLAudioElement>(null);\n const mediaElRef = useCombinedRefs(innerMediaElRef, ref);\n\n useEffect(() => {\n setSrc(toMuxVideoURL(playbackId) ?? outerSrc);\n }, [outerSrc, playbackId]);\n\n useEffect(() => {\n const propsWithState = {\n ...props,\n src,\n playerInitTime,\n playerSoftwareName,\n playerSoftwareVersion,\n autoplay: autoPlay,\n };\n playbackCoreRef.current = initialize(propsWithState, mediaElRef.current, playbackCoreRef.current);\n }, [src]);\n\n useEffect(() => {\n playbackCoreRef.current?.setAutoplay(autoPlay);\n }, [autoPlay]);\n\n useEffect(() => {\n playbackCoreRef.current?.setPreload(preload);\n }, [preload]);\n\n return (\n /** @TODO Fix types relationships (CJP) */\n <audio ref={mediaElRef as typeof innerMediaElRef} {...restProps}>\n {children}\n </audio>\n );\n});\n\nMuxAudio.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 preferPlayback: PropTypes.oneOf(Object.values(PlaybackTypes)),\n type: PropTypes.oneOf(allMediaTypes),\n streamType: PropTypes.oneOf(Object.values(StreamTypes)),\n startTime: PropTypes.number,\n};\n\nexport default MuxAudio;\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,OAAS,aAAAA,EAAW,UAAAC,MAAgC,QAU7C,IAAMC,EAAmC,IAAIC,IAAS,CAC3D,IAAMC,EAAYH,EAAO,IAAI,EAE7B,OAAAD,EAAU,IAAM,CACdG,EAAK,QAASE,GAAQ,CAChB,CAACA,IAED,OAAOA,GAAQ,WACjBA,EAAID,EAAU,OAAO,EAErBC,EAAI,QAAUD,EAAU,QAE5B,CAAC,CACH,EAAG,CAACD,CAAI,CAAC,EAEFC,CACT,ECzBA,OAAOE,GAAS,aAAAC,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QACnD,OAAOC,MAAe,aACtB,OACE,iBAAAC,EACA,cAAAC,EAEA,eAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,0BAAAC,MACK,qBCPP,IAAMC,EAAsB,IAAM,CAChC,GAAI,CAEF,MAAO,OACT,MAAE,CAAO,CACT,MAAO,SACT,EAEMC,EAAyBD,EAAoB,EAEtCE,EAAmB,IAAMD,EDOtC,IAAME,EAAwBC,EAAiB,EACzCC,EAAqB,kBAErBC,EAAWC,EAAM,WAAyD,CAACC,EAAOC,IAAQ,CAxBhG,IAAAC,EAyBE,GAAM,CACJ,OAAAC,EACA,MAAAC,EACA,uBAAAC,EACA,WAAAC,EACA,eAAAC,EACA,KAAAC,EACA,WAAAC,EACA,UAAAC,EACA,IAAKC,EACL,SAAAC,EACA,SAAAC,EACA,QAAAC,KACGC,CACL,EAAIf,EAEE,CAACgB,CAAc,EAAIC,EAASC,EAAuB,CAAC,EACpD,CAACC,EAAKC,CAAM,EAAIH,GAA+Bf,EAAAmB,EAAcf,CAAU,IAAxB,KAAAJ,EAA6BS,CAAQ,EACpFW,EAAkBC,EAAiC,MAAS,EAC5DC,EAAkBD,EAAyB,IAAI,EAC/CE,EAAaC,EAAgBF,EAAiBvB,CAAG,EAEvD,OAAA0B,EAAU,IAAM,CA/ClB,IAAAzB,EAgDIkB,GAAOlB,EAAAmB,EAAcf,CAAU,IAAxB,KAAAJ,EAA6BS,CAAQ,CAC9C,EAAG,CAACA,EAAUL,CAAU,CAAC,EAEzBqB,EAAU,IAAM,CACd,IAAMC,EAAiB,CACrB,GAAG5B,EACH,IAAAmB,EACA,eAAAH,EACA,mBAAAnB,EACA,sBAAAF,EACA,SAAUkB,CACZ,EACAS,EAAgB,QAAUO,EAAWD,EAAgBH,EAAW,QAASH,EAAgB,OAAO,CAClG,EAAG,CAACH,CAAG,CAAC,EAERQ,EAAU,IAAM,CA/DlB,IAAAzB,GAgEIA,EAAAoB,EAAgB,UAAhB,MAAApB,EAAyB,YAAYW,EACvC,EAAG,CAACA,CAAQ,CAAC,EAEbc,EAAU,IAAM,CAnElB,IAAAzB,GAoEIA,EAAAoB,EAAgB,UAAhB,MAAApB,EAAyB,WAAWY,EACtC,EAAG,CAACA,CAAO,CAAC,EAIVf,EAAA,cAAC,SAAM,IAAK0B,EAAuC,GAAGV,GACnDH,CACH,CAEJ,CAAC,EAEDd,EAAS,UAAY,CACnB,OAAQgC,EAAU,OAClB,MAAOA,EAAU,KAGjB,SAAUA,EAAU,IACpB,uBAAwBA,EAAU,OAClC,WAAYA,EAAU,OACtB,eAAgBA,EAAU,OAC1B,eAAgBA,EAAU,MAAM,OAAO,OAAOC,CAAa,CAAC,EAC5D,KAAMD,EAAU,MAAME,CAAa,EACnC,WAAYF,EAAU,MAAM,OAAO,OAAOG,CAAW,CAAC,EACtD,UAAWH,EAAU,MACvB,EAEA,IAAOI,EAAQpC",
6
+ "names": ["useEffect", "useRef", "useCombinedRefs", "refs", "targetRef", "ref", "React", "useEffect", "useRef", "useState", "PropTypes", "allMediaTypes", "initialize", "StreamTypes", "PlaybackTypes", "toMuxVideoURL", "generatePlayerInitTime", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "MuxAudio", "React", "props", "ref", "_a", "envKey", "debug", "beaconCollectionDomain", "playbackId", "preferPlayback", "type", "streamType", "startTime", "outerSrc", "children", "autoPlay", "preload", "restProps", "playerInitTime", "useState", "generatePlayerInitTime", "src", "setSrc", "toMuxVideoURL", "playbackCoreRef", "useRef", "innerMediaElRef", "mediaElRef", "useCombinedRefs", "useEffect", "propsWithState", "initialize", "PropTypes", "PlaybackTypes", "allMediaTypes", "StreamTypes", "src_default"]
7
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","../../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},"6ed9dc3c705f9e967631479b016db394cac15a29de4d6361664a2e98d1d6dfe7","3359566cd3e1d64199b5cc028817490162edcf5aa7954f35133a462a507cdb48","e19277f843527448cadd35fd674e358d0d2a7f261e9631026ecc82feb85ecec8","8b1a6692156440f6585937b6b8de1c2692e7cac5c43aeb8893bfbd293f719552","16d89c2619e5c73fe784212aa78a4c3f6581d54e5bb566a942dfd4598c974370","51781f2d796522117c57972bfabe36de652182f7bec8b73e026df3659de0481e","ccfb31b493ef5d895c4bc7a48c479d3b863f677094e26ac21ba472371379a924","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"}
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/errors.d.ts","../../playback-core/dist/types/tracks.d.ts","../../playback-core/dist/types/types.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},"6ed9dc3c705f9e967631479b016db394cac15a29de4d6361664a2e98d1d6dfe7","3359566cd3e1d64199b5cc028817490162edcf5aa7954f35133a462a507cdb48","8b1a6692156440f6585937b6b8de1c2692e7cac5c43aeb8893bfbd293f719552","16d89c2619e5c73fe784212aa78a4c3f6581d54e5bb566a942dfd4598c974370","eddb744e6ceaca73233bb140c0afb138e3d353b114d3e68c7a888b43f6be49ad","d1d7fa01f97bdcc4b3af2bb7baf4dc75c4e2314ba360076ee58b47b72cc95cff","1108516b3fea514debfde2afb62587005fface2b8a73401a7c54e8161c9f4c2c","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,44,45,46,50],[43],[43,50]],"referencedMap":[[41,1],[48,2],[42,3],[47,4],[45,5],[46,6],[51,5]],"exportedModulesMap":[[41,1],[48,2],[42,3],[47,4],[45,5],[46,6],[51,5]],"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,47,45,46,49,50,51]},"version":"4.6.4"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mux/mux-audio-react",
3
- "version": "0.4.3",
3
+ "version": "0.5.0-canary.0-a6790e7",
4
4
  "description": "A custom mux audio element for React that Just Works™",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.mjs",
@@ -26,6 +26,7 @@
26
26
  "license": "MIT",
27
27
  "scripts": {
28
28
  "clean": "shx rm -rf dist/",
29
+ "lint": "eslint src/ --ext .js,.jsx,.ts,.tsx",
29
30
  "dev:cjs": "yarn build:cjs --watch=forever",
30
31
  "dev:esm": "yarn build:esm --watch=forever",
31
32
  "dev:types": "yarn build:types -w",
@@ -34,8 +35,7 @@
34
35
  "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
36
  "build:types": "tsc --declaration --emitDeclarationOnly --outDir './dist/types'",
36
37
  "postbuild:types": "downlevel-dts ./dist/types ./dist/types-ts3.4",
37
- "build": "npm-run-all --parallel build:types 'build:cjs -- --minify' 'build:esm -- --minify'",
38
- "prebuild": "yarn clean",
38
+ "build": "npm-run-all --parallel 'build:cjs --minify' 'build:esm --minify'",
39
39
  "create-release-notes": "create-release-notes ./CHANGELOG.md",
40
40
  "publish-release": "../../scripts/publish.sh"
41
41
  },
@@ -53,19 +53,22 @@
53
53
  }
54
54
  },
55
55
  "dependencies": {
56
- "@mux/playback-core": "0.11.0",
56
+ "@mux/mux-elements-codemod": "1.1.4-canary.0-a6790e7",
57
+ "@mux/playback-core": "0.9.1-canary.93-a6790e7",
57
58
  "prop-types": "^15.7.2"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@types/react": "^17.0.37",
61
62
  "@types/react-dom": "^17.0.11",
63
+ "@typescript-eslint/eslint-plugin": "^5.38.1",
64
+ "@typescript-eslint/parser": "^5.38.1",
62
65
  "downlevel-dts": "^0.9.0",
63
66
  "esbuild": "^0.15.7",
67
+ "eslint": "^8.24.0",
64
68
  "npm-run-all": "^4.1.5",
65
69
  "react": "^17.0.2",
66
70
  "react-dom": "^17.0.2",
67
71
  "shx": "^0.3.4",
68
72
  "typescript": "^4.5.2"
69
- },
70
- "gitHead": "807de779d0c22eec622957f02362d122e1dcd686"
73
+ }
71
74
  }
package/LICENSE DELETED
@@ -1,9 +0,0 @@
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.