@mux/playback-core 0.15.0 → 0.16.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.cjs.js +1 -1
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/dist/playback-core.js +31 -29
- package/dist/playback-core.js.map +4 -4
- package/dist/playback-core.mjs +31 -29
- package/dist/playback-core.mjs.map +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/autoplay.d.ts +2 -3
- package/dist/types/index.d.ts +8 -8
- package/dist/types/preload.d.ts +2 -1
- package/dist/types/tracks.d.ts +17 -1
- package/dist/types/types.d.ts +26 -20
- package/dist/types/util.d.ts +1 -1
- package/dist/types-ts3.4/autoplay.d.ts +2 -3
- package/dist/types-ts3.4/index.d.ts +8 -8
- package/dist/types-ts3.4/preload.d.ts +2 -1
- package/dist/types-ts3.4/tracks.d.ts +17 -1
- package/dist/types-ts3.4/types.d.ts +25 -19
- package/dist/types-ts3.4/util.d.ts +1 -1
- package/package.json +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","../../../node_modules/hls.js/dist/hls.js.d.ts","../src/types.ts","../src/util.ts","../src/autoplay.ts","../src/errors.ts","../src/preload.ts","../src/tracks.ts","../src/index.ts","../../../types/media-chrome.d.ts","../../../types/mux-embed.d.ts","../../../types/mux.d.ts"],"fileInfos":[{"version":"
|
|
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.intl.d.ts","../../../node_modules/typescript/lib/lib.es2019.full.d.ts","../../../node_modules/hls.js/dist/hls.js.d.ts","../src/types.ts","../src/util.ts","../src/autoplay.ts","../src/errors.ts","../src/preload.ts","../src/tracks.ts","../src/index.ts","../../../types/media-chrome.d.ts","../../../types/mux-embed.d.ts","../../../types/mux.d.ts"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18",{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"f3d4da15233e593eacb3965cde7960f3fddf5878528d882bcedd5cbaba0193c7","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","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},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},"1f03b495671c3a1bd24510f38b8947f0991dfd6bf0278c68eca14af15b306e1f","889063bdda67270a139b95c1323d214cbf028b19bac7da09982be33e2927e8af",{"version":"04805c25f4f3f9d9656acfc384ea47b6e1f46330ea1a36a038d82da74bc4541a","signature":"b00ecdc37bd286a7746ecdd2fb1403e84efcee710da123d9c08cf08dac488bf3"},{"version":"cda7db617e050c1ab1bad4323787f71c9249a32b1c093eb68f1703253c70a528","signature":"5365c69fdbb9f6f27c86d784adc7dbcac71e6f391b94468007095b4f6e993f65"},{"version":"f3a5aa00f603445ed61dcc8bbb8034f0fc697e63d05571ed7c21d9712fb4fbd5","signature":"5a6e81e28183631d440aedfbfa700c011b883b23d224ad0563106ff2c8de6a21"},{"version":"19d0b22f4d25a0720bd13093c6043aa5790d264c866c3f73b6a5e7417300fb35","signature":"8b1a6692156440f6585937b6b8de1c2692e7cac5c43aeb8893bfbd293f719552"},{"version":"33a7c8c6e9c79e94f4b71eddf5466737a12026eb1215daa85621b5c4f3524193","signature":"594247a3e85c76e671668ae878b41d5e11ad4dbeb32717b567300d2426bd4f8b"},{"version":"dcde3fca17de48371b0b110cf165bf7ff3cd177bcada7758b54224089ab7f143","signature":"f37af7d9608201a19cca4a298a057a0bd1babb2cb08caac3abcd054d105076a7"},{"version":"913e67bb247cd652293333fe5567f3930419797e5e2824c23254858fbb5e87ad","signature":"bccdcf06eb6636ec53cfb7202cf78648e2f3ed0fc1f65a736a56c2326a372f64"},"3cf4c7825a6c0ef1965e8906b85844aafdcdda9d95c8b4bcfcb3a20811cfd0b1","c5a4764697efe3b6b4eaf19b3dc1880cf3df665d30ec93e212233c29a2fa7207",{"version":"a092979673af6906d766c907c9bf0ae97c7bed1f0d9e69d870ce4d4505a51edd","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],[37,38,39,40,41,42,43,46],[38,39],[37,46],[38],[37],[37,38,41,43,46],[37,38]],"referencedMap":[[40,1],[44,2],[42,3],[43,1],[38,4],[39,5],[47,6]],"exportedModulesMap":[[40,5],[44,7],[42,5],[43,8],[38,4],[39,5],[47,6]],"semanticDiagnosticsPerFile":[37,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,36,35,32,33,34,1,10,9,40,41,44,42,43,38,39,45,46,47],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.9.4"}
|
package/dist/types/autoplay.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Autoplay } from './types';
|
|
1
|
+
import { Autoplay, PlaybackEngine } from './types';
|
|
3
2
|
export declare const isAutoplayValue: (value: unknown) => value is Autoplay;
|
|
4
3
|
export declare const setupAutoplay: ({ autoplay: maybeAutoplay }: {
|
|
5
4
|
autoplay?: Autoplay;
|
|
6
|
-
}, mediaEl: HTMLMediaElement, hls?:
|
|
5
|
+
}, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (newAutoplay?: Autoplay) => void;
|
|
7
6
|
export declare const handleAutoplay: (mediaEl: HTMLMediaElement, autoplay: Autoplay) => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import mux from 'mux-embed';
|
|
2
2
|
import Hls from 'hls.js';
|
|
3
3
|
import { MediaError } from './errors';
|
|
4
|
-
import { addTextTrack, removeTextTrack } from './tracks';
|
|
4
|
+
import { addTextTrack, removeTextTrack, addCuePoints, getCuePoints, getActiveCuePoint } from './tracks';
|
|
5
5
|
import { StreamTypes, type ValueOf, type PlaybackCore, type MuxMediaProps, type MuxMediaPropsInternal } from './types';
|
|
6
|
-
export { mux, Hls, MediaError, addTextTrack, removeTextTrack };
|
|
6
|
+
export { mux, Hls, MediaError, addTextTrack, removeTextTrack, addCuePoints, getCuePoints, getActiveCuePoint };
|
|
7
7
|
export * from './types';
|
|
8
8
|
export declare const generatePlayerInitTime: () => any;
|
|
9
9
|
export declare const generateUUID: any;
|
|
10
|
-
export declare const toMuxVideoURL: (playbackId?: string
|
|
10
|
+
export declare const toMuxVideoURL: (playbackId?: string, { domain }?: {
|
|
11
11
|
domain?: string | undefined;
|
|
12
12
|
}) => string | undefined;
|
|
13
13
|
export declare const getError: (mediaEl: HTMLMediaElement) => MediaError | undefined;
|
|
14
|
-
export declare const initialize: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, core?: PlaybackCore
|
|
14
|
+
export declare const initialize: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, core?: PlaybackCore) => {
|
|
15
15
|
engine: Hls | undefined;
|
|
16
16
|
setAutoplay: (newAutoplay?: import("./types").Autoplay | undefined) => void;
|
|
17
17
|
setPreload: (val?: "" | "none" | "metadata" | "auto" | undefined) => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const teardown: (mediaEl?: HTMLMediaElement | null
|
|
19
|
+
export declare const teardown: (mediaEl?: HTMLMediaElement | null, core?: PlaybackCore) => void;
|
|
20
20
|
export declare const setupHls: (props: Partial<Pick<MuxMediaPropsInternal, 'debug' | 'streamType' | 'type' | 'startTime' | 'metadata' | 'preferCmcd'>>, mediaEl: Pick<HTMLMediaElement, 'canPlayType'>) => Hls | undefined;
|
|
21
|
-
export declare const getStreamTypeConfig: (streamType?: ValueOf<StreamTypes>
|
|
21
|
+
export declare const getStreamTypeConfig: (streamType?: ValueOf<StreamTypes>) => {};
|
|
22
22
|
export declare const isMuxVideoSrc: ({ playbackId, src, customDomain, }: Partial<Pick<MuxMediaPropsInternal, 'playbackId' | 'src' | 'customDomain'>>) => boolean;
|
|
23
|
-
export declare const setupMux: (props: Partial<Pick<MuxMediaPropsInternal, 'envKey' | 'playerInitTime' | 'beaconCollectionDomain' | 'errorTranslator' | 'metadata' | 'debug' | 'playerSoftwareName' | 'playerSoftwareVersion' | 'playbackId' | 'src' | 'customDomain' | 'disableCookies'>>, mediaEl: HTMLMediaElement, hlsjs?: Hls
|
|
24
|
-
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, 'preferPlayback' | 'src' | 'type' | 'startTime' | 'streamType' | 'autoplay'>>, mediaEl: HTMLMediaElement, hls?: Pick<Hls,
|
|
23
|
+
export declare const setupMux: (props: Partial<Pick<MuxMediaPropsInternal, 'envKey' | 'playerInitTime' | 'beaconCollectionDomain' | 'errorTranslator' | 'metadata' | 'debug' | 'playerSoftwareName' | 'playerSoftwareVersion' | 'playbackId' | 'src' | 'customDomain' | 'disableCookies'>>, mediaEl: HTMLMediaElement, hlsjs?: Hls) => void;
|
|
24
|
+
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, 'preferPlayback' | 'src' | 'type' | 'startTime' | 'streamType' | 'autoplay'>>, mediaEl: HTMLMediaElement, hls?: Pick<Hls, 'config' | 'on' | 'once' | 'startLoad' | 'stopLoad' | 'recoverMediaError' | 'destroy' | 'loadSource' | 'attachMedia' | 'liveSyncPosition' | 'subtitleTracks' | 'subtitleTrack'>) => void;
|
package/dist/types/preload.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { PlaybackEngine } from './types';
|
|
2
|
+
export declare const setupPreload: ({ preload, src }: Partial<HTMLMediaElement>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (val?: HTMLMediaElement['preload']) => void;
|
package/dist/types/tracks.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import Hls from 'hls.js';
|
|
2
|
+
import { CuePoint } from './types';
|
|
2
3
|
export declare function setupTracks(mediaEl: HTMLMediaElement, hls: Pick<Hls, 'on' | 'once' | 'subtitleTracks' | 'subtitleTrack'>): void;
|
|
3
|
-
export declare function addTextTrack(mediaEl: HTMLMediaElement, kind: TextTrackKind, label: string, lang?: string, id?: string): TextTrack
|
|
4
|
+
export declare function addTextTrack(mediaEl: HTMLMediaElement, kind: TextTrackKind, label: string, lang?: string, id?: string): TextTrack;
|
|
4
5
|
export declare function removeTextTrack(mediaEl: HTMLMediaElement, track: TextTrack): void;
|
|
6
|
+
export type CuePointsConfig = {
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const DefaultCuePointsConfig: CuePointsConfig;
|
|
10
|
+
export declare const getCuePointsTrack: (mediaEl: HTMLMediaElement, { label }?: CuePointsConfig) => TextTrack | undefined;
|
|
11
|
+
export declare function addCuePoints<T>(mediaEl: HTMLMediaElement, cuePoints: CuePoint<T>[], cuePointsConfig?: CuePointsConfig): Promise<TextTrack>;
|
|
12
|
+
export declare function getCuePoints(mediaEl: HTMLMediaElement, cuePointsConfig?: CuePointsConfig): {
|
|
13
|
+
time: number;
|
|
14
|
+
value: any;
|
|
15
|
+
}[];
|
|
16
|
+
export declare function getActiveCuePoint(mediaEl: HTMLMediaElement, cuePointsConfig?: CuePointsConfig): {
|
|
17
|
+
time: number;
|
|
18
|
+
value: any;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export declare function setupCuePoints(mediaEl: HTMLMediaElement, cuePointsConfig?: CuePointsConfig): Promise<TextTrack>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { Options } from 'mux-embed';
|
|
2
|
-
import Hls
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare
|
|
7
|
-
export
|
|
8
|
-
export
|
|
1
|
+
import type { Options } from 'mux-embed';
|
|
2
|
+
import type Hls from 'hls.js';
|
|
3
|
+
import type { HlsConfig } from 'hls.js';
|
|
4
|
+
type KeyTypes = string | number | symbol;
|
|
5
|
+
type Maybe<T> = T | null | undefined;
|
|
6
|
+
export declare const isKeyOf: <T extends {} = any>(k: KeyTypes, o: Maybe<T>) => k is keyof T;
|
|
7
|
+
export type ValueOf<T> = T[keyof T];
|
|
8
|
+
export type Metadata = Partial<Options['data']>;
|
|
9
|
+
export type PlaybackEngine = Hls;
|
|
10
|
+
export type PlaybackCore = {
|
|
9
11
|
engine?: PlaybackEngine;
|
|
10
12
|
setAutoplay: (autoplay?: Autoplay) => void;
|
|
11
13
|
setPreload: (preload?: HTMLMediaElement['preload']) => void;
|
|
12
14
|
};
|
|
13
|
-
export
|
|
15
|
+
export type AutoplayTypes = {
|
|
14
16
|
ANY: 'any';
|
|
15
17
|
MUTED: 'muted';
|
|
16
18
|
};
|
|
17
19
|
export declare const AutoplayTypes: AutoplayTypes;
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
+
export type Autoplay = boolean | ValueOf<AutoplayTypes>;
|
|
21
|
+
export type StreamTypes = {
|
|
20
22
|
VOD: 'on-demand';
|
|
21
23
|
ON_DEMAND: 'on-demand';
|
|
22
24
|
LIVE: 'live';
|
|
@@ -25,33 +27,37 @@ export declare type StreamTypes = {
|
|
|
25
27
|
LL_DVR: 'll-live:dvr';
|
|
26
28
|
};
|
|
27
29
|
export declare const StreamTypes: StreamTypes;
|
|
28
|
-
export
|
|
30
|
+
export type PlaybackTypes = {
|
|
29
31
|
MSE: 'mse';
|
|
30
32
|
NATIVE: 'native';
|
|
31
33
|
};
|
|
32
34
|
export declare const PlaybackTypes: PlaybackTypes;
|
|
33
|
-
export
|
|
35
|
+
export type CmcdTypes = {
|
|
34
36
|
HEADER: 'header';
|
|
35
37
|
QUERY: 'query';
|
|
36
38
|
NONE: 'none';
|
|
37
39
|
};
|
|
38
40
|
export declare const CmcdTypes: CmcdTypes;
|
|
39
41
|
export declare const CmcdTypeValues: ("none" | "header" | "query")[];
|
|
40
|
-
export
|
|
42
|
+
export type ExtensionMimeTypeMap = {
|
|
41
43
|
M3U8: 'application/vnd.apple.mpegurl';
|
|
42
44
|
MP4: 'video/mp4';
|
|
43
45
|
};
|
|
44
46
|
export declare const ExtensionMimeTypeMap: ExtensionMimeTypeMap;
|
|
45
|
-
export
|
|
47
|
+
export type MimeTypeShorthandMap = {
|
|
46
48
|
HLS: ExtensionMimeTypeMap['M3U8'];
|
|
47
49
|
};
|
|
48
50
|
export declare const MimeTypeShorthandMap: MimeTypeShorthandMap;
|
|
49
51
|
export declare const shorthandKeys: string[];
|
|
50
|
-
export
|
|
52
|
+
export type MediaTypes = ValueOf<ExtensionMimeTypeMap> | keyof MimeTypeShorthandMap
|
|
51
53
|
/** @TODO Figure out a way to "downgrade" derived types below to early TS syntax (e.g. 3.4) instead of explicit versions here (CJP) */
|
|
52
54
|
| 'hls';
|
|
53
55
|
export declare const allMediaTypes: MediaTypes[];
|
|
54
|
-
export
|
|
56
|
+
export type CuePoint<T = any> = {
|
|
57
|
+
time: number;
|
|
58
|
+
value: T;
|
|
59
|
+
};
|
|
60
|
+
export type MuxMediaPropTypes = {
|
|
55
61
|
envKey: Options['data']['env_key'];
|
|
56
62
|
debug: Options['debug'] & Hls['config']['debug'];
|
|
57
63
|
metadata: Partial<Options['data']>;
|
|
@@ -69,9 +75,9 @@ export declare type MuxMediaPropTypes = {
|
|
|
69
75
|
autoplay?: Autoplay;
|
|
70
76
|
preferCmcd: ValueOf<CmcdTypes> | undefined;
|
|
71
77
|
};
|
|
72
|
-
export
|
|
73
|
-
export
|
|
74
|
-
export
|
|
78
|
+
export type HTMLMediaElementProps = Partial<Pick<HTMLMediaElement, 'src' | 'preload'>>;
|
|
79
|
+
export type MuxMediaProps = HTMLMediaElementProps & MuxMediaPropTypes;
|
|
80
|
+
export type MuxMediaPropsInternal = MuxMediaProps & {
|
|
75
81
|
playerSoftwareName: Options['data']['player_software_name'];
|
|
76
82
|
playerSoftwareVersion: Options['data']['player_software_version'];
|
|
77
83
|
};
|
package/dist/types/util.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MuxMediaProps } from './types';
|
|
2
|
-
|
|
2
|
+
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;
|
|
3
3
|
export declare const addEventListenerWithTeardown: addEventListenerWithTeardown;
|
|
4
4
|
export declare function inSeekableRange(seekable: TimeRanges, duration: number, time: number): boolean;
|
|
5
5
|
export declare const toPlaybackIdParts: (playbackIdWithOptionalParams: string) => [string, string?];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Autoplay } from './types';
|
|
1
|
+
import { Autoplay, PlaybackEngine } from './types';
|
|
3
2
|
export declare const isAutoplayValue: (value: unknown) => value is Autoplay;
|
|
4
3
|
export declare const setupAutoplay: ({ autoplay: maybeAutoplay }: {
|
|
5
4
|
autoplay?: Autoplay;
|
|
6
|
-
}, mediaEl: HTMLMediaElement, hls?:
|
|
5
|
+
}, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (newAutoplay?: Autoplay) => void;
|
|
7
6
|
export declare const handleAutoplay: (mediaEl: HTMLMediaElement, autoplay: Autoplay) => void;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import mux from 'mux-embed';
|
|
2
2
|
import Hls from 'hls.js';
|
|
3
3
|
import { MediaError } from './errors';
|
|
4
|
-
import { addTextTrack, removeTextTrack } from './tracks';
|
|
4
|
+
import { addTextTrack, removeTextTrack, addCuePoints, getCuePoints, getActiveCuePoint } from './tracks';
|
|
5
5
|
import { StreamTypes, ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal } from './types';
|
|
6
|
-
export { mux, Hls, MediaError, addTextTrack, removeTextTrack };
|
|
6
|
+
export { mux, Hls, MediaError, addTextTrack, removeTextTrack, addCuePoints, getCuePoints, getActiveCuePoint };
|
|
7
7
|
export * from './types';
|
|
8
8
|
export declare const generatePlayerInitTime: () => any;
|
|
9
9
|
export declare const generateUUID: any;
|
|
10
|
-
export declare const toMuxVideoURL: (playbackId?: string
|
|
10
|
+
export declare const toMuxVideoURL: (playbackId?: string, { domain }?: {
|
|
11
11
|
domain?: string | undefined;
|
|
12
12
|
}) => string | undefined;
|
|
13
13
|
export declare const getError: (mediaEl: HTMLMediaElement) => MediaError | undefined;
|
|
14
|
-
export declare const initialize: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, core?: PlaybackCore
|
|
14
|
+
export declare const initialize: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, core?: PlaybackCore) => {
|
|
15
15
|
engine: Hls | undefined;
|
|
16
16
|
setAutoplay: (newAutoplay?: import("./types").Autoplay | undefined) => void;
|
|
17
17
|
setPreload: (val?: "" | "none" | "metadata" | "auto" | undefined) => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const teardown: (mediaEl?: HTMLMediaElement | null
|
|
19
|
+
export declare const teardown: (mediaEl?: HTMLMediaElement | null, core?: PlaybackCore) => void;
|
|
20
20
|
export declare const setupHls: (props: Partial<Pick<MuxMediaPropsInternal, 'debug' | 'streamType' | 'type' | 'startTime' | 'metadata' | 'preferCmcd'>>, mediaEl: Pick<HTMLMediaElement, 'canPlayType'>) => Hls | undefined;
|
|
21
|
-
export declare const getStreamTypeConfig: (streamType?: ValueOf<StreamTypes>
|
|
21
|
+
export declare const getStreamTypeConfig: (streamType?: ValueOf<StreamTypes>) => {};
|
|
22
22
|
export declare const isMuxVideoSrc: ({ playbackId, src, customDomain, }: Partial<Pick<MuxMediaPropsInternal, 'playbackId' | 'src' | 'customDomain'>>) => boolean;
|
|
23
|
-
export declare const setupMux: (props: Partial<Pick<MuxMediaPropsInternal, 'envKey' | 'playerInitTime' | 'beaconCollectionDomain' | 'errorTranslator' | 'metadata' | 'debug' | 'playerSoftwareName' | 'playerSoftwareVersion' | 'playbackId' | 'src' | 'customDomain' | 'disableCookies'>>, mediaEl: HTMLMediaElement, hlsjs?: Hls
|
|
24
|
-
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, 'preferPlayback' | 'src' | 'type' | 'startTime' | 'streamType' | 'autoplay'>>, mediaEl: HTMLMediaElement, hls?: Pick<Hls,
|
|
23
|
+
export declare const setupMux: (props: Partial<Pick<MuxMediaPropsInternal, 'envKey' | 'playerInitTime' | 'beaconCollectionDomain' | 'errorTranslator' | 'metadata' | 'debug' | 'playerSoftwareName' | 'playerSoftwareVersion' | 'playbackId' | 'src' | 'customDomain' | 'disableCookies'>>, mediaEl: HTMLMediaElement, hlsjs?: Hls) => void;
|
|
24
|
+
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, 'preferPlayback' | 'src' | 'type' | 'startTime' | 'streamType' | 'autoplay'>>, mediaEl: HTMLMediaElement, hls?: Pick<Hls, 'config' | 'on' | 'once' | 'startLoad' | 'stopLoad' | 'recoverMediaError' | 'destroy' | 'loadSource' | 'attachMedia' | 'liveSyncPosition' | 'subtitleTracks' | 'subtitleTrack'>) => void;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { PlaybackEngine } from './types';
|
|
2
|
+
export declare const setupPreload: ({ preload, src }: Partial<HTMLMediaElement>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (val?: HTMLMediaElement['preload']) => void;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import Hls from 'hls.js';
|
|
2
|
+
import { CuePoint } from './types';
|
|
2
3
|
export declare function setupTracks(mediaEl: HTMLMediaElement, hls: Pick<Hls, 'on' | 'once' | 'subtitleTracks' | 'subtitleTrack'>): void;
|
|
3
|
-
export declare function addTextTrack(mediaEl: HTMLMediaElement, kind: TextTrackKind, label: string, lang?: string, id?: string): TextTrack
|
|
4
|
+
export declare function addTextTrack(mediaEl: HTMLMediaElement, kind: TextTrackKind, label: string, lang?: string, id?: string): TextTrack;
|
|
4
5
|
export declare function removeTextTrack(mediaEl: HTMLMediaElement, track: TextTrack): void;
|
|
6
|
+
export type CuePointsConfig = {
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const DefaultCuePointsConfig: CuePointsConfig;
|
|
10
|
+
export declare const getCuePointsTrack: (mediaEl: HTMLMediaElement, { label }?: CuePointsConfig) => TextTrack | undefined;
|
|
11
|
+
export declare function addCuePoints<T>(mediaEl: HTMLMediaElement, cuePoints: CuePoint<T>[], cuePointsConfig?: CuePointsConfig): Promise<TextTrack>;
|
|
12
|
+
export declare function getCuePoints(mediaEl: HTMLMediaElement, cuePointsConfig?: CuePointsConfig): {
|
|
13
|
+
time: number;
|
|
14
|
+
value: any;
|
|
15
|
+
}[];
|
|
16
|
+
export declare function getActiveCuePoint(mediaEl: HTMLMediaElement, cuePointsConfig?: CuePointsConfig): {
|
|
17
|
+
time: number;
|
|
18
|
+
value: any;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export declare function setupCuePoints(mediaEl: HTMLMediaElement, cuePointsConfig?: CuePointsConfig): Promise<TextTrack>;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { Options } from 'mux-embed';
|
|
2
|
-
import Hls
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare
|
|
7
|
-
export
|
|
8
|
-
export
|
|
2
|
+
import Hls from 'hls.js';
|
|
3
|
+
import { HlsConfig } from 'hls.js';
|
|
4
|
+
type KeyTypes = string | number | symbol;
|
|
5
|
+
type Maybe<T> = T | null | undefined;
|
|
6
|
+
export declare const isKeyOf: <T extends {} = any>(k: KeyTypes, o: Maybe<T>) => k is keyof T;
|
|
7
|
+
export type ValueOf<T> = T[keyof T];
|
|
8
|
+
export type Metadata = Partial<Options['data']>;
|
|
9
|
+
export type PlaybackEngine = Hls;
|
|
10
|
+
export type PlaybackCore = {
|
|
9
11
|
engine?: PlaybackEngine;
|
|
10
12
|
setAutoplay: (autoplay?: Autoplay) => void;
|
|
11
13
|
setPreload: (preload?: HTMLMediaElement['preload']) => void;
|
|
12
14
|
};
|
|
13
|
-
export
|
|
15
|
+
export type AutoplayTypes = {
|
|
14
16
|
ANY: 'any';
|
|
15
17
|
MUTED: 'muted';
|
|
16
18
|
};
|
|
17
19
|
export declare const AutoplayTypes: AutoplayTypes;
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
+
export type Autoplay = boolean | ValueOf<AutoplayTypes>;
|
|
21
|
+
export type StreamTypes = {
|
|
20
22
|
VOD: 'on-demand';
|
|
21
23
|
ON_DEMAND: 'on-demand';
|
|
22
24
|
LIVE: 'live';
|
|
@@ -25,33 +27,37 @@ export declare type StreamTypes = {
|
|
|
25
27
|
LL_DVR: 'll-live:dvr';
|
|
26
28
|
};
|
|
27
29
|
export declare const StreamTypes: StreamTypes;
|
|
28
|
-
export
|
|
30
|
+
export type PlaybackTypes = {
|
|
29
31
|
MSE: 'mse';
|
|
30
32
|
NATIVE: 'native';
|
|
31
33
|
};
|
|
32
34
|
export declare const PlaybackTypes: PlaybackTypes;
|
|
33
|
-
export
|
|
35
|
+
export type CmcdTypes = {
|
|
34
36
|
HEADER: 'header';
|
|
35
37
|
QUERY: 'query';
|
|
36
38
|
NONE: 'none';
|
|
37
39
|
};
|
|
38
40
|
export declare const CmcdTypes: CmcdTypes;
|
|
39
41
|
export declare const CmcdTypeValues: ("none" | "header" | "query")[];
|
|
40
|
-
export
|
|
42
|
+
export type ExtensionMimeTypeMap = {
|
|
41
43
|
M3U8: 'application/vnd.apple.mpegurl';
|
|
42
44
|
MP4: 'video/mp4';
|
|
43
45
|
};
|
|
44
46
|
export declare const ExtensionMimeTypeMap: ExtensionMimeTypeMap;
|
|
45
|
-
export
|
|
47
|
+
export type MimeTypeShorthandMap = {
|
|
46
48
|
HLS: ExtensionMimeTypeMap['M3U8'];
|
|
47
49
|
};
|
|
48
50
|
export declare const MimeTypeShorthandMap: MimeTypeShorthandMap;
|
|
49
51
|
export declare const shorthandKeys: string[];
|
|
50
|
-
export
|
|
52
|
+
export type MediaTypes = ValueOf<ExtensionMimeTypeMap> | keyof MimeTypeShorthandMap
|
|
51
53
|
/** @TODO Figure out a way to "downgrade" derived types below to early TS syntax (e.g. 3.4) instead of explicit versions here (CJP) */
|
|
52
54
|
| 'hls';
|
|
53
55
|
export declare const allMediaTypes: MediaTypes[];
|
|
54
|
-
export
|
|
56
|
+
export type CuePoint<T = any> = {
|
|
57
|
+
time: number;
|
|
58
|
+
value: T;
|
|
59
|
+
};
|
|
60
|
+
export type MuxMediaPropTypes = {
|
|
55
61
|
envKey: Options['data']['env_key'];
|
|
56
62
|
debug: Options['debug'] & Hls['config']['debug'];
|
|
57
63
|
metadata: Partial<Options['data']>;
|
|
@@ -69,9 +75,9 @@ export declare type MuxMediaPropTypes = {
|
|
|
69
75
|
autoplay?: Autoplay;
|
|
70
76
|
preferCmcd: ValueOf<CmcdTypes> | undefined;
|
|
71
77
|
};
|
|
72
|
-
export
|
|
73
|
-
export
|
|
74
|
-
export
|
|
78
|
+
export type HTMLMediaElementProps = Partial<Pick<HTMLMediaElement, 'src' | 'preload'>>;
|
|
79
|
+
export type MuxMediaProps = HTMLMediaElementProps & MuxMediaPropTypes;
|
|
80
|
+
export type MuxMediaPropsInternal = MuxMediaProps & {
|
|
75
81
|
playerSoftwareName: Options['data']['player_software_name'];
|
|
76
82
|
playerSoftwareVersion: Options['data']['player_software_version'];
|
|
77
83
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MuxMediaProps } from './types';
|
|
2
|
-
|
|
2
|
+
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;
|
|
3
3
|
export declare const addEventListenerWithTeardown: addEventListenerWithTeardown;
|
|
4
4
|
export declare function inSeekableRange(seekable: TimeRanges, duration: number, time: number): boolean;
|
|
5
5
|
export declare const toPlaybackIdParts: (playbackIdWithOptionalParams: string) => [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mux/playback-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Core library for media playback in the browser shared by mux elements",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"clean": "shx rm -rf dist/",
|
|
32
32
|
"lint": "eslint src/ --ext .js,.jsx,.ts,.tsx",
|
|
33
|
-
"test": "web-test-runner
|
|
33
|
+
"test": "web-test-runner **/*.test.js --port 8004 --coverage --config test/web-test-runner.config.mjs --root-dir ../..",
|
|
34
34
|
"posttest": "replace 'SF:src/' 'SF:packages/playback-core/src/' coverage/lcov.info --silent",
|
|
35
35
|
"dev:cjs": "yarn build:cjs --watch=forever",
|
|
36
36
|
"dev:esm": "yarn build:esm --watch=forever",
|
|
@@ -49,23 +49,23 @@
|
|
|
49
49
|
"publish-release": "../../scripts/publish.sh"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"hls.js": "1.
|
|
52
|
+
"hls.js": "1.3.1",
|
|
53
53
|
"mux-embed": "^4.14.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@mux/test-esm-exports": "0.1.0",
|
|
57
57
|
"@open-wc/testing": "^3.0.3",
|
|
58
|
-
"@typescript-eslint/parser": "^5.
|
|
58
|
+
"@typescript-eslint/parser": "^5.48.0",
|
|
59
59
|
"@web/dev-server-esbuild": "^0.3.2",
|
|
60
60
|
"@web/dev-server-import-maps": "^0.0.6",
|
|
61
61
|
"@web/test-runner": "^0.13.26",
|
|
62
|
-
"downlevel-dts": "^0.
|
|
62
|
+
"downlevel-dts": "^0.11.0",
|
|
63
63
|
"esbuild": "^0.15.7",
|
|
64
64
|
"eslint": "^8.24.0",
|
|
65
65
|
"npm-run-all": "^4.1.5",
|
|
66
66
|
"shared-polyfills": "0.1.0",
|
|
67
67
|
"shx": "^0.3.4",
|
|
68
|
-
"typescript": "^4.
|
|
68
|
+
"typescript": "^4.9.4"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "94287498d707a65385b71ad689cab46bc9e6197a"
|
|
71
71
|
}
|