sanity-plugin-mux-input 2.16.0 → 2.17.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/dist/index.js +866 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +866 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/actions/upload.ts +42 -4
- package/src/components/DraggableWatermark.tsx +877 -0
- package/src/components/UploadConfiguration.tsx +259 -59
- package/src/components/Uploader.tsx +7 -1
- package/src/components/VideoPlayer.tsx +2 -0
- package/src/hooks/useMediaMetadata.ts +3 -0
- package/src/util/convertWatermarkToMux.ts +160 -0
- package/src/util/roundPxString.ts +16 -0
- package/src/util/types.ts +43 -1
package/src/util/types.ts
CHANGED
|
@@ -274,12 +274,52 @@ export function isAutogeneratedTrack(
|
|
|
274
274
|
|
|
275
275
|
export type UploadTextTrack = AutogeneratedTextTrack | CustomTextTrack
|
|
276
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Watermark configuration for UI (draggable position)
|
|
279
|
+
*/
|
|
280
|
+
export interface WatermarkConfig {
|
|
281
|
+
enabled: boolean
|
|
282
|
+
imageUrl?: string
|
|
283
|
+
/**
|
|
284
|
+
* Aspect ratio (width / height) of the watermark image.
|
|
285
|
+
* Used to convert between our center-based UI coords and Mux overlay margins.
|
|
286
|
+
*/
|
|
287
|
+
imageAspectRatio?: number
|
|
288
|
+
/**
|
|
289
|
+
* Optional explicit Mux `overlay_settings`.
|
|
290
|
+
* When set, these values should be used as-is for the upload request and preview.
|
|
291
|
+
* @see {@link https://www.mux.com/docs/guides/add-watermarks-to-your-videos}
|
|
292
|
+
*/
|
|
293
|
+
overlay_settings?: MuxOverlaySettings
|
|
294
|
+
position?: {
|
|
295
|
+
x: number // percentage (0-100)
|
|
296
|
+
y: number // percentage (0-100)
|
|
297
|
+
}
|
|
298
|
+
size?: number // percentage of video width (0-100)
|
|
299
|
+
opacity?: number // 0-1 (converted to percentage string for Mux API)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Mux overlay_settings format for watermark API
|
|
304
|
+
* @see {@link https://www.mux.com/docs/guides/add-watermarks-to-your-videos}
|
|
305
|
+
*/
|
|
306
|
+
export interface MuxOverlaySettings {
|
|
307
|
+
vertical_align: 'top' | 'middle' | 'bottom'
|
|
308
|
+
vertical_margin: string // percentage (e.g., "10%") or pixels (e.g., "40px")
|
|
309
|
+
horizontal_align: 'left' | 'center' | 'right'
|
|
310
|
+
horizontal_margin: string // percentage (e.g., "10%") or pixels (e.g., "40px")
|
|
311
|
+
width?: string // percentage (e.g., "25%") or pixels (e.g., "80px")
|
|
312
|
+
height?: string // percentage or pixels
|
|
313
|
+
opacity?: string // percentage string (e.g., "90%")
|
|
314
|
+
}
|
|
315
|
+
|
|
277
316
|
export interface UploadConfig
|
|
278
317
|
extends Pick<MuxInputConfig, 'max_resolution_tier' | 'normalize_audio' | 'video_quality'> {
|
|
279
318
|
static_renditions: StaticRenditionResolution[]
|
|
280
319
|
text_tracks: UploadTextTrack[]
|
|
281
320
|
signed_policy: boolean
|
|
282
321
|
public_policy: boolean
|
|
322
|
+
watermark?: WatermarkConfig
|
|
283
323
|
drm_policy: boolean
|
|
284
324
|
}
|
|
285
325
|
|
|
@@ -309,7 +349,7 @@ export interface MuxNewAssetSettings
|
|
|
309
349
|
/** The time offset in seconds from the beginning of the video indicating the clip's ending marker. */
|
|
310
350
|
end_time?: number
|
|
311
351
|
/** This parameter is required for text type tracks. */
|
|
312
|
-
type
|
|
352
|
+
type?: 'video' | 'audio' | 'text'
|
|
313
353
|
/** Type of text track. This parameter only supports subtitles value. */
|
|
314
354
|
text_type?: 'subtitles'
|
|
315
355
|
/** The language code value must be a valid BCP 47 specification compliant value. */
|
|
@@ -320,6 +360,8 @@ export interface MuxNewAssetSettings
|
|
|
320
360
|
closed_captions?: boolean
|
|
321
361
|
/** This optional parameter should be used tracks with type of text and text_type set to subtitles. */
|
|
322
362
|
passthrough?: string
|
|
363
|
+
/** Overlay settings for watermarks. Used when adding a watermark image as a second input. */
|
|
364
|
+
overlay_settings?: MuxOverlaySettings
|
|
323
365
|
}[]
|
|
324
366
|
|
|
325
367
|
/** An array of playback policy names that you want applied to this asset and available through playback_ids. */
|