Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into v4-deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Apr 11, 2022
2 parents d5dea18 + 8bb7044 commit 35dd956
Show file tree
Hide file tree
Showing 153 changed files with 142 additions and 1,911 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For details on what's coming next, see our [development roadmap](roadmap.md).

## Platform and browser support matrix

|Browser |Windows |Mac |Linux |Android |iOS >= 12 |ChromeOS|Other|
|Browser |Windows |Mac |Linux |Android |iOS >= 13 |ChromeOS|Other|
|:---------:|:--------:|:-------:|:-------:|:-------:|:--------:|:------:|:---:|
|Chrome¹ |**Y** |**Y** |**Y** |**Y** |**Native**|**Y** | - |
|Firefox¹ |**Y** |**Y** |**Y** |untested⁵|**Native**| - | - |
Expand All @@ -41,7 +41,7 @@ For details on what's coming next, see our [development roadmap](roadmap.md).
|Xbox One | - | - | - | - | - | - |**Y**|

NOTES:
- ¹: On macOS, only Safari 12+ is supported. On iOS, only iOS 12+ is
- ¹: On macOS, only Safari 13+ is supported. On iOS, only iOS 13+ is
supported. Older versions will be rejected.
- ²: The latest stable Chromecast firmware is tested. Both sender and receiver
can be implemented with Shaka Player.
Expand All @@ -54,7 +54,7 @@ NOTES:
- Official support for LG WebOS TV:
https://github.com/shaka-project/shaka-player/issues/1330

We support iOS 12+ through Apple's native HLS player. We provide the same
We support iOS 13+ through Apple's native HLS player. We provide the same
top-level API, but we just set the video's `src` element to the manifest/media.
So we are dependent on the browser supporting the manifests.

Expand Down Expand Up @@ -124,7 +124,7 @@ HLS features supported:
- WebVTT and TTML
- CEA-608/708 captions
- Encrypted content with PlayReady and Widevine
- Encrypted content with FairPlay (Safari on macOS and iOS 12+ only)
- Encrypted content with FairPlay (Safari on macOS and iOS 13+ only)
- Raw AAC, MP3, etc (without an MP4 container)

HLS features **not** supported:
Expand Down
2 changes: 0 additions & 2 deletions build/types/polyfill
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
+../../lib/polyfill/aria.js
+../../lib/polyfill/encryption_scheme.js
+../../lib/polyfill/fullscreen.js
+../../lib/polyfill/mathround.js
+../../lib/polyfill/mediasource.js
+../../lib/polyfill/media_capabilities.js
+../../lib/polyfill/orientation.js
+../../lib/polyfill/patchedmediakeys_apple.js
+../../lib/polyfill/patchedmediakeys_ms.js
+../../lib/polyfill/patchedmediakeys_nop.js
+../../lib/polyfill/patchedmediakeys_webkit.js
Expand Down
1 change: 0 additions & 1 deletion demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ goog.require('goog.asserts');
goog.require('shakaDemo.BoolInput');
goog.require('shakaDemo.DatalistInput');
goog.require('shakaDemo.InputContainer');
goog.require('shakaDemo.Main');
goog.require('shakaDemo.MessageIds');
goog.require('shakaDemo.NumberInput');
goog.require('shakaDemo.SelectInput');
Expand Down
1 change: 0 additions & 1 deletion demo/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ goog.require('ShakaDemoAssetInfo');
goog.require('shakaDemo.AssetCard');
goog.require('shakaDemo.Input');
goog.require('shakaDemo.InputContainer');
goog.require('shakaDemo.Main');
goog.require('shakaDemo.MessageIds');
goog.require('shakaDemo.TextInput');

Expand Down
21 changes: 0 additions & 21 deletions docs/tutorials/fairplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,6 @@ player.configure('drm.advanced.com\\.apple\\.fps\\.serverCertificateUri',
'https://example.com/cert.der');
```

## Content ID

Note: This only applies when legacy Apple Media Keys is used.

Some FairPlay content use custom signaling for the content ID. The content ID
is used by the browser to generate the license request. If you don't use the
default content ID derivation, you need to specify a custom init data transform:

```js
player.configure('drm.initDataTransform', (initData, initDataType) => {
if (initDataType != 'skd')
return initData;

// 'initData' is a buffer containing an 'skd://' URL as a UTF-8 string.
const skdUri = shaka.util.StringUtils.fromBytesAutoDetect(initData);
const contentId = getMyContentId(skdUri);
const cert = player.drmInfo().serverCertificate;
return shaka.util.FairPlayUtils.initDataTransform(initData, contentId, cert);
});
```

## License wrapping

Some FairPlay servers need to accept the license request in a different format
Expand Down
11 changes: 0 additions & 11 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,6 @@ shaka.extern.AdvancedDrmConfiguration;
* clearKeys: !Object.<string, string>,
* delayLicenseRequestUntilPlayed: boolean,
* advanced: Object.<string, shaka.extern.AdvancedDrmConfiguration>,
* initDataTransform:
* ((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
* undefined),
* logLicenseExchange: boolean,
* updateExpirationTime: number,
* preferredKeySystems: !Array.<string>
Expand All @@ -644,14 +641,6 @@ shaka.extern.AdvancedDrmConfiguration;
* <i>Optional.</i> <br>
* A dictionary which maps key system IDs to advanced DRM configuration for
* those key systems.
* @property
* {((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
* undefined)}
* initDataTransform
* <i>Optional.</i><br>
* If given, this function is called with the init data from the
* manifest/media and should return the (possibly transformed) init data to
* pass to the browser.
* @property {boolean} logLicenseExchange
* <i>Optional.</i><br>
* If set to <code>true</code>, prints logs containing the license exchange.
Expand Down
66 changes: 45 additions & 21 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

const Jimp = require('jimp');
const fs = require('fs');
const glob = require('glob');
const path = require('path');
const rimraf = require('rimraf');
const {ssim} = require('ssim.js');
Expand Down Expand Up @@ -107,39 +108,38 @@ module.exports = (config) => {
'dist/deps.js',
'shaka-player.uncompiled.js',

// the demo's config tab will register with shakaDemoMain, and will be
// tested in test/demo/demo_unit.js
'demo/config.js',

// cajon module (an AMD variant of requirejs) next
'node_modules/cajon/cajon.js',

// bootstrapping for the test suite
'test/test/boot.js',
// define the test namespace next (shaka.test)
'test/test/namespace.js',

// test utils next
// test utilities next, which fill in that namespace
'test/test/util/*.js',

// list of test assets next
'demo/common/message_ids.js',
'demo/common/asset.js',
'demo/common/assets.js',
// bootstrapping for the test suite last; this will load the actual tests
'test/test/boot.js',

// if --test-custom-asset *is not* present, we will add unit tests.
// if --quick *is not* present, we will add integration tests.
// if --external *is* present, we will add external asset tests.

// load relevant demo files
{
pattern: 'demo/!(main|load|demo_uncompiled|service_worker).js',
included: true,
},

// source files - these are only watched and served
// source files - these are only watched and served.
// anything not listed here can't be dynamically loaded by other scripts.
{pattern: 'lib/**/*.js', included: false},
{pattern: 'ui/**/*.js', included: false},
{pattern: 'ui/**/*.less', included: false},
{pattern: 'third_party/**/*.js', included: false},
{pattern: 'test/**/*.js', included: false},
{pattern: 'test/test/assets/*', included: false},
{pattern: 'test/test/assets/3675/*', included: false},
{pattern: 'dist/shaka-player.ui.js', included: false},
{pattern: 'dist/locales.js', included: false},
{pattern: 'demo/**/*.js', included: false},
{pattern: 'demo/locales/en.json', included: false},
{pattern: 'demo/locales/source.json', included: false},
{pattern: 'node_modules/sprintf-js/src/sprintf.js', included: false},
Expand Down Expand Up @@ -284,26 +284,30 @@ module.exports = (config) => {
});
}

const clientArgs = config.client.args[0];
clientArgs.testFiles = [];

if (settings.test_custom_asset) {
// If testing custom assets, we don't serve other unit or integration tests.
// External asset tests are the basis for custom asset testing, so this file
// is automatically included.
config.files.push('test/player_external.js');
clientArgs.testFiles.push('test/player_external.js');
} else {
// In a normal test run, we serve unit tests.
config.files.push('test/**/*_unit.js');
clientArgs.testFiles.push('test/**/*_unit.js');

if (!settings.quick) {
// If --quick is present, we don't serve integration tests.
config.files.push('test/**/*_integration.js');
clientArgs.testFiles.push('test/**/*_integration.js');
}
if (settings.external) {
// If --external is present, we serve external asset tests.
config.files.push('test/**/*_external.js');
clientArgs.testFiles.push('test/**/*_external.js');
}
}
// We just modified the config in-place. No need for config.set() after we
// push to config.files.

// These are the test files that will be dynamically loaded by boot.js.
clientArgs.testFiles = resolveGlobs(clientArgs.testFiles);

const reporters = [];

Expand Down Expand Up @@ -348,14 +352,34 @@ module.exports = (config) => {
const seed = settings.seed == null ? new Date().getTime() : settings.seed;

// Run tests in a random order.
const clientArgs = config.client.args[0];
clientArgs.random = true;
clientArgs.seed = seed;

console.log('Using a random test order (--random) with --seed=' + seed);
}
};

/**
* Resolves a list of paths using globs into a list of explicit paths.
* Paths are all relative to the source directory.
*
* @param {!Array.<string>} list
* @return {!Array.<string>}
*/
function resolveGlobs(list) {
const options = {
cwd: __dirname,
};

const resolved = [];
for (const path of list) {
for (const resolvedPath of glob.sync(path, options)) {
resolved.push(resolvedPath);
}
}
return resolved;
}

/**
* Determines which launchers and customLaunchers can be used and returns an
* array of strings.
Expand Down
8 changes: 0 additions & 8 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2454,14 +2454,6 @@ shaka.hls.HlsParser = class {
shaka.util.Error.Code.HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED);
}

if (shaka.util.Platform.isMediaKeysPolyfilled()) {
throw new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.MANIFEST,
shaka.util.Error.Code
.HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED);
}

/*
* Even if we're not able to construct initData through the HLS tag, adding
* a DRMInfo will allow DRM Engine to request a media key system access
Expand Down
40 changes: 0 additions & 40 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ goog.require('shaka.util.BufferUtils');
goog.require('shaka.util.Destroyer');
goog.require('shaka.util.Error');
goog.require('shaka.util.EventManager');
goog.require('shaka.util.FairPlayUtils');
goog.require('shaka.util.FakeEvent');
goog.require('shaka.util.IDestroyable');
goog.require('shaka.util.Iterables');
Expand Down Expand Up @@ -1254,28 +1253,6 @@ shaka.media.DrmEngine = class {
};
this.activeSessions_.set(session, metadata);

/**
* initDataTransform is only necessary when using legacy protection
* APIs, so prevent doing any transform when using the EME HTML5 spec
*/
if (shaka.util.Platform.isMediaKeysPolyfilled()) {
try {
initData = this.config_.initDataTransform(
initData, initDataType, this.currentDrmInfo_);
} catch (error) {
let shakaError = error;
if (!(error instanceof shaka.util.Error)) {
shakaError = new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.DRM,
shaka.util.Error.Code.INIT_DATA_TRANSFORM_ERROR,
error);
}
this.onError_(shakaError);
return;
}
}

if (this.config_.logLicenseExchange) {
const str = shaka.util.Uint8ArrayUtils.toBase64(initData);
shaka.log.info('EME init data: type=', initDataType, 'data=', str);
Expand Down Expand Up @@ -1310,23 +1287,6 @@ shaka.media.DrmEngine = class {
});
}

/**
* @param {!Uint8Array} initData
* @param {string} initDataType
* @param {?shaka.extern.DrmInfo} drmInfo
* @return {!Uint8Array}
*/
static defaultInitDataTransform(initData, initDataType, drmInfo) {
if (initDataType == 'skd') {
const cert = drmInfo.serverCertificate;
const contentId =
shaka.util.FairPlayUtils.defaultGetContentId(initData);
initData = shaka.util.FairPlayUtils.initDataTransform(
initData, contentId, cert);
}
return initData;
}

/**
* @param {!MediaKeyMessageEvent} event
* @private
Expand Down
6 changes: 3 additions & 3 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
return false;
}

// We do not support iOS 9, 10, or 11, nor those same versions of desktop
// Safari.
// We do not support iOS 9, 10, 11 or 12, nor those same versions of
// desktop Safari.
const safariVersion = shaka.util.Platform.safariVersion();
if (safariVersion && safariVersion < 12) {
if (safariVersion && safariVersion < 13) {
return false;
}

Expand Down
49 changes: 0 additions & 49 deletions lib/polyfill/mathround.js

This file was deleted.

0 comments on commit 35dd956

Please sign in to comment.