sanity-plugin-mux-input
Version:
An input component that integrates Sanity Studio with Mux video encoding/hosting service.
226 lines (210 loc) • 5.96 kB
TypeScript
import type {PartialDeep} from 'type-fest'
import {Plugin as Plugin_2} from 'sanity'
export declare const defaultConfig: PluginConfig
declare interface MuxAsset {
id: string
/** In seconds (instead of JS's default milliseconds) */
created_at: string
status: 'preparing' | 'ready' | 'errored'
duration: number
max_stored_resolution: 'Audio only' | 'SD' | 'HD' | 'FHD' | 'UHD'
max_stored_frame_rate: -1 | number
aspect_ratio: `${number}:${number}`
playback_ids: MuxPlaybackId[]
tracks: MuxTrack[]
errors?: MuxErrors
upload_id: string
is_live?: boolean
passthrough: string
live_stream_id?: string
master?: {
status: 'ready' | 'preparing' | 'errored'
url: string
}
master_access: 'temporary' | 'none'
mp4_support: 'standard' | 'none'
source_asset_id?: string
normalize_audio?: boolean
static_renditions?: {
status: 'ready' | 'preparing' | 'disabled' | 'errored'
files: {
name: 'low.mp4' | 'medium.mp4' | 'high.mp4' | 'audio.m4a'
ext: 'mp4' | 'm4a'
height: number
width: number
bitrate: number
filesize: number
}[]
}
recording_times?: {
started_at: string
duration: number
type: 'content' | 'slate'
}[]
non_standard_input_reasons?: {
video_codec?: string
audio_codec?: string
video_gop_size?: 'high'
video_frame_rate?: string
video_resolution?: string
video_bitrate?: 'high'
pixel_aspect_ratio?: string
video_edit_list?: 'non-standard'
audio_edit_list?: 'non-standard'
unexpected_media_file_parameters?: 'non-standard'
test?: boolean
}
meta?: {
title?: string
}
}
declare interface MuxAudioTrack {
type: 'audio'
id: string
duration?: number
max_channels: number
max_channel_layout: 'stereo' | string
}
declare interface MuxErrors {
type: string
messages: string[]
}
export declare const muxInput: Plugin_2<void | Partial<PluginConfig>>
declare interface MuxInputConfig {
/**
* Enable static renditions by setting this to 'standard'. Can be overwritten on a per-asset basis.
* Requires `"encoding_tier": "smart"`
* @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions#why-enable-mp4-support}
* @defaultValue 'none'
*/
mp4_support: 'none' | 'standard'
/**
* Max resolution tier can be used to control the maximum resolution_tier your asset is encoded, stored, and streamed at.
* Requires `"encoding_tier": "smart"`
* @see {@link https://docs.mux.com/guides/stream-videos-in-4k}
* @defaultValue '1080p'
*/
max_resolution_tier: '2160p' | '1440p' | '1080p'
/**
* The encoding tier informs the cost, quality, and available platform features for the asset.
* @see {@link https://docs.mux.com/guides/use-encoding-tiers}
* @defaultValue 'smart'
*/
encoding_tier: 'baseline' | 'smart'
/**
* Normalize the audio track loudness level.
* @see {@link https://docs.mux.com/guides/adjust-audio-levels#how-to-turn-on-audio-normalization}
* @defaultValue false
*/
normalize_audio: boolean
/**
* Enables signed URLs by default, if you configured them with your API token.
* @see {@link https://docs.mux.com/guides/secure-video-playback}
* @defaultValue false
*/
defaultSigned?: boolean
/**
* Auto-generate captions for these languages by default.
* Requires `"encoding_tier": "smart"`
*
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
* @deprecated use `defaultAutogeneratedSubtitleLang` instead. Only a single autogenerated
*/
defaultAutogeneratedSubtitleLangs?: SupportedMuxLanguage[]
/**
* Auto-generate captions for this language by default. Users can still
* Requires `"encoding_tier": "smart"`
*
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
*/
defaultAutogeneratedSubtitleLang?: SupportedMuxLanguage
/**
* Whether or not to allow content editors to override asset upload
* configuration settings when uploading a video to Mux.
*
* @see {@link https://docs.mux.com/guides/secure-video-playback}
* @defaultValue false
*/
disableUploadConfig?: boolean
/**
* Whether or not to allow content editors to add text tracks alongside their
* asset when uploading a video to Mux.
*
* @see {@link https://docs.mux.com/guides/secure-video-playback}
* @defaultValue false
*/
disableTextTrackConfig?: boolean
}
declare interface MuxPlaybackId {
id: string
policy: PlaybackPolicy
}
declare type MuxTrack = MuxVideoTrack | MuxAudioTrack
declare interface MuxVideoTrack {
type: 'video'
id: string
max_width: number
max_height: number
max_frame_rate: -1 | number
duration?: number
}
declare type PlaybackPolicy = 'signed' | 'public'
declare interface PluginConfig extends MuxInputConfig {
/**
* How the videos browser should appear as a studio tool in Sanity's top navigation
*
* Pass `false` if you want to disable it.
* @defaultValue {title: 'Videos', icon: VideoIcon}
**/
tool:
| false
| {
title?: string
icon?: React.ComponentType
}
/**
* The roles that are allowed to configure the plugin.
*
* If not set, all roles will be allowed to configure the plugin.
* @defaultValue []
*/
allowedRolesForConfiguration: string[]
}
declare const SUPPORTED_MUX_LANGUAGES_VALUES: (
| 'en'
| 'es'
| 'it'
| 'pt'
| 'de'
| 'fr'
| 'pl'
| 'ru'
| 'nl'
| 'ca'
| 'tr'
| 'sv'
| 'uk'
| 'no'
| 'fi'
| 'sk'
| 'el'
| 'cs'
| 'hr'
| 'da'
| 'ro'
| 'bg'
)[]
declare type SupportedMuxLanguage = (typeof SUPPORTED_MUX_LANGUAGES_VALUES)[number]
export declare interface VideoAssetDocument {
_id: string
_type: 'mux.videoAsset'
_createdAt: string
_updatedAt?: string
status?: string
assetId?: string
playbackId?: string
filename?: string
thumbTime?: number
data?: PartialDeep<MuxAsset>
}
export {}