Skip to content

Commit ba4cf48

Browse files
valotvincerobwalch
authored andcommitted
Add support for com.apple.fps keySystem
1 parent 4fcf804 commit ba4cf48

File tree

9 files changed

+460
-81
lines changed

9 files changed

+460
-81
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,17 @@ The following tags are added to their respective fragment's attribute list but a
113113

114114
For a complete list of issues, see ["Top priorities" in the Release Planning and Backlog project tab](https://github.com/video-dev/hls.js/projects/6). Codec support is dependent on the runtime environment (for example, not all browsers on the same OS support HEVC).
115115

116-
- FairPlay and PlayReady DRM ( See [#3779](https://github.com/video-dev/hls.js/issues/2360) and [issues labeled DRM](https://github.com/video-dev/hls.js/issues?q=is%3Aissue+is%3Aopen+label%3ADRM))
117116
- Advanced variant selection based on runtime media capabilities (See issues labeled [`media-capabilities`](https://github.com/video-dev/hls.js/labels/media-capabilities))
118117
- HLS Content Steering
119118
- HLS Interstitials
120119
- `#EXT-X-DEFINE` variable substitution
121120
- `#EXT-X-GAP` filling [#2940](https://github.com/video-dev/hls.js/issues/2940)
122121
- `#EXT-X-I-FRAME-STREAM-INF` I-frame Media Playlist files
123122
- `SAMPLE-AES` with fmp4, aac, mp3, vtt... segments (MPEG-2 TS only)
123+
- FairPlay DRM with MPEG-2 TS content
124+
- PlayReady (See [#3779](https://github.com/video-dev/hls.js/issues/3779) and [issues labeled DRM](https://github.com/video-dev/hls.js/issues?q=is%3Aissue+is%3Aopen+label%3ADRM))
125+
- Advanced variant selection based on runtime media capabilities (See issues labeled [`media-capabilities`](https://github.com/video-dev/hls.js/labels/media-capabilities))
126+
- MP3 elementary stream audio in IE and Edge (<=18) on Windows 10 (See [#1641](https://github.com/video-dev/hls.js/issues/1641) and [Microsoft answers forum](https://answers.microsoft.com/en-us/ie/forum/all/ie11-on-windows-10-cannot-play-hls-with-mp3/2da994b5-8dec-4ae9-9201-7d138ede49d9))
124127

125128
### Server-side-rendering (SSR) and `require` from a Node.js runtime
126129

api-extractor/report/hls.js.api.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,11 @@ export enum ElementaryStreamTypes {
352352
//
353353
// @public (undocumented)
354354
export type EMEControllerConfig = {
355-
licenseXhrSetup?: (xhr: XMLHttpRequest, url: string) => void;
356-
licenseResponseCallback?: (xhr: XMLHttpRequest, url: string) => ArrayBuffer;
355+
licenseXhrSetup?: (xhr: XMLHttpRequest, url: string, keySystem: KeySystems) => void | Promise<void>;
356+
licenseResponseCallback?: (xhr: XMLHttpRequest, url: string, keySystem: KeySystems) => ArrayBuffer;
357357
emeEnabled: boolean;
358358
widevineLicenseUrl?: string;
359+
drmSystems: DRMSystemsConfiguration;
359360
drmSystemOptions: DRMSystemOptions;
360361
requestMediaKeySystemAccessFunc: MediaKeyFunc | null;
361362
};
@@ -457,6 +458,12 @@ export enum ErrorDetails {
457458
// (undocumented)
458459
KEY_SYSTEM_NO_SESSION = "keySystemNoSession",
459460
// (undocumented)
461+
KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED = "keySystemServerCertificateRequestFailed",
462+
// (undocumented)
463+
KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED = "keySystemServerCertificateUpdateFailed",
464+
// (undocumented)
465+
KEY_SYSTEM_SESSION_UPDATE_FAILED = "keySystemSessionUpdateFailed",
466+
// (undocumented)
460467
LEVEL_EMPTY_ERROR = "levelEmptyError",
461468
// (undocumented)
462469
LEVEL_LOAD_ERROR = "levelLoadError",
@@ -1239,6 +1246,8 @@ export interface KeyLoadingData {
12391246
//
12401247
// @public (undocumented)
12411248
export enum KeySystems {
1249+
// (undocumented)
1250+
FAIRPLAY = "com.apple.fps",
12421251
// (undocumented)
12431252
PLAYREADY = "com.microsoft.playready",
12441253
// (undocumented)
@@ -2232,18 +2241,19 @@ export interface UserdataSample {
22322241

22332242
// Warnings were encountered during analysis:
22342243
//
2235-
// src/config.ts:169:3 - (ae-forgotten-export) The symbol "ILogger" needs to be exported by the entry point hls.d.ts
2236-
// src/config.ts:179:3 - (ae-forgotten-export) The symbol "AudioStreamController" needs to be exported by the entry point hls.d.ts
2237-
// src/config.ts:180:3 - (ae-forgotten-export) The symbol "AudioTrackController" needs to be exported by the entry point hls.d.ts
2238-
// src/config.ts:182:3 - (ae-forgotten-export) The symbol "SubtitleStreamController" needs to be exported by the entry point hls.d.ts
2239-
// src/config.ts:183:3 - (ae-forgotten-export) The symbol "SubtitleTrackController" needs to be exported by the entry point hls.d.ts
2240-
// src/config.ts:184:3 - (ae-forgotten-export) The symbol "TimelineController" needs to be exported by the entry point hls.d.ts
2241-
// src/config.ts:186:3 - (ae-forgotten-export) The symbol "EMEController" needs to be exported by the entry point hls.d.ts
2242-
// src/config.ts:189:3 - (ae-forgotten-export) The symbol "CMCDController" needs to be exported by the entry point hls.d.ts
2243-
// src/config.ts:191:3 - (ae-forgotten-export) The symbol "AbrController" needs to be exported by the entry point hls.d.ts
2244-
// src/config.ts:192:3 - (ae-forgotten-export) The symbol "BufferController" needs to be exported by the entry point hls.d.ts
2245-
// src/config.ts:193:3 - (ae-forgotten-export) The symbol "CapLevelController" needs to be exported by the entry point hls.d.ts
2246-
// src/config.ts:194:3 - (ae-forgotten-export) The symbol "FPSController" needs to be exported by the entry point hls.d.ts
2244+
// src/config.ts:84:3 - (ae-forgotten-export) The symbol "DRMSystemsConfiguration" needs to be exported by the entry point hls.d.ts
2245+
// src/config.ts:187:3 - (ae-forgotten-export) The symbol "ILogger" needs to be exported by the entry point hls.d.ts
2246+
// src/config.ts:197:3 - (ae-forgotten-export) The symbol "AudioStreamController" needs to be exported by the entry point hls.d.ts
2247+
// src/config.ts:198:3 - (ae-forgotten-export) The symbol "AudioTrackController" needs to be exported by the entry point hls.d.ts
2248+
// src/config.ts:200:3 - (ae-forgotten-export) The symbol "SubtitleStreamController" needs to be exported by the entry point hls.d.ts
2249+
// src/config.ts:201:3 - (ae-forgotten-export) The symbol "SubtitleTrackController" needs to be exported by the entry point hls.d.ts
2250+
// src/config.ts:202:3 - (ae-forgotten-export) The symbol "TimelineController" needs to be exported by the entry point hls.d.ts
2251+
// src/config.ts:204:3 - (ae-forgotten-export) The symbol "EMEController" needs to be exported by the entry point hls.d.ts
2252+
// src/config.ts:207:3 - (ae-forgotten-export) The symbol "CMCDController" needs to be exported by the entry point hls.d.ts
2253+
// src/config.ts:209:3 - (ae-forgotten-export) The symbol "AbrController" needs to be exported by the entry point hls.d.ts
2254+
// src/config.ts:210:3 - (ae-forgotten-export) The symbol "BufferController" needs to be exported by the entry point hls.d.ts
2255+
// src/config.ts:211:3 - (ae-forgotten-export) The symbol "CapLevelController" needs to be exported by the entry point hls.d.ts
2256+
// src/config.ts:212:3 - (ae-forgotten-export) The symbol "FPSController" needs to be exported by the entry point hls.d.ts
22472257

22482258
// (No @packageDocumentation comment for this package)
22492259

docs/API.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
- [`widevineLicenseUrl`](#widevineLicenseUrl)
9898
- [`licenseXhrSetup`](#licenseXhrSetup)
9999
- [`licenseResponseCallback`](#licenseResponseCallback)
100+
- [`drmSystems`](#drmSystems)
100101
- [`drmSystemOptions`](#drmSystemOptions)
101102
- [`requestMediaKeySystemAccessFunc`](#requestMediaKeySystemAccessFunc)
102103
- [`cmcd`](#cmcd)
@@ -400,6 +401,7 @@ var config = {
400401
emeEnabled: false,
401402
widevineLicenseUrl: undefined,
402403
licenseXhrSetup: undefined,
404+
drmSystems: {},
403405
drmSystemOptions: {},
404406
requestMediaKeySystemAccessFunc: requestMediaKeySystemAccess,
405407
cmcd: undefined,
@@ -1222,6 +1224,21 @@ var config = {
12221224

12231225
A post-processor function for modifying the license response before passing it to the key-session (`MediaKeySession.update`).
12241226

1227+
### `drmSystems`
1228+
1229+
(default: `{}`)
1230+
1231+
Set `licenseUrl` and `serverCertificateUrl` for a given keySystem to your own DRM provider. `serverCertificateUrl` is not mandatory. Ex:
1232+
1233+
```js
1234+
{
1235+
'com.widevine.alpha': {
1236+
licenseUrl: 'https://proxy.uat.widevine.com/proxy',
1237+
serverCertificateUrl: 'https://storage.googleapis.com/wvmedia/cert/cert_license_widevine_com_uat.bin'
1238+
}
1239+
}
1240+
```
1241+
12251242
### `drmSystemOptions`
12261243

12271244
(default: `{}`)

src/config.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { requestMediaKeySystemAccess } from './utils/mediakeys-helper';
1616
import { ILogger, logger } from './utils/logger';
1717

1818
import type { CuesInterface } from './utils/cues';
19-
import type { MediaKeyFunc } from './utils/mediakeys-helper';
19+
import type { MediaKeyFunc, KeySystems } from './utils/mediakeys-helper';
2020
import type {
2121
FragmentLoaderContext,
2222
Loader,
@@ -59,11 +59,29 @@ export type DRMSystemOptions = {
5959
videoRobustness?: string;
6060
};
6161

62+
export type DRMSystemConfiguration = {
63+
licenseUrl: string;
64+
serverCertificateUrl?: string;
65+
};
66+
67+
export type DRMSystemsConfiguration = Partial<
68+
Record<KeySystems, DRMSystemConfiguration>
69+
>;
70+
6271
export type EMEControllerConfig = {
63-
licenseXhrSetup?: (xhr: XMLHttpRequest, url: string) => void;
64-
licenseResponseCallback?: (xhr: XMLHttpRequest, url: string) => ArrayBuffer;
72+
licenseXhrSetup?: (
73+
xhr: XMLHttpRequest,
74+
url: string,
75+
keySystem: KeySystems
76+
) => void | Promise<void>;
77+
licenseResponseCallback?: (
78+
xhr: XMLHttpRequest,
79+
url: string,
80+
keySystem: KeySystems
81+
) => ArrayBuffer;
6582
emeEnabled: boolean;
6683
widevineLicenseUrl?: string;
84+
drmSystems: DRMSystemsConfiguration;
6785
drmSystemOptions: DRMSystemOptions;
6886
requestMediaKeySystemAccessFunc: MediaKeyFunc | null;
6987
};
@@ -283,6 +301,7 @@ export const hlsDefaultConfig: HlsConfig = {
283301
minAutoBitrate: 0, // used by hls
284302
emeEnabled: false, // used by eme-controller
285303
widevineLicenseUrl: undefined, // used by eme-controller
304+
drmSystems: {}, // used by eme-controller
286305
drmSystemOptions: {}, // used by eme-controller
287306
requestMediaKeySystemAccessFunc: requestMediaKeySystemAccess, // used by eme-controller
288307
testBandwidth: true,

0 commit comments

Comments
 (0)