question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unsupported HLS KEYFORMAT com.apple.streamkingkeydelivery

See original GitHub issue

Have you read the FAQ and checked for duplicate open issues?: YES

What version of Shaka Player are you using?: 2.5.4

Can you reproduce the issue with our latest release version?: YES

Can you reproduce the issue with the latest code from master?: YES

Are you using the demo app or your own custom app?: NO

If custom app, can you reproduce the issue using our demo app?:

What browser and OS are you using?: Safari 12.1.2 on macOS 10.14.6

What are the manifest and license server URIs?: manifest: https://.../manifests/hls/master.m3u8 license: ${this.baseUrl}/items${id}/drm/fairplay

What did you do? Tried to play normal HLS

What did you expect to happen? Video should be played

What actually happened? The documentation seems pretty minimal as the support was just added, but this is what I have thus far

Configuration

player.configure({
  drm: {
    servers: {
      'com.widevine.alpha': `${this.baseUrl}/items/${id}/drm/widevine`,
      'com.microsoft.playready': `${this.baseUrl}/items/${id}/drm/playready`,
      'com.apple.fps.1_0': `${this.baseUrl}/items${id}/drm/fairplay`,
    },
    advanced: {
      'com.apple.fps.1_0': {
        serverCertificate: fairplayUtils.fetchCertificate(),
      },
    },
  },
});
...
load(streamUrl) {
  const url = 'https://.../manifests/hls/master.m3u8'
  player
    .load(url, null, shaka.hls.HlsParser)
    .then(() => { ... }
    .catch((e) => { ... }

I am passing in the master.m3u8 into the load function and get the following error

Error from Shaka Player

Error {
  category: 4
  code: 4026
  data: [] (0)
  handled: false
  message: "Shaka Error MANIFEST.HLS_KEYFORMATS_NOT_SUPPORTED ()"
  severity: 2
  stack: ...
}

Looking at shaka player’s errors (honestly the best error codes I have seen from a third party) it says HLS_KEYFORMATS_NOT_SUPPORTED | 4026 | The HLS parser has encountered encrypted content with unsupported KEYFORMAT attributes.

I then modified my webpack to use the debug version of shaka-player (config.resolve.alias = { 'shaka-player': require.resolve('shaka-player/dist/shaka-player.compiled.debug.js'), }) and modify the imports (import { shaka } from 'shaka-player';) and get the additional errors

[Warning] Unsupported HLS KEYFORMAT – "com.apple.streamingkeydelivery" (0fd27489a42d02c11796.js, line 209516)
[Warning] The walker saw an error: (0fd27489a42d02c11796.js, line 209812)
[Warning] Error Code: – 4026 (0fd27489a42d02c11796.js, line 209813)

The master.m3u8 returns a few prog_index.m3u8 endpoints and the highest resolution of them gets called. The response from: manifests/hls/...stuff.../prog_index.m3u8 endpoint is where the com.apple.streamingkeydelivery is coming from with #EXT-X-KEY

#EXTM3U
#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-KEY:KEYFORMAT="com.apple.streamingkeydelivery",METHOD=SAMPLE-AES,URI="..."
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:10
#EXT-X-MAP:BYTERANGE="857@0",URI=".../...mp4"
#EXTINF:9.57867,
#EXT-X-BYTERANGE:160142@...//...mp4
#EXT-X-ENDLIST

Questions

  1. Is the KEYFORMAT wrong in this response?
  2. In Issue #896, one response was that SAMPLE-AES was not supported with widevine, is it supported with HLS?
  3. Is there any additional configuration that needs to be done to support this KEYFORMAT?
  4. Is this perhaps related to #1625 and/or #850 ? Though it says it is AES, not AES-128, but I haven’t looked up the difference yet

Relates to #382 ?

Any help is appreciated! Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
TheModMakercommented, Aug 13, 2019

Your fetchCertificate method returns a Promise. You need to wait for it to complete. For example:

player.configure({
  drm: {
    advanced: {
      'com.apple.fps.1_0': {
        serverCertificate: await fetchCertificate(),
      },
    },
  },
});
// Or
fetchCertificate().then((cert) => {
  player.configure({
    drm: {
      advanced: {
        'com.apple.fps.1_0': {
          serverCertificate: cert,
        },
      },
    },
  });
});
1reaction
TheModMakercommented, Aug 12, 2019

We only support FairPlay through native src= playback, we don’t support it through MSE playback. If you don’t pass the third argument to load, we’ll default to using src= and it should work fine. You should also look at the new FairPlay tutorial if you are having any trouble setting up src= playback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unsupported HLS KEYFORMAT com.apple ... - GitHub
it says HLS_KEYFORMATS_NOT_SUPPORTED | 4026 | The HLS parser has encountered encrypted content with unsupported KEYFORMAT attributes. I then ...
Read more >
JSDoc: Source: lib/hls/hls_parser.js - Shaka Player Demo
This is consistent with Apple's; // HLS implementation. if (this.config_.hls. ... else {; shaka.log.warning('Unsupported HLS KEYFORMAT', keyFormat);; } ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found