node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

9
server/node_modules/@mux/playback-core/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) 2021 Mux, Inc.
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:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
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.

9
server/node_modules/@mux/playback-core/README.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
# Playback Core
This is a collection of utility functions directly related to the playback and Mux Data integration with various mux elements.
It is currently used by `mux-video`, `mux-video-react`, `mux-audio`, and `mux-audio-react`.
You shouldn't need use this package directly, but if you're building something custom for your application you may find it handy.
Check the `src/index.ts` file to see the functions and types that get exported.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

13
server/node_modules/@mux/playback-core/dist/index.mjs generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { Autoplay, PlaybackEngine, MuxMediaPropsInternal } from './types';
export declare const isAutoplayValue: (value: unknown) => value is Autoplay;
export declare const setupAutoplay: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (newAutoplay?: Autoplay) => void;
export declare const handleAutoplay: (mediaEl: HTMLMediaElement, autoplay: Autoplay) => void;

View File

@@ -0,0 +1,52 @@
export declare const MuxErrorCategory: {
readonly VIDEO: "video";
readonly THUMBNAIL: "thumbnail";
readonly STORYBOARD: "storyboard";
readonly DRM: "drm";
};
export declare const MuxErrorCode: {
readonly NOT_AN_ERROR: 0;
readonly NETWORK_OFFLINE: 2000002;
readonly NETWORK_UNKNOWN_ERROR: 2000000;
readonly NETWORK_NO_STATUS: 2000001;
readonly NETWORK_INVALID_URL: 2400000;
readonly NETWORK_NOT_FOUND: 2404000;
readonly NETWORK_NOT_READY: 2412000;
readonly NETWORK_GENERIC_SERVER_FAIL: 2500000;
readonly NETWORK_TOKEN_MISSING: 2403201;
readonly NETWORK_TOKEN_MALFORMED: 2412202;
readonly NETWORK_TOKEN_EXPIRED: 2403210;
readonly NETWORK_TOKEN_AUD_MISSING: 2403221;
readonly NETWORK_TOKEN_AUD_MISMATCH: 2403222;
readonly NETWORK_TOKEN_SUB_MISMATCH: 2403232;
readonly ENCRYPTED_ERROR: 5000000;
readonly ENCRYPTED_UNSUPPORTED_KEY_SYSTEM: 5000001;
readonly ENCRYPTED_GENERATE_REQUEST_FAILED: 5000002;
readonly ENCRYPTED_UPDATE_LICENSE_FAILED: 5000003;
readonly ENCRYPTED_UPDATE_SERVER_CERT_FAILED: 5000004;
readonly ENCRYPTED_CDM_ERROR: 5000005;
readonly ENCRYPTED_OUTPUT_RESTRICTED: 5000006;
readonly ENCRYPTED_MISSING_TOKEN: 5000002;
};
export type MuxErrorCategory = typeof MuxErrorCategory;
export type MuxErrorCode = typeof MuxErrorCode;
export type MuxErrorCategoryValue = MuxErrorCategory[keyof MuxErrorCategory];
export type MuxErrorCodeValue = MuxErrorCode[keyof MuxErrorCode];
export declare const errorCategoryToTokenNameOrPrefix: (category: MuxErrorCategoryValue) => "thumbnail" | "storyboard" | "drm" | "playback";
export declare class MediaError extends Error {
static MEDIA_ERR_ABORTED: 1;
static MEDIA_ERR_NETWORK: 2;
static MEDIA_ERR_DECODE: 3;
static MEDIA_ERR_SRC_NOT_SUPPORTED: 4;
static MEDIA_ERR_ENCRYPTED: 5;
static MEDIA_ERR_CUSTOM: number;
static defaultMessages: Record<number, string>;
name: string;
code: number;
muxCode?: MuxErrorCodeValue;
errorCategory?: MuxErrorCategoryValue;
context?: string;
fatal: boolean;
data?: any;
constructor(message?: string, code?: number, fatal?: boolean, context?: string);
}

View File

@@ -0,0 +1,4 @@
import Hls from 'hls.js';
import HlsClassType from 'hls.js';
export default Hls;
export type HlsInterface = HlsClassType;

View File

@@ -0,0 +1,94 @@
import { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MuxMediaPropTypes } from './types';
import mux from 'mux-embed';
import Hls from './hls';
import { HlsInterface } from './hls';
import { MediaError, MuxErrorCategory, MuxErrorCode, errorCategoryToTokenNameOrPrefix } from './errors';
import { addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters } from './text-tracks';
import { getStartDate, getCurrentPdt } from './pdt';
import { toPlaybackIdParts, i18n, parseJwt } from './util';
import { StreamTypes, MediaTypes } from './types';
import { HlsConfig } from 'hls.js';
import { MuxJWTAud } from './request-errors';
export { mux, Hls, MediaError, MuxErrorCategory, MuxErrorCode, errorCategoryToTokenNameOrPrefix, MuxJWTAud, addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters, getStartDate, getCurrentPdt, toPlaybackIdParts, i18n, parseJwt, };
export * from './types';
declare const DRMType: {
readonly FAIRPLAY: "fairplay";
readonly PLAYREADY: "playready";
readonly WIDEVINE: "widevine";
};
type DRMTypeValue = (typeof DRMType)[keyof typeof DRMType];
export declare const toDRMTypeFromKeySystem: (keySystem: string) => DRMTypeValue | undefined;
export declare const getMediaPlaylistLinesFromMultivariantPlaylistSrc: (src: string) => Promise<string[]>;
export declare const getStreamInfoFromPlaylistLines: (playlistLines: string[]) => {
streamType: "on-demand" | "live";
targetLiveWindow: number;
liveEdgeStartOffset: number | undefined;
};
export declare const getStreamInfoFromSrcAndType: (src: string, type?: MediaTypes | "") => Promise<{
streamType: "on-demand" | "live";
targetLiveWindow: number;
liveEdgeStartOffset: number | undefined;
} | {
streamType: undefined;
targetLiveWindow: undefined;
liveEdgeStartOffset: undefined;
}>;
export declare const updateStreamInfoFromSrc: (src: string, mediaEl: HTMLMediaElement, type?: MediaTypes | "") => Promise<void>;
export declare const getStreamInfoFromHlsjsLevelDetails: (levelDetails: any) => {
streamType: "on-demand" | "live";
targetLiveWindow: number;
liveEdgeStartOffset: number | undefined;
lowLatency: boolean;
};
export declare const updateStreamInfoFromHlsjsLevelDetails: (levelDetails: any, mediaEl: HTMLMediaElement, hls: Pick<Hls, "config" | "userConfig" | "liveSyncPosition">) => void;
declare global {
interface NavigatorUAData {
platform: string;
mobile: boolean;
brands: Array<{
brand: string;
version: string;
}>;
}
interface Navigator {
userAgentData?: NavigatorUAData;
}
}
export declare const muxMediaState: WeakMap<HTMLMediaElement, Partial<MuxMediaProps> & {
seekable?: TimeRanges;
liveEdgeStartOffset?: number;
}>;
export declare const generatePlayerInitTime: () => number;
export declare const generateUUID: () => string;
type MuxVideoURLProps = Partial<Pick<MuxMediaPropTypes, 'playbackId' | 'customDomain' | 'maxResolution' | 'minResolution' | 'renditionOrder' | 'programStartTime' | 'programEndTime' | 'assetStartTime' | 'assetEndTime' | 'tokens' | 'playbackToken' | 'extraSourceParams'>>;
export declare const toMuxVideoURL: ({ playbackId: playbackIdWithParams, customDomain: domain, maxResolution, minResolution, renditionOrder, programStartTime, programEndTime, assetStartTime, assetEndTime, playbackToken, tokens: { playback: token }, extraSourceParams, }?: MuxVideoURLProps) => string | undefined;
export declare const toPlaybackIdFromSrc: (src: string | undefined) => string | undefined;
export declare const getError: (mediaEl: HTMLMediaElement) => globalThis.MediaError | (globalThis.MediaError & MediaError) | null | undefined;
export declare const getStreamType: (mediaEl: HTMLMediaElement) => ValueOf<StreamTypes>;
export declare const getTargetLiveWindow: (mediaEl: HTMLMediaElement) => number;
export declare const getSeekable: (mediaEl: HTMLMediaElement) => TimeRanges;
export declare const getLiveEdgeStart: (mediaEl: HTMLMediaElement) => number;
export declare const isPseudoEnded: (mediaEl: HTMLMediaElement, moe?: number) => boolean;
export declare const isStuckOnLastFragment: (mediaEl: HTMLMediaElement, hls?: Pick<Hls,
/** Should we add audio fragments logic here, too? (CJP) */
"levels" | "currentLevel">) => boolean | undefined;
export declare const getEnded: (mediaEl: HTMLMediaElement, hls?: Pick<Hls,
/** Should we add audio fragments logic here, too? (CJP) */
"levels" | "currentLevel">) => boolean;
export declare const initialize: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, core?: PlaybackCore) => {
engine: Hls | undefined;
setAutoplay: (newAutoplay?: import("./types").Autoplay) => void;
setPreload: (val?: HTMLMediaElement["preload"]) => void;
};
export declare const teardown: (mediaEl?: HTMLMediaElement | null, core?: PlaybackCore) => void;
export declare const setupHls: (props: Partial<Pick<MuxMediaPropsInternal, "debug" | "streamType" | "type" | "startTime" | "metadata" | "preferCmcd" | "_hlsConfig" | "tokens" | "drmTypeCb">>, mediaEl: Pick<HTMLMediaElement, "canPlayType">) => Hls | undefined;
export declare const getStreamTypeConfig: (streamType?: ValueOf<StreamTypes>) => {};
export declare const getDRMConfig: (props: Partial<Pick<MuxMediaPropsInternal, "src" | "playbackId" | "tokens" | "customDomain" | "drmTypeCb">>) => Partial<HlsConfig>;
export declare const getAppCertificate: (appCertificateUrl: string) => Promise<ArrayBuffer>;
export declare const getLicenseKey: (message: ArrayBuffer, licenseServerUrl: string) => Promise<Uint8Array>;
export declare const setupNativeFairplayDRM: (props: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "playbackToken" | "customDomain" | "drmTypeCb">>, mediaEl: HTMLMediaElement) => void;
export declare const toLicenseKeyURL: ({ playbackId: playbackIdWithParams, tokens: { drm: token }, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const toAppCertURL: ({ playbackId: playbackIdWithParams, tokens: { drm: token }, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const isMuxVideoSrc: ({ playbackId, src, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "src" | "customDomain">>) => boolean;
export declare const setupMux: (props: Partial<Pick<MuxMediaPropsInternal, "envKey" | "playerInitTime" | "beaconCollectionDomain" | "errorTranslator" | "metadata" | "debug" | "playerSoftwareName" | "playerSoftwareVersion" | "playbackId" | "src" | "customDomain" | "disableCookies" | "disableTracking">>, mediaEl: HTMLMediaElement, hlsjs?: HlsInterface) => void;
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, "preferPlayback" | "src" | "type" | "startTime" | "streamType" | "autoplay" | "playbackId" | "tokens" | "customDomain">>, mediaEl: HTMLMediaElement, hls?: Pick<Hls, "config" | "on" | "once" | "off" | "trigger" | "startLoad" | "stopLoad" | "recoverMediaError" | "destroy" | "loadSource" | "attachMedia" | "liveSyncPosition" | "subtitleTracks" | "subtitleTrack" | "userConfig" | "audioTrack" | "audioTracks" | "autoLevelEnabled" | "nextLevel" | "levels" | "currentLevel">) => void;

View File

@@ -0,0 +1,7 @@
declare module 'media-chrome' {
export class MediaTheme extends HTMLElement {
}
export class MediaController extends HTMLElement {
media: HTMLVideoElement;
}
}

View File

@@ -0,0 +1,2 @@
import Hls from './hls';
export declare function setupMediaTracks(customMediaEl: HTMLMediaElement, hls: Pick<Hls, 'audioTrack' | 'audioTracks' | 'autoLevelEnabled' | 'nextLevel' | 'levels' | 'on' | 'once' | 'off' | 'trigger'>): void;

View File

@@ -0,0 +1,7 @@
import { PlaybackEngine } from './types';
type MediaWithPDT = HTMLMediaElement & {
getStartDate?: () => Date;
};
export declare function getStartDate(mediaEl: MediaWithPDT, hls: PlaybackEngine | undefined): Date;
export declare function getCurrentPdt(mediaEl: MediaWithPDT, hls: PlaybackEngine | undefined): Date;
export {};

View File

@@ -0,0 +1,2 @@
import { PlaybackEngine } from './types';
export declare const setupPreload: ({ preload, src }: Partial<HTMLMediaElement>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (val?: HTMLMediaElement["preload"]) => void;

View File

@@ -0,0 +1,13 @@
import { LoaderResponse } from 'hls.js';
import { MuxMediaPropsInternal } from './types';
import { MuxErrorCategoryValue } from './errors';
import { MediaError } from './errors';
export declare const MuxJWTAud: {
readonly VIDEO: "v";
readonly THUMBNAIL: "t";
readonly STORYBOARD: "s";
readonly DRM: "d";
};
export declare const categoryToAud: (category: MuxErrorCategoryValue) => "d" | "v" | undefined;
export declare const categoryToToken: (category: MuxErrorCategoryValue, muxMediaEl: Partial<Pick<MuxMediaPropsInternal, "drmToken" | "playbackToken" | "tokens">>) => string | undefined;
export declare const getErrorFromResponse: (resp: Pick<Response, "status" | "url"> | Pick<LoaderResponse, "code" | "url">, category: MuxErrorCategoryValue, muxMediaEl: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "drmToken" | "playbackToken" | "tokens">>, translate?: boolean, offline?: boolean) => MediaError | undefined;

View File

@@ -0,0 +1,35 @@
import Hls from './hls';
import { CuePoint, Chapter } from './types';
type Config = {
label: string;
};
export declare function setupTextTracks(mediaEl: HTMLMediaElement, hls: Pick<Hls, 'on' | 'once' | 'subtitleTracks' | 'subtitleTrack'>): void;
export declare function addTextTrack(mediaEl: HTMLMediaElement, kind: TextTrackKind, label: string, lang?: string, id?: string, defaultTrack?: boolean): TextTrack;
export declare function removeTextTrack(mediaEl: HTMLMediaElement, track: TextTrack): void;
export declare function getTextTrack(mediaEl: HTMLMediaElement, label: string, kind: TextTrackKind): TextTrack | undefined;
export declare function addCuesToTextTrack<T = any>(mediaEl: HTMLMediaElement, cues: CuePoint<T>[] | Chapter[], label: string, kind: TextTrackKind): Promise<TextTrack>;
export declare const DefaultCuePointsConfig: Config;
export declare function addCuePoints<T>(mediaEl: HTMLMediaElement, cuePoints: CuePoint<T>[], cuePointsConfig?: Config): Promise<TextTrack>;
export declare function getCuePoints(mediaEl: HTMLMediaElement, cuePointsConfig?: Config): {
time: number;
value: any;
}[];
export declare function getActiveCuePoint(mediaEl: HTMLMediaElement, cuePointsConfig?: Config): {
time: number;
value: any;
} | undefined;
export declare function setupCuePoints(mediaEl: HTMLMediaElement, cuePointsConfig?: Config): Promise<unknown>;
export declare const DefaultChaptersConfig: Config;
export declare function addChapters(mediaEl: HTMLMediaElement, chapters: Chapter[], chaptersConfig?: Config): Promise<TextTrack>;
export declare function getChapters(mediaEl: HTMLMediaElement, chaptersConfig?: Config): {
startTime: number;
endTime: number;
value: string;
}[];
export declare function getActiveChapter(mediaEl: HTMLMediaElement, chaptersConfig?: Config): {
startTime: number;
endTime: number;
value: string;
} | undefined;
export declare function setupChapters(mediaEl: HTMLMediaElement, chaptersConfig?: Config): Promise<unknown>;
export {};

View File

@@ -0,0 +1,134 @@
/// <reference path="../../../../node_modules/mux-embed/dist/types/mux-embed.d.ts" preserve="true" />
import { Options } from 'mux-embed';
import { MediaError } from './errors';
import { HlsConfig } from 'hls.js';
import Hls from 'hls.js';
type KeyTypes = string | number | symbol;
type Maybe<T> = T | null | undefined;
export declare const isKeyOf: <T extends {} = any>(k: KeyTypes, o: Maybe<T>) => k is keyof T;
export type ValueOf<T> = T[keyof T];
export type Metadata = Partial<Required<Options>['data']>;
type MetaData = Metadata;
export type PlaybackEngine = Hls;
export type PlaybackCore = {
engine?: PlaybackEngine;
setAutoplay: (autoplay?: Autoplay) => void;
setPreload: (preload?: HTMLMediaElement['preload']) => void;
};
export type AutoplayTypes = {
ANY: 'any';
MUTED: 'muted';
};
export declare const AutoplayTypes: AutoplayTypes;
export type Autoplay = boolean | ValueOf<AutoplayTypes>;
export type HlsPlaylistTypes = 'VOD' | 'EVENT' | null | undefined;
export type StreamTypes = {
ON_DEMAND: 'on-demand';
LIVE: 'live';
UNKNOWN: 'unknown';
};
export declare const StreamTypes: StreamTypes;
export type PlaybackTypes = {
MSE: 'mse';
NATIVE: 'native';
};
export declare const PlaybackTypes: PlaybackTypes;
export type CmcdTypes = {
HEADER: 'header';
QUERY: 'query';
NONE: 'none';
};
export declare const CmcdTypes: CmcdTypes;
export declare const CmcdTypeValues: ("none" | "header" | "query")[];
export type ExtensionMimeTypeMap = {
M3U8: 'application/vnd.apple.mpegurl';
MP4: 'video/mp4';
};
export declare const ExtensionMimeTypeMap: ExtensionMimeTypeMap;
export type MimeTypeShorthandMap = {
HLS: ExtensionMimeTypeMap['M3U8'];
};
export declare const MimeTypeShorthandMap: MimeTypeShorthandMap;
export declare const shorthandKeys: string[];
export type MediaTypes = ValueOf<ExtensionMimeTypeMap> | keyof MimeTypeShorthandMap
/** @TODO Figure out a way to "downgrade" derived types below to early TS syntax (e.g. 3.4) instead of explicit versions here (CJP) */
| 'hls';
export declare const allMediaTypes: MediaTypes[];
type CueLike<T = any> = {
startTime: number;
endTime?: number;
value: T;
};
export type CuePoint<T = any> = CueLike<T> | {
time: number;
value: T;
};
export type Chapter = CueLike<string>;
export declare const MaxResolution: {
readonly upTo720p: "720p";
readonly upTo1080p: "1080p";
readonly upTo1440p: "1440p";
readonly upTo2160p: "2160p";
};
export declare const MinResolution: {
readonly noLessThan480p: "480p";
readonly noLessThan540p: "540p";
readonly noLessThan720p: "720p";
readonly noLessThan1080p: "1080p";
readonly noLessThan1440p: "1440p";
readonly noLessThan2160p: "2160p";
};
export declare const RenditionOrder: {
readonly DESCENDING: "desc";
};
export type MaxResolutionValue = ValueOf<typeof MaxResolution>;
export type MinResolutionValue = ValueOf<typeof MinResolution>;
export type RenditionOrderValue = ValueOf<typeof RenditionOrder>;
export type Tokens = {
playback?: string;
drm?: string;
thumbnail?: string;
storyboard?: string;
};
export type MuxMediaPropTypes = {
_hlsConfig?: Partial<HlsConfig>;
autoPlay?: Autoplay;
autoplay?: Autoplay;
beaconCollectionDomain: Options['beaconCollectionDomain'];
customDomain: string;
debug: Options['debug'] & Hls['config']['debug'];
disableCookies: Options['disableCookies'];
disableTracking: boolean;
drmToken?: string;
playbackToken?: string;
envKey: MetaData['env_key'];
error?: HTMLMediaElement['error'] | MediaError;
errorTranslator: Options['errorTranslator'];
liveEdgeStart: number;
maxResolution: MaxResolutionValue;
metadata: Partial<Options['data']>;
minResolution: MinResolutionValue;
playbackId: string;
playerInitTime: MetaData['player_init_time'];
preferCmcd: ValueOf<CmcdTypes> | undefined;
preferPlayback: ValueOf<PlaybackTypes> | undefined;
programStartTime: number;
programEndTime: number;
assetStartTime: number;
assetEndTime: number;
renditionOrder: RenditionOrderValue;
startTime: Hls['config']['startPosition'];
streamType: ValueOf<StreamTypes>;
targetLiveWindow: number;
tokens: Tokens;
type: MediaTypes;
extraSourceParams: Record<string, any>;
};
export type HTMLMediaElementProps = Partial<Pick<HTMLMediaElement, 'src' | 'preload' | 'error' | 'seekable'>>;
export type MuxMediaProps = HTMLMediaElementProps & MuxMediaPropTypes;
export type MuxMediaPropsInternal = MuxMediaProps & {
playerSoftwareName: MetaData['player_software_name'];
playerSoftwareVersion: MetaData['player_software_version'];
drmTypeCb?: (drmType: Metadata['view_drm_type']) => void;
};
export {};

View File

@@ -0,0 +1,24 @@
import { HlsPlaylistTypes, MuxMediaProps } from './types';
type addEventListenerWithTeardown = <K extends keyof HTMLMediaElementEventMap, T extends EventTarget = HTMLMediaElement>(mediaEl: HTMLMediaElement, type: K, listener: (this: T, ev: HTMLMediaElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions, target?: T | HTMLMediaElement) => void;
export declare const addEventListenerWithTeardown: addEventListenerWithTeardown;
export declare function inSeekableRange(seekable: TimeRanges, duration: number, time: number): boolean;
export declare const toPlaybackIdParts: (playbackIdWithOptionalParams: string) => [
string,
string?
];
export declare const getType: (props: Partial<Pick<MuxMediaProps, "type" | "src">>) => "" | import("./types").MediaTypes;
export declare const toStreamTypeFromPlaylistType: (playlistType: HlsPlaylistTypes) => "on-demand" | "live";
export declare const toTargetLiveWindowFromPlaylistType: (playlistType: HlsPlaylistTypes) => number;
export declare const inferMimeTypeFromURL: (url: string) => "" | "application/vnd.apple.mpegurl" | "video/mp4";
export type MuxJWT = {
sub: string;
aud: 'v' | 't' | 'g' | 's' | 'd';
exp: number;
};
export declare const parseJwt: (token: string | undefined) => Partial<MuxJWT> | undefined;
export declare const isJWTExpired: ({ exp }: Partial<Pick<MuxJWT, "exp">>, referenceTime?: number) => boolean;
export declare const isJWTSubMismatch: ({ sub }: Partial<Pick<MuxJWT, "sub">>, expectedSub: string | undefined) => boolean;
export declare const isJWTAudMissing: ({ aud }: Partial<Pick<MuxJWT, "aud">>, _expectedAud: string | undefined) => boolean;
export declare const isJWTAudMismatch: ({ aud }: Partial<Pick<MuxJWT, "aud">>, expectedAud: string | undefined) => boolean;
export declare function i18n(str: string, translate?: boolean): any;
export {};

View File

@@ -0,0 +1,4 @@
import { Autoplay, PlaybackEngine, MuxMediaPropsInternal } from './types';
export declare const isAutoplayValue: (value: unknown) => value is Autoplay;
export declare const setupAutoplay: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (newAutoplay?: Autoplay) => void;
export declare const handleAutoplay: (mediaEl: HTMLMediaElement, autoplay: Autoplay) => void;

View File

@@ -0,0 +1,52 @@
export declare const MuxErrorCategory: {
readonly VIDEO: "video";
readonly THUMBNAIL: "thumbnail";
readonly STORYBOARD: "storyboard";
readonly DRM: "drm";
};
export declare const MuxErrorCode: {
readonly NOT_AN_ERROR: 0;
readonly NETWORK_OFFLINE: 2000002;
readonly NETWORK_UNKNOWN_ERROR: 2000000;
readonly NETWORK_NO_STATUS: 2000001;
readonly NETWORK_INVALID_URL: 2400000;
readonly NETWORK_NOT_FOUND: 2404000;
readonly NETWORK_NOT_READY: 2412000;
readonly NETWORK_GENERIC_SERVER_FAIL: 2500000;
readonly NETWORK_TOKEN_MISSING: 2403201;
readonly NETWORK_TOKEN_MALFORMED: 2412202;
readonly NETWORK_TOKEN_EXPIRED: 2403210;
readonly NETWORK_TOKEN_AUD_MISSING: 2403221;
readonly NETWORK_TOKEN_AUD_MISMATCH: 2403222;
readonly NETWORK_TOKEN_SUB_MISMATCH: 2403232;
readonly ENCRYPTED_ERROR: 5000000;
readonly ENCRYPTED_UNSUPPORTED_KEY_SYSTEM: 5000001;
readonly ENCRYPTED_GENERATE_REQUEST_FAILED: 5000002;
readonly ENCRYPTED_UPDATE_LICENSE_FAILED: 5000003;
readonly ENCRYPTED_UPDATE_SERVER_CERT_FAILED: 5000004;
readonly ENCRYPTED_CDM_ERROR: 5000005;
readonly ENCRYPTED_OUTPUT_RESTRICTED: 5000006;
readonly ENCRYPTED_MISSING_TOKEN: 5000002;
};
export type MuxErrorCategory = typeof MuxErrorCategory;
export type MuxErrorCode = typeof MuxErrorCode;
export type MuxErrorCategoryValue = MuxErrorCategory[keyof MuxErrorCategory];
export type MuxErrorCodeValue = MuxErrorCode[keyof MuxErrorCode];
export declare const errorCategoryToTokenNameOrPrefix: (category: MuxErrorCategoryValue) => "thumbnail" | "storyboard" | "drm" | "playback";
export declare class MediaError extends Error {
static MEDIA_ERR_ABORTED: 1;
static MEDIA_ERR_NETWORK: 2;
static MEDIA_ERR_DECODE: 3;
static MEDIA_ERR_SRC_NOT_SUPPORTED: 4;
static MEDIA_ERR_ENCRYPTED: 5;
static MEDIA_ERR_CUSTOM: number;
static defaultMessages: Record<number, string>;
name: string;
code: number;
muxCode?: MuxErrorCodeValue;
errorCategory?: MuxErrorCategoryValue;
context?: string;
fatal: boolean;
data?: any;
constructor(message?: string, code?: number, fatal?: boolean, context?: string);
}

View File

@@ -0,0 +1,4 @@
import Hls from 'hls.js';
import type HlsClassType from 'hls.js';
export default Hls;
export type HlsInterface = HlsClassType;

View File

@@ -0,0 +1,94 @@
import type { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MuxMediaPropTypes } from './types';
import mux from 'mux-embed';
import Hls from './hls';
import type { HlsInterface } from './hls';
import { MediaError, MuxErrorCategory, MuxErrorCode, errorCategoryToTokenNameOrPrefix } from './errors';
import { addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters } from './text-tracks';
import { getStartDate, getCurrentPdt } from './pdt';
import { toPlaybackIdParts, i18n, parseJwt } from './util';
import { StreamTypes, MediaTypes } from './types';
import { type HlsConfig } from 'hls.js';
import { MuxJWTAud } from './request-errors';
export { mux, Hls, MediaError, MuxErrorCategory, MuxErrorCode, errorCategoryToTokenNameOrPrefix, MuxJWTAud, addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters, getStartDate, getCurrentPdt, toPlaybackIdParts, i18n, parseJwt, };
export * from './types';
declare const DRMType: {
readonly FAIRPLAY: "fairplay";
readonly PLAYREADY: "playready";
readonly WIDEVINE: "widevine";
};
type DRMTypeValue = (typeof DRMType)[keyof typeof DRMType];
export declare const toDRMTypeFromKeySystem: (keySystem: string) => DRMTypeValue | undefined;
export declare const getMediaPlaylistLinesFromMultivariantPlaylistSrc: (src: string) => Promise<string[]>;
export declare const getStreamInfoFromPlaylistLines: (playlistLines: string[]) => {
streamType: "on-demand" | "live";
targetLiveWindow: number;
liveEdgeStartOffset: number | undefined;
};
export declare const getStreamInfoFromSrcAndType: (src: string, type?: MediaTypes | "") => Promise<{
streamType: "on-demand" | "live";
targetLiveWindow: number;
liveEdgeStartOffset: number | undefined;
} | {
streamType: undefined;
targetLiveWindow: undefined;
liveEdgeStartOffset: undefined;
}>;
export declare const updateStreamInfoFromSrc: (src: string, mediaEl: HTMLMediaElement, type?: MediaTypes | "") => Promise<void>;
export declare const getStreamInfoFromHlsjsLevelDetails: (levelDetails: any) => {
streamType: "on-demand" | "live";
targetLiveWindow: number;
liveEdgeStartOffset: number | undefined;
lowLatency: boolean;
};
export declare const updateStreamInfoFromHlsjsLevelDetails: (levelDetails: any, mediaEl: HTMLMediaElement, hls: Pick<Hls, "config" | "userConfig" | "liveSyncPosition">) => void;
declare global {
interface NavigatorUAData {
platform: string;
mobile: boolean;
brands: Array<{
brand: string;
version: string;
}>;
}
interface Navigator {
userAgentData?: NavigatorUAData;
}
}
export declare const muxMediaState: WeakMap<HTMLMediaElement, Partial<MuxMediaProps> & {
seekable?: TimeRanges;
liveEdgeStartOffset?: number;
}>;
export declare const generatePlayerInitTime: () => number;
export declare const generateUUID: () => string;
type MuxVideoURLProps = Partial<Pick<MuxMediaPropTypes, 'playbackId' | 'customDomain' | 'maxResolution' | 'minResolution' | 'renditionOrder' | 'programStartTime' | 'programEndTime' | 'assetStartTime' | 'assetEndTime' | 'tokens' | 'playbackToken' | 'extraSourceParams'>>;
export declare const toMuxVideoURL: ({ playbackId: playbackIdWithParams, customDomain: domain, maxResolution, minResolution, renditionOrder, programStartTime, programEndTime, assetStartTime, assetEndTime, playbackToken, tokens: { playback: token }, extraSourceParams, }?: MuxVideoURLProps) => string | undefined;
export declare const toPlaybackIdFromSrc: (src: string | undefined) => string | undefined;
export declare const getError: (mediaEl: HTMLMediaElement) => globalThis.MediaError | (globalThis.MediaError & MediaError) | null | undefined;
export declare const getStreamType: (mediaEl: HTMLMediaElement) => ValueOf<StreamTypes>;
export declare const getTargetLiveWindow: (mediaEl: HTMLMediaElement) => number;
export declare const getSeekable: (mediaEl: HTMLMediaElement) => TimeRanges;
export declare const getLiveEdgeStart: (mediaEl: HTMLMediaElement) => number;
export declare const isPseudoEnded: (mediaEl: HTMLMediaElement, moe?: number) => boolean;
export declare const isStuckOnLastFragment: (mediaEl: HTMLMediaElement, hls?: Pick<Hls,
/** Should we add audio fragments logic here, too? (CJP) */
"levels" | "currentLevel">) => boolean | undefined;
export declare const getEnded: (mediaEl: HTMLMediaElement, hls?: Pick<Hls,
/** Should we add audio fragments logic here, too? (CJP) */
"levels" | "currentLevel">) => boolean;
export declare const initialize: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, core?: PlaybackCore) => {
engine: Hls | undefined;
setAutoplay: (newAutoplay?: import("./types").Autoplay) => void;
setPreload: (val?: HTMLMediaElement["preload"]) => void;
};
export declare const teardown: (mediaEl?: HTMLMediaElement | null, core?: PlaybackCore) => void;
export declare const setupHls: (props: Partial<Pick<MuxMediaPropsInternal, "debug" | "streamType" | "type" | "startTime" | "metadata" | "preferCmcd" | "_hlsConfig" | "tokens" | "drmTypeCb">>, mediaEl: Pick<HTMLMediaElement, "canPlayType">) => Hls | undefined;
export declare const getStreamTypeConfig: (streamType?: ValueOf<StreamTypes>) => {};
export declare const getDRMConfig: (props: Partial<Pick<MuxMediaPropsInternal, "src" | "playbackId" | "tokens" | "customDomain" | "drmTypeCb">>) => Partial<HlsConfig>;
export declare const getAppCertificate: (appCertificateUrl: string) => Promise<ArrayBuffer>;
export declare const getLicenseKey: (message: ArrayBuffer, licenseServerUrl: string) => Promise<Uint8Array>;
export declare const setupNativeFairplayDRM: (props: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "playbackToken" | "customDomain" | "drmTypeCb">>, mediaEl: HTMLMediaElement) => void;
export declare const toLicenseKeyURL: ({ playbackId: playbackIdWithParams, tokens: { drm: token }, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const toAppCertURL: ({ playbackId: playbackIdWithParams, tokens: { drm: token }, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const isMuxVideoSrc: ({ playbackId, src, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "src" | "customDomain">>) => boolean;
export declare const setupMux: (props: Partial<Pick<MuxMediaPropsInternal, "envKey" | "playerInitTime" | "beaconCollectionDomain" | "errorTranslator" | "metadata" | "debug" | "playerSoftwareName" | "playerSoftwareVersion" | "playbackId" | "src" | "customDomain" | "disableCookies" | "disableTracking">>, mediaEl: HTMLMediaElement, hlsjs?: HlsInterface) => void;
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, "preferPlayback" | "src" | "type" | "startTime" | "streamType" | "autoplay" | "playbackId" | "tokens" | "customDomain">>, mediaEl: HTMLMediaElement, hls?: Pick<Hls, "config" | "on" | "once" | "off" | "trigger" | "startLoad" | "stopLoad" | "recoverMediaError" | "destroy" | "loadSource" | "attachMedia" | "liveSyncPosition" | "subtitleTracks" | "subtitleTrack" | "userConfig" | "audioTrack" | "audioTracks" | "autoLevelEnabled" | "nextLevel" | "levels" | "currentLevel">) => void;

View File

@@ -0,0 +1,6 @@
declare module 'media-chrome' {
export class MediaTheme extends HTMLElement {}
export class MediaController extends HTMLElement {
media: HTMLVideoElement;
}
}

View File

@@ -0,0 +1,2 @@
import Hls from './hls';
export declare function setupMediaTracks(customMediaEl: HTMLMediaElement, hls: Pick<Hls, 'audioTrack' | 'audioTracks' | 'autoLevelEnabled' | 'nextLevel' | 'levels' | 'on' | 'once' | 'off' | 'trigger'>): void;

View File

@@ -0,0 +1,7 @@
import { PlaybackEngine } from './types';
type MediaWithPDT = HTMLMediaElement & {
getStartDate?: () => Date;
};
export declare function getStartDate(mediaEl: MediaWithPDT, hls: PlaybackEngine | undefined): Date;
export declare function getCurrentPdt(mediaEl: MediaWithPDT, hls: PlaybackEngine | undefined): Date;
export {};

View File

@@ -0,0 +1,2 @@
import { PlaybackEngine } from './types';
export declare const setupPreload: ({ preload, src }: Partial<HTMLMediaElement>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (val?: HTMLMediaElement["preload"]) => void;

View File

@@ -0,0 +1,13 @@
import type { LoaderResponse } from 'hls.js';
import { MuxMediaPropsInternal } from './types';
import type { MuxErrorCategoryValue } from './errors';
import { MediaError } from './errors';
export declare const MuxJWTAud: {
readonly VIDEO: "v";
readonly THUMBNAIL: "t";
readonly STORYBOARD: "s";
readonly DRM: "d";
};
export declare const categoryToAud: (category: MuxErrorCategoryValue) => "d" | "v" | undefined;
export declare const categoryToToken: (category: MuxErrorCategoryValue, muxMediaEl: Partial<Pick<MuxMediaPropsInternal, "drmToken" | "playbackToken" | "tokens">>) => string | undefined;
export declare const getErrorFromResponse: (resp: Pick<Response, "status" | "url"> | Pick<LoaderResponse, "code" | "url">, category: MuxErrorCategoryValue, muxMediaEl: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "drmToken" | "playbackToken" | "tokens">>, translate?: boolean, offline?: boolean) => MediaError | undefined;

View File

@@ -0,0 +1,35 @@
import Hls from './hls';
import { CuePoint, Chapter } from './types';
type Config = {
label: string;
};
export declare function setupTextTracks(mediaEl: HTMLMediaElement, hls: Pick<Hls, 'on' | 'once' | 'subtitleTracks' | 'subtitleTrack'>): void;
export declare function addTextTrack(mediaEl: HTMLMediaElement, kind: TextTrackKind, label: string, lang?: string, id?: string, defaultTrack?: boolean): TextTrack;
export declare function removeTextTrack(mediaEl: HTMLMediaElement, track: TextTrack): void;
export declare function getTextTrack(mediaEl: HTMLMediaElement, label: string, kind: TextTrackKind): TextTrack | undefined;
export declare function addCuesToTextTrack<T = any>(mediaEl: HTMLMediaElement, cues: CuePoint<T>[] | Chapter[], label: string, kind: TextTrackKind): Promise<TextTrack>;
export declare const DefaultCuePointsConfig: Config;
export declare function addCuePoints<T>(mediaEl: HTMLMediaElement, cuePoints: CuePoint<T>[], cuePointsConfig?: Config): Promise<TextTrack>;
export declare function getCuePoints(mediaEl: HTMLMediaElement, cuePointsConfig?: Config): {
time: number;
value: any;
}[];
export declare function getActiveCuePoint(mediaEl: HTMLMediaElement, cuePointsConfig?: Config): {
time: number;
value: any;
} | undefined;
export declare function setupCuePoints(mediaEl: HTMLMediaElement, cuePointsConfig?: Config): Promise<unknown>;
export declare const DefaultChaptersConfig: Config;
export declare function addChapters(mediaEl: HTMLMediaElement, chapters: Chapter[], chaptersConfig?: Config): Promise<TextTrack>;
export declare function getChapters(mediaEl: HTMLMediaElement, chaptersConfig?: Config): {
startTime: number;
endTime: number;
value: string;
}[];
export declare function getActiveChapter(mediaEl: HTMLMediaElement, chaptersConfig?: Config): {
startTime: number;
endTime: number;
value: string;
} | undefined;
export declare function setupChapters(mediaEl: HTMLMediaElement, chaptersConfig?: Config): Promise<unknown>;
export {};

View File

@@ -0,0 +1,134 @@
/// <reference path="../../../../node_modules/mux-embed/dist/types/mux-embed.d.ts" preserve="true" />
import type { Options } from 'mux-embed';
import type { MediaError } from './errors';
import type { HlsConfig } from 'hls.js';
import type Hls from 'hls.js';
type KeyTypes = string | number | symbol;
type Maybe<T> = T | null | undefined;
export declare const isKeyOf: <T extends {} = any>(k: KeyTypes, o: Maybe<T>) => k is keyof T;
export type ValueOf<T> = T[keyof T];
export type Metadata = Partial<Required<Options>['data']>;
type MetaData = Metadata;
export type PlaybackEngine = Hls;
export type PlaybackCore = {
engine?: PlaybackEngine;
setAutoplay: (autoplay?: Autoplay) => void;
setPreload: (preload?: HTMLMediaElement['preload']) => void;
};
export type AutoplayTypes = {
ANY: 'any';
MUTED: 'muted';
};
export declare const AutoplayTypes: AutoplayTypes;
export type Autoplay = boolean | ValueOf<AutoplayTypes>;
export type HlsPlaylistTypes = 'VOD' | 'EVENT' | null | undefined;
export type StreamTypes = {
ON_DEMAND: 'on-demand';
LIVE: 'live';
UNKNOWN: 'unknown';
};
export declare const StreamTypes: StreamTypes;
export type PlaybackTypes = {
MSE: 'mse';
NATIVE: 'native';
};
export declare const PlaybackTypes: PlaybackTypes;
export type CmcdTypes = {
HEADER: 'header';
QUERY: 'query';
NONE: 'none';
};
export declare const CmcdTypes: CmcdTypes;
export declare const CmcdTypeValues: ("none" | "header" | "query")[];
export type ExtensionMimeTypeMap = {
M3U8: 'application/vnd.apple.mpegurl';
MP4: 'video/mp4';
};
export declare const ExtensionMimeTypeMap: ExtensionMimeTypeMap;
export type MimeTypeShorthandMap = {
HLS: ExtensionMimeTypeMap['M3U8'];
};
export declare const MimeTypeShorthandMap: MimeTypeShorthandMap;
export declare const shorthandKeys: string[];
export type MediaTypes = ValueOf<ExtensionMimeTypeMap> | keyof MimeTypeShorthandMap
/** @TODO Figure out a way to "downgrade" derived types below to early TS syntax (e.g. 3.4) instead of explicit versions here (CJP) */
| 'hls';
export declare const allMediaTypes: MediaTypes[];
type CueLike<T = any> = {
startTime: number;
endTime?: number;
value: T;
};
export type CuePoint<T = any> = CueLike<T> | {
time: number;
value: T;
};
export type Chapter = CueLike<string>;
export declare const MaxResolution: {
readonly upTo720p: "720p";
readonly upTo1080p: "1080p";
readonly upTo1440p: "1440p";
readonly upTo2160p: "2160p";
};
export declare const MinResolution: {
readonly noLessThan480p: "480p";
readonly noLessThan540p: "540p";
readonly noLessThan720p: "720p";
readonly noLessThan1080p: "1080p";
readonly noLessThan1440p: "1440p";
readonly noLessThan2160p: "2160p";
};
export declare const RenditionOrder: {
readonly DESCENDING: "desc";
};
export type MaxResolutionValue = ValueOf<typeof MaxResolution>;
export type MinResolutionValue = ValueOf<typeof MinResolution>;
export type RenditionOrderValue = ValueOf<typeof RenditionOrder>;
export type Tokens = {
playback?: string;
drm?: string;
thumbnail?: string;
storyboard?: string;
};
export type MuxMediaPropTypes = {
_hlsConfig?: Partial<HlsConfig>;
autoPlay?: Autoplay;
autoplay?: Autoplay;
beaconCollectionDomain: Options['beaconCollectionDomain'];
customDomain: string;
debug: Options['debug'] & Hls['config']['debug'];
disableCookies: Options['disableCookies'];
disableTracking: boolean;
drmToken?: string;
playbackToken?: string;
envKey: MetaData['env_key'];
error?: HTMLMediaElement['error'] | MediaError;
errorTranslator: Options['errorTranslator'];
liveEdgeStart: number;
maxResolution: MaxResolutionValue;
metadata: Partial<Options['data']>;
minResolution: MinResolutionValue;
playbackId: string;
playerInitTime: MetaData['player_init_time'];
preferCmcd: ValueOf<CmcdTypes> | undefined;
preferPlayback: ValueOf<PlaybackTypes> | undefined;
programStartTime: number;
programEndTime: number;
assetStartTime: number;
assetEndTime: number;
renditionOrder: RenditionOrderValue;
startTime: Hls['config']['startPosition'];
streamType: ValueOf<StreamTypes>;
targetLiveWindow: number;
tokens: Tokens;
type: MediaTypes;
extraSourceParams: Record<string, any>;
};
export type HTMLMediaElementProps = Partial<Pick<HTMLMediaElement, 'src' | 'preload' | 'error' | 'seekable'>>;
export type MuxMediaProps = HTMLMediaElementProps & MuxMediaPropTypes;
export type MuxMediaPropsInternal = MuxMediaProps & {
playerSoftwareName: MetaData['player_software_name'];
playerSoftwareVersion: MetaData['player_software_version'];
drmTypeCb?: (drmType: Metadata['view_drm_type']) => void;
};
export {};

View File

@@ -0,0 +1,21 @@
import type { HlsPlaylistTypes, MuxMediaProps } from './types';
type addEventListenerWithTeardown = <K extends keyof HTMLMediaElementEventMap, T extends EventTarget = HTMLMediaElement>(mediaEl: HTMLMediaElement, type: K, listener: (this: T, ev: HTMLMediaElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions, target?: T | HTMLMediaElement) => void;
export declare const addEventListenerWithTeardown: addEventListenerWithTeardown;
export declare function inSeekableRange(seekable: TimeRanges, duration: number, time: number): boolean;
export declare const toPlaybackIdParts: (playbackIdWithOptionalParams: string) => [string, string?];
export declare const getType: (props: Partial<Pick<MuxMediaProps, "type" | "src">>) => "" | import("./types").MediaTypes;
export declare const toStreamTypeFromPlaylistType: (playlistType: HlsPlaylistTypes) => "on-demand" | "live";
export declare const toTargetLiveWindowFromPlaylistType: (playlistType: HlsPlaylistTypes) => number;
export declare const inferMimeTypeFromURL: (url: string) => "" | "application/vnd.apple.mpegurl" | "video/mp4";
export type MuxJWT = {
sub: string;
aud: 'v' | 't' | 'g' | 's' | 'd';
exp: number;
};
export declare const parseJwt: (token: string | undefined) => Partial<MuxJWT> | undefined;
export declare const isJWTExpired: ({ exp }: Partial<Pick<MuxJWT, "exp">>, referenceTime?: number) => boolean;
export declare const isJWTSubMismatch: ({ sub }: Partial<Pick<MuxJWT, "sub">>, expectedSub: string | undefined) => boolean;
export declare const isJWTAudMissing: ({ aud }: Partial<Pick<MuxJWT, "aud">>, _expectedAud: string | undefined) => boolean;
export declare const isJWTAudMismatch: ({ aud }: Partial<Pick<MuxJWT, "aud">>, expectedAud: string | undefined) => boolean;
export declare function i18n(str: string, translate?: boolean): any;
export {};

81
server/node_modules/@mux/playback-core/package.json generated vendored Normal file
View File

@@ -0,0 +1,81 @@
{
"name": "@mux/playback-core",
"version": "0.27.0",
"description": "Core library for media playback in the browser shared by mux elements",
"main": "./dist/index.cjs.js",
"module": "./dist/index.mjs",
"browser": "./dist/index.mjs",
"unpkg": "./dist/playback-core.js",
"jsdelivr": "./dist/playback-core.js",
"typesVersions": {
"<4.3.5": {
".": [
"./dist/types-ts3.4/index.d.ts"
]
},
"*": {
".": [
"./dist/types/index.d.ts"
]
}
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs.js",
"default": "./dist/index.cjs.js",
"types@<4.3.5": "./dist/types-ts3.4/index.d.ts",
"types": "./dist/types/index.d.ts"
}
},
"types": "./dist/types/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/muxinc/elements",
"directory": "packages/playback-core"
},
"author": "Mux, Inc.",
"license": "MIT",
"scripts": {
"clean": "shx rm -rf dist/",
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint src/ --ext .js,.jsx,.ts,.tsx",
"test": "web-test-runner **/*.test.js --port 8004 --coverage --config test/web-test-runner.config.mjs --root-dir ../..",
"posttest": "replace 'SF:src/' 'SF:packages/playback-core/src/' coverage/lcov.info --silent",
"dev:cjs": "yarn build:cjs --watch=forever",
"dev:esm": "yarn build:esm --watch=forever",
"dev:esm-module": "yarn build:esm-module --watch=forever",
"dev:iife": "yarn build:iife --watch=forever",
"dev:types": "yarn build:types -w",
"dev": "npm-run-all --parallel dev:types dev:cjs dev:esm dev:iife dev:esm-module",
"build:esm": "esbuilder src/index.ts --sourcemap --format=esm --out-extension:.js=.mjs --external:mux-embed --external:hls.js",
"build:esm-module": "esbuilder src/index.ts --sourcemap --format=esm --outfile=./dist/playback-core.mjs",
"build:cjs": "esbuilder src/index.ts --sourcemap --format=cjs --out-extension:.js=.cjs.js --external:mux-embed --external:hls.js",
"build:iife": "esbuilder src/index.ts --sourcemap --format=iife --outfile=./dist/playback-core.js",
"prebuild:types": "shx mkdir -p ./dist/types && shx cp ../../types/** ./dist/types/",
"build:types": "tsc",
"postbuild:types": "downlevel-dts ./dist/types ./dist/types-ts3.4 --to=3.4",
"build": "npm-run-all --parallel 'build:esm --minify' 'build:iife --minify' 'build:cjs --minify' 'build:esm-module --minify'",
"create-release-notes": "create-release-notes ./CHANGELOG.md",
"publish-release": "../../scripts/publish.sh"
},
"dependencies": {
"hls.js": "~1.5.11",
"mux-embed": "^5.3.1"
},
"devDependencies": {
"@mux/esbuilder": "0.1.0",
"@open-wc/testing": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@web/dev-server-esbuild": "^1.0.2",
"@web/dev-server-import-maps": "^0.2.1",
"@web/test-runner": "^0.18.2",
"downlevel-dts": "^0.11.0",
"esbuild": "^0.19.8",
"eslint": "^9.9.1",
"npm-run-all": "^4.1.5",
"shx": "^0.3.4",
"typescript": "^5.5.4"
},
"gitHead": "e1d17f4ce383e95489fc778d3c5bda3b89a27b5b"
}