From 14773e2fcc5ed200ad9d6e42705ca3229821f296 Mon Sep 17 00:00:00 2001 From: Casey Occhialini <1508707+littlespex@users.noreply.github.com> Date: Fri, 9 Aug 2024 02:32:15 -0700 Subject: [PATCH] Add ESM files to package json (#4543) * Output ESM via webpack build script * Remove ESM output from dev config * Remove unnecessary import * fix: update package json export fields * no message * no message --- index.d.ts | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- package.json | 11 +++++++++-- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 6d341a5123..e56083fb48 100644 --- a/index.d.ts +++ b/index.d.ts @@ -17,6 +17,15 @@ declare namespace dashjs { setCalleeNameVisible(flag: boolean): void; } + namespace Debug { + const LOG_LEVEL_NONE = 0; + const LOG_LEVEL_FATAL = 1; + const LOG_LEVEL_ERROR = 2; + const LOG_LEVEL_WARNING = 3; + const LOG_LEVEL_INFO = 4; + const LOG_LEVEL_DEBUG = 5; + } + interface EventBus { on(type: string, listener: any, scope: any, options?: object): void; @@ -1296,6 +1305,14 @@ declare namespace dashjs { export type TrackSelectionFunction = (tracks: MediaInfo[]) => MediaInfo[]; + export interface DvrWindow { + start: number; + end: number; + startAsUtc: number; + endAsUtc: number; + size: number; + } + export interface MediaPlayerClass { setConfig(config: object): void; @@ -1427,7 +1444,7 @@ declare namespace dashjs { timeInDvrWindow(): number; - getDvrWindow(): object; + getDvrWindow(): DvrWindow; duration(): number; @@ -1483,7 +1500,7 @@ declare namespace dashjs { setTextTrack(idx: number): void; - getRepresentationsFor(type: MediaType): Representation[]; + getRepresentationsByType(type: MediaType): Representation[]; getStreamsFromManifest(manifest: object): StreamInfo[]; @@ -3178,6 +3195,31 @@ declare namespace dashjs { MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE: 'DRM: licenser error! --'; } + /** + * Streaming - Protection - Events + **/ + + export interface ProtectionEvents { + KEY_ADDED: 'public_keyAdded'; + KEY_ERROR: 'public_keyError'; + KEY_MESSAGE: 'public_keyMessage'; + KEY_SESSION_CLOSED: 'public_keySessionClosed'; + KEY_SESSION_CREATED: 'public_keySessionCreated'; + KEY_SESSION_REMOVED: 'public_keySessionRemoved'; + KEY_STATUSES_CHANGED: 'public_keyStatusesChanged'; + KEY_SYSTEM_ACCESS_COMPLETE: 'public_keySystemAccessComplete'; + KEY_SYSTEM_SELECTED: 'public_keySystemSelected'; + LICENSE_REQUEST_COMPLETE: 'public_licenseRequestComplete'; + LICENSE_REQUEST_SENDING: 'public_licenseRequestSending'; + NEED_KEY: 'needkey'; + PROTECTION_CREATED: 'public_protectioncreated'; + PROTECTION_DESTROYED: 'public_protectiondestroyed'; + SERVER_CERTIFICATE_UPDATED: 'serverCertificateUpdated'; + TEARDOWN_COMPLETE: 'protectionTeardownComplete'; + VIDEO_ELEMENT_SELECTED: 'videoElementSelected'; + KEY_SESSION_UPDATED: 'public_keySessionUpdated'; + } + /** * Streaming - Protection - Models **/ @@ -3511,6 +3553,11 @@ declare namespace dashjs { createProtectionSystem(config: object): void; } + export namespace Protection { + export const events: ProtectionEvents; + export const errors: ProtectionErrors; + } + /** * Streaming - Rules - ABR - LolP */ diff --git a/package.json b/package.json index 1cfedaa4a3..2d25e809f1 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,16 @@ "description": "A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.", "author": "Dash Industry Forum", "license": "BSD-3-Clause", - "exports": "./dist/dash.all.min.js", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./dist/esm/dash.all.debug.esm.js", + "default": "./dist/esm/dash.all.debug.esm.js", + "browser": "./dist/dash.all.min.js", + "script": "./dist/dash.all.min.js" + } + }, "type": "module", - "types": "index.d.ts", "scripts": { "dev": "tsc && webpack --config build/webpack.dev.cjs --mode development --watch --progress", "start": "webpack serve --config build/webpack.dev.cjs",