sanity-plugin-mux-input 2.0.4 → 2.0.6-debug.0
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/lib/_chunks/{Input-4e0aa2ef.js → Input-080b5b98.js} +17 -21
- package/lib/_chunks/Input-080b5b98.js.map +1 -0
- package/lib/_chunks/{Input-7fb0dcd2.js → Input-0c9eb69e.js} +18 -21
- package/lib/_chunks/Input-0c9eb69e.js.map +1 -0
- package/lib/_chunks/{Preview-3e4c2ec9.js → Preview-63d97f42.js} +2 -2
- package/lib/_chunks/{Preview-3e4c2ec9.js.map → Preview-63d97f42.js.map} +1 -1
- package/lib/_chunks/{Preview-e6f7e765.js → Preview-c090d878.js} +2 -2
- package/lib/_chunks/{Preview-e6f7e765.js.map → Preview-c090d878.js.map} +1 -1
- package/lib/_chunks/{VideoSource.styled-70d38762.js → VideoSource.styled-1a8b1b24.js} +2 -2
- package/lib/_chunks/{VideoSource.styled-70d38762.js.map → VideoSource.styled-1a8b1b24.js.map} +1 -1
- package/lib/_chunks/{VideoSource.styled-e880b6e4.js → VideoSource.styled-5aa3e3e6.js} +2 -2
- package/lib/_chunks/{VideoSource.styled-e880b6e4.js.map → VideoSource.styled-5aa3e3e6.js.map} +1 -1
- package/lib/_chunks/{index-adfcd166.js → index-748efd6b.js} +3 -3
- package/lib/_chunks/{index-adfcd166.js.map → index-748efd6b.js.map} +1 -1
- package/lib/_chunks/{index-a9d40189.js → index-e2c54741.js} +3 -3
- package/lib/_chunks/{index-a9d40189.js.map → index-e2c54741.js.map} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +28 -28
- package/src/components/Player.tsx +16 -24
- package/lib/_chunks/Input-4e0aa2ef.js.map +0 -1
- package/lib/_chunks/Input-7fb0dcd2.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-mux-input",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6-debug.0",
|
|
4
4
|
"description": "An input component that integrates Sanity Studio with Mux video encoding/hosting service.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
".": {
|
|
26
26
|
"types": "./lib/index.d.ts",
|
|
27
27
|
"source": "./src/index.ts",
|
|
28
|
-
"import": "./lib/index.esm.js",
|
|
29
28
|
"require": "./lib/index.js",
|
|
29
|
+
"import": "./lib/index.esm.js",
|
|
30
30
|
"default": "./lib/index.esm.js"
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json"
|
|
@@ -56,58 +56,58 @@
|
|
|
56
56
|
"format": "prettier --write --cache --ignore-unknown ."
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@mux/
|
|
60
|
-
"@mux/upchunk": "^3
|
|
59
|
+
"@mux/mux-video-react": "^0.7",
|
|
60
|
+
"@mux/upchunk": "^3",
|
|
61
61
|
"@sanity/icons": "^2",
|
|
62
62
|
"@sanity/incompatible-plugin": "^1",
|
|
63
63
|
"@sanity/ui": "^1",
|
|
64
64
|
"@sanity/uuid": "^3",
|
|
65
65
|
"classnames": "^2.3.2",
|
|
66
66
|
"jsonwebtoken-esm": "^1.0.3",
|
|
67
|
-
"media-chrome": "^0.
|
|
68
|
-
"motion": "^10
|
|
67
|
+
"media-chrome": "^0.17.0",
|
|
68
|
+
"motion": "^10",
|
|
69
69
|
"rxjs": "^7",
|
|
70
|
-
"scroll-into-view-if-needed": "^3
|
|
71
|
-
"suspend-react": "^0.0.
|
|
72
|
-
"swr": "^
|
|
73
|
-
"use-device-pixel-ratio": "^1.1.
|
|
70
|
+
"scroll-into-view-if-needed": "^3",
|
|
71
|
+
"suspend-react": "^0.0.9",
|
|
72
|
+
"swr": "^2.0.0",
|
|
73
|
+
"use-device-pixel-ratio": "^1.1.2",
|
|
74
74
|
"use-error-boundary": "^2.0.6"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@commitlint/cli": "^17.2
|
|
78
|
-
"@commitlint/config-conventional": "^17.2
|
|
79
|
-
"@sanity/pkg-utils": "^2.1
|
|
80
|
-
"@sanity/plugin-kit": "^3.1.
|
|
81
|
-
"@sanity/semantic-release-preset": "^
|
|
82
|
-
"@sanity/vision": "^3.
|
|
77
|
+
"@commitlint/cli": "^17.4.2",
|
|
78
|
+
"@commitlint/config-conventional": "^17.4.2",
|
|
79
|
+
"@sanity/pkg-utils": "^2.2.1",
|
|
80
|
+
"@sanity/plugin-kit": "^3.1.4",
|
|
81
|
+
"@sanity/semantic-release-preset": "^3.0.2",
|
|
82
|
+
"@sanity/vision": "^3.2.3",
|
|
83
83
|
"@types/react": "^18.0.26",
|
|
84
84
|
"@types/styled-components": "^5.1.26",
|
|
85
|
-
"@typescript-eslint/eslint-plugin": "^5.48.
|
|
86
|
-
"@typescript-eslint/parser": "^5.48.
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
|
86
|
+
"@typescript-eslint/parser": "^5.48.1",
|
|
87
87
|
"cz-conventional-changelog": "^3.3.0",
|
|
88
88
|
"eslint": "^8.31.0",
|
|
89
89
|
"eslint-config-prettier": "^8.6.0",
|
|
90
90
|
"eslint-config-react-app": "^7.0.1",
|
|
91
91
|
"eslint-config-sanity": "^6.0.0",
|
|
92
|
-
"eslint-plugin-import": "^2.
|
|
92
|
+
"eslint-plugin-import": "^2.27.4",
|
|
93
93
|
"eslint-plugin-prettier": "^4.2.1",
|
|
94
|
-
"eslint-plugin-react": "^7.
|
|
94
|
+
"eslint-plugin-react": "^7.32.0",
|
|
95
95
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
96
96
|
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
97
|
-
"husky": "^8.0.
|
|
98
|
-
"lint-staged": "^13.0
|
|
99
|
-
"next": "^13.
|
|
100
|
-
"next-sanity": "^
|
|
97
|
+
"husky": "^8.0.3",
|
|
98
|
+
"lint-staged": "^13.1.0",
|
|
99
|
+
"next": "^13.1.2",
|
|
100
|
+
"next-sanity": "^4.0.6",
|
|
101
101
|
"npm-run-all": "^4.1.5",
|
|
102
|
-
"prettier": "^2.8.
|
|
102
|
+
"prettier": "^2.8.3",
|
|
103
103
|
"prettier-plugin-packagejson": "^2.3.0",
|
|
104
104
|
"react": "^18.2.0",
|
|
105
105
|
"react-dom": "^18.2.0",
|
|
106
106
|
"react-is": "^18.2.0",
|
|
107
|
-
"rimraf": "^
|
|
108
|
-
"sanity": "^3.
|
|
107
|
+
"rimraf": "^4.0.4",
|
|
108
|
+
"sanity": "^3.2.3",
|
|
109
109
|
"styled-components": "^5.3.6",
|
|
110
|
-
"type-fest": "^3.
|
|
110
|
+
"type-fest": "^3.5.1",
|
|
111
111
|
"typescript": "^4.9.4"
|
|
112
112
|
},
|
|
113
113
|
"peerDependencies": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import MuxVideo from '@mux/mux-video-react'
|
|
2
2
|
import {Card, Text} from '@sanity/ui'
|
|
3
3
|
import {
|
|
4
4
|
MediaControlBar,
|
|
@@ -35,7 +35,7 @@ interface Props extends Pick<MuxInputProps, 'onChange' | 'readOnly'> {
|
|
|
35
35
|
setDialogState: SetDialogState
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const
|
|
38
|
+
const MuxVideoOld = ({asset, buttons, readOnly, onChange, dialogState, setDialogState}: Props) => {
|
|
39
39
|
const client = useClient()
|
|
40
40
|
const isLoading = useMemo<boolean | string>(() => {
|
|
41
41
|
if (asset?.status === 'preparing') {
|
|
@@ -88,25 +88,6 @@ const MuxVideo = ({asset, buttons, readOnly, onChange, dialogState, setDialogSta
|
|
|
88
88
|
muteRef.current.shadowRoot.appendChild(style.cloneNode(true))
|
|
89
89
|
}
|
|
90
90
|
}, [])
|
|
91
|
-
const [playerInitTime] = useState(() => generatePlayerInitTime())
|
|
92
|
-
const playbackEngineRef = useRef<PlaybackEngine | undefined>(undefined)
|
|
93
|
-
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (isLoading || !videoSrc) {
|
|
96
|
-
return
|
|
97
|
-
}
|
|
98
|
-
const nextPlaybackEngineRef = initialize(
|
|
99
|
-
{
|
|
100
|
-
src: videoSrc,
|
|
101
|
-
playerInitTime,
|
|
102
|
-
playerSoftwareName: 'sanity-plugin-mux-input',
|
|
103
|
-
playerSoftwareVersion: 'dev-preview',
|
|
104
|
-
},
|
|
105
|
-
video.current,
|
|
106
|
-
playbackEngineRef.current
|
|
107
|
-
)
|
|
108
|
-
playbackEngineRef.current = nextPlaybackEngineRef
|
|
109
|
-
}, [videoSrc, isLoading, playerInitTime])
|
|
110
91
|
|
|
111
92
|
useEffect(() => {
|
|
112
93
|
if (asset?.status === 'errored') {
|
|
@@ -117,6 +98,15 @@ const MuxVideo = ({asset, buttons, readOnly, onChange, dialogState, setDialogSta
|
|
|
117
98
|
}
|
|
118
99
|
}, [asset.data?.errors?.messages, asset?.status, handleCancelUpload])
|
|
119
100
|
|
|
101
|
+
const signedToken = useMemo(() => {
|
|
102
|
+
try {
|
|
103
|
+
const url = new URL(videoSrc!)
|
|
104
|
+
return url.searchParams.get('token')
|
|
105
|
+
} catch {
|
|
106
|
+
return false
|
|
107
|
+
}
|
|
108
|
+
}, [videoSrc])
|
|
109
|
+
|
|
120
110
|
if (error) {
|
|
121
111
|
// @TODO better error handling
|
|
122
112
|
throw error
|
|
@@ -141,16 +131,18 @@ const MuxVideo = ({asset, buttons, readOnly, onChange, dialogState, setDialogSta
|
|
|
141
131
|
<>
|
|
142
132
|
<VideoContainer shadow={1} tone="transparent" scheme="dark">
|
|
143
133
|
<MediaController>
|
|
144
|
-
<
|
|
134
|
+
<MuxVideo
|
|
145
135
|
playsInline
|
|
146
136
|
ref={video}
|
|
137
|
+
playbackId={`${asset.playbackId}${signedToken ? `?token=${signedToken}` : ''}`}
|
|
147
138
|
onError={handleError}
|
|
148
139
|
slot="media"
|
|
149
140
|
preload="metadata"
|
|
150
141
|
crossOrigin="anonomous"
|
|
142
|
+
debug
|
|
151
143
|
>
|
|
152
144
|
<ThumbnailsMetadataTrack asset={asset} />
|
|
153
|
-
</
|
|
145
|
+
</MuxVideo>
|
|
154
146
|
<PosterImage asset={asset} />
|
|
155
147
|
<MediaLoadingIndicator slot="centered-chrome" noAutoHide />
|
|
156
148
|
<StyledCenterControls slot="centered-chrome">
|
|
@@ -193,4 +185,4 @@ const MuxVideo = ({asset, buttons, readOnly, onChange, dialogState, setDialogSta
|
|
|
193
185
|
)
|
|
194
186
|
}
|
|
195
187
|
|
|
196
|
-
export default
|
|
188
|
+
export default MuxVideoOld
|