Skip to content

Commit

Permalink
feat!: Remove support for Safari 12 and support modern EME in Safari 13
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Velad committed Apr 11, 2022
1 parent 57c7324 commit 2b176bd
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 837 deletions.
8 changes: 4 additions & 4 deletions README.md
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
1 change: 0 additions & 1 deletion build/types/polyfill
Expand Up @@ -8,7 +8,6 @@
+../../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
21 changes: 0 additions & 21 deletions docs/tutorials/fairplay.md
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
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
8 changes: 0 additions & 8 deletions lib/hls/hls_parser.js
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
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
Expand Up @@ -847,10 +847,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

0 comments on commit 2b176bd

Please sign in to comment.