Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Play Fairplay Protected Content #6865

Closed
momyuke opened this issue Nov 25, 2024 · 4 comments
Closed

Cannot Play Fairplay Protected Content #6865

momyuke opened this issue Nov 25, 2024 · 4 comments

Comments

@momyuke
Copy link

momyuke commented Nov 25, 2024

What do you want to do with Hls.js?

I've tried to create a live streaming page that running with universal DRM, but when we try to play Fairplay Protected Content, hls.js just return the error even thought the license was there

e0946d64-53cf-45e6-9227-2852cd765ed6

What have you tried so far?

const appleDeviceConfig: Partial<HlsConfig> = {
      Eme Enabled: true,
      licenseXhrSetup(xhr, url, keyContext) {
        const urlObject: URL = new URL(url);
        const keyId: string = stringify(
          keyContext.decryptdata?.keyId ?? Uint8Array.from([])
        );

        urlObject.searchParams.append("KID", keyId);
        xhr.open("POST", urlObject.toString());
        xhr.setRequestHeader("Content-Type", "application/octet-stream");
      },
      
      drmSystems: {
        "com.apple.fps": {
          licenseUrl: `https://linkdrm/fairplay?brandGuid=******-****-****-****-********&userToken=${user?.drmLisence}`,
          serverCertificateUrl:
            "https://linkdrm/certificate/fairplay?brandGuid=******-****-****-****-********",
        },
      },
      licenseResponseCallback(xhr) {
        return xhr.response;
      },
    };

Code above is my config for apple devices

@momyuke momyuke added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Nov 25, 2024
@robwalch
Copy link
Collaborator

Please provide full logs (config containing debug: true) and the error call stack.

See the Bug Report Template for other items we need when troubleshooting issues:

  • Test stream/page (if possible)
  • Steps to reproduce
  • Expected behavior
  • Actual behavior

If the issue is related to your stream, and you cannot share the stream, please include all the information we would need to reproduce the issue. This includes how to generate a stream that reproduces the issue.

@robwalch robwalch added Need info and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Nov 25, 2024
@momyuke
Copy link
Author

momyuke commented Nov 26, 2024

What version of Hls.js are you using?

1.5.17

What browser (including version) are you using?

Version 17.5 (19618.2.12.11.6)

What OS (including version) are you using?

14.5 (23F79) SONOMA

Test stream

Cannot provide it. However, the stream comes from MediaPackage AWS service, and we are using SPEKE 2.0 for the content encryption. The content itself is playable when we use the Chrome that using Widevine DRM.
However, if you still want to test with my stream. I will contact you through email

Configuration

const appleDeviceConfig: Partial<HlsConfig> = {
      debug: true,
      emeEnabled: true,
      licenseXhrSetup(xhr, url, keyContext) {
        const urlObject: URL = new URL(url);
        const keyId: string = stringify(
          keyContext.decryptdata?.keyId ?? Uint8Array.from([])
        );

        urlObject.searchParams.append("KID", keyId);
        xhr.open("POST", urlObject.toString());
        xhr.setRequestHeader("Content-Type", "application/octet-stream");
      },
      
      drmSystems: {
        "com.apple.fps": {
          licenseUrl: `https://linkdrm/fairplay?brandGuid=******-****-****-****-********&userToken=${user?.drmLisence}`,
          serverCertificateUrl:
            "https://linkdrm/certificate/fairplay?brandGuid=******-****-****-****-********",
        },
      },
      licenseResponseCallback(xhr) {
        return xhr.response;
      },
    };

Steps to reproduce

  1. Prepare your live stream with Fairplay Encryption Content
  2. Prepare the config
  3. Try to play the live stream

Expected behaviour

What we expected is the live stream is play as usual

What actually happened?

The live stream is not play, and the player is just showing the blank

Console Output

[Log] [log] > – "[eme]" – "License received 556" (index-Bq947n8l.js, line 26)
[Log] [log] > – "[eme]" – "Updating key-session \"11069149615312586530\" for keyID a8107b5636744301a6d5c3dc058fcbac↵      } (data length: 556)" (index-Bq947n8l.js, line 25) "Updating key-session \"11069149615312586530\" for keyID a8107b5636744301a6d5c3dc058fcbac       } (data length: 556)" 
[Log] [log] > – "[eme]" – "key status change \"usable\" for keyStatuses keyId: a8107b5636744301a6d5c3dc058fcbac session keyId: a8107b5636744301a6d5c3dc058fcbac uri…" (index-Bq947n8l.js, line 26) "key status change \"usable\" for keyStatuses keyId: a8107b5636744301a6d5c3dc058fcbac session keyId: a8107b5636744301a6d5c3dc058fcbac uri: skd://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=*******&KID=*****&IV=******" 

[Log] [log] > – "[eme]" – "License received 764" (index-Bq947n8l.js, line 26) 
[Log] [log] > – "[eme]" – "Updating key-session \"12896569612860194148\" for keyID c7b00df9b14f4e08a98663289bba7c89↵      } (data length: 764)" (index-Bq947n8l.js, line 25) "Updating key-session \"12896569612860194148\" for keyID c7b00df9b14f4e08a98663289bba7c89       } (data length: 764)"
[Log] [log] > – "[eme]" – "key status change \"usable\" for keyStatuses keyId: c7b00df9b14f4e08a98663289bba7c89 session keyId: c7b00df9b14f4e08a98663289bba7c89 uri…" (index-Bq947n8l.js, line 26) "key status change \"usable\" for keyStatuses keyId: c7b00df9b14f4e08a98663289bba7c89 session keyId: c7b00df9b14f4e08a98663289bba7c89 uri: skd://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=*******&KID=*****&IV=******" 
 [Log] [log] > – "[audio-stream-controller]:" – "Buffered audio sn: 4671 of track 0 (frag:[0.019-3.005] > buffer:[0.019-3.005])" (index-Bq947n8l.js, line 8)
[Log] [log] > – "[audio-stream-controller]:" – "PARSED->IDLE" (index-Bq947n8l.js, line 8)
[Log] [log] > – "[stream-controller]:" – "Buffered main sn: 4671 of level 0 (frag:[0.000-3.003] > buffer:[0.033-3.036])" (index-Bq947n8l.js, line 8) 
[Log] [log] > – "[stream-controller]:" – "PARSED->IDLE" (index-Bq947n8l.js, line 8)
[Log] [log] > – "[stream-controller]:" – "Loading key for 4672 of [4671-4690], level 0" (index-Bq947n8l.js, line 8) 
[Log] [log] > – "[stream-controller]:" – "IDLE->KEY_LOADING" (index-Bq947n8l.js, line 8)
[Log] [log] > – "[stream-controller]:" – "Loading fragment 4672 cc: 4 of [4671-4690] level: 0, target: 3.036" (index-Bq947n8l.js, line 8) 
[Log] [log] > – "[stream-controller]:" – "KEY_LOADING->FRAG_LOADING" (index-Bq947n8l.js, line 8) 
[Log] [log] > – "[buffer-controller]" – "Media source ended" (index-Bq947n8l.js, line 14) 
[Log] [log] > – "[buffer-controller]" – "Media source closed" (index-Bq947n8l.js, line 14) 
[Log] [log] > – "[stream-controller]:" – "FRAG_LOADING->STOPPED" (index-Bq947n8l.js, line 8) 
[Log] [log] > – "[audio-stream-controller]:" – "IDLE->STOPPED" (index-Bq947n8l.js, line 8) 
[Log] [log] > – "[subtitle-stream-controller]:" – "IDLE->STOPPED" (index-Bq947n8l.js, line 8)

@momyuke
Copy link
Author

momyuke commented Nov 26, 2024

Please provide full logs (config containing debug: true) and the error call stack.

See the Bug Report Template for other items we need when troubleshooting issues:

  • Test stream/page (if possible)
  • Steps to reproduce
  • Expected behavior
  • Actual behavior

If the issue is related to your stream, and you cannot share the stream, please include all the information we would need to reproduce the issue. This includes how to generate a stream that reproduces the issue.

Hello @robwalch , i just updated my information.
Anyway, i just read the hls.js code. I think the issue is come here, which when the hls.js try to update the license it throw the error.
image

The error

image

I don't know why it is throwing the error even though the license was there. Please kindly check my code, if there any miss configuration that I implemented.

Thank you

@momyuke
Copy link
Author

momyuke commented Nov 28, 2024

just move this question to this one, please help #6874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants