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

FairPlay DRM Stopped Working After Upgrading from 4.7.3 to 4.12.6 (Issue Starts at 4.10.0) #8021

Open
sertacars opened this issue Feb 5, 2025 · 4 comments
Labels
type: question A question from the community

Comments

@sertacars
Copy link

Have you read the Tutorials?
Yes

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

If the question is related to FairPlay, have you read the tutorial?

Yes

What version of Shaka Player are you using?
4.12.6

What browser and OS are you using?
Safari - macOS Sequoia

Please ask your question
I recently upgraded Shaka Player in my project from 4.7.3 to 4.12.6 and noticed that FairPlay DRM is no longer working. After testing multiple versions, I found that the issue starts from version 4.10.0.

I checked the release notes and documentation, but I couldn’t find any information on what changes I need to make in my code to fix this issue.

Screenshot of the error for reference:

Image

Additionally, I found that my code does not enter the webkitneedkey event when using versions 4.10.0 or later. Specifically, in the following code, the event handler is never triggered:

const addNeedKeyEventToVideo = () => {
  let video = ref.current;
  video.addEventListener('webkitneedkey', onNeedKey, false);
};

I'm happy to share more code snapshots if needed.

Thanks.

@sertacars sertacars added the type: question A question from the community label Feb 5, 2025
@avelad
Copy link
Member

avelad commented Feb 5, 2025

If it has stopped working, it is probably a bug, but in order to know what is happening we need to be able to reproduce it... (url, config for your DRM provider, etc...)

@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Feb 5, 2025
@sertacars
Copy link
Author

This is how we configure Fairplay DRM:

"drm": {
    "fairplay": {
      "certificateUrl": "fps-cert-url",
      "licenseUrl": "license-url"
    }
  }
  if (drm?.fairplay && (isSafari || isIOS)) {
    const req = await fetch(drm.fairplay.certificateUrl);
    const cert = await req.arrayBuffer();

    fpsCertificate = new Uint8Array(cert);
    addNeedKeyEventToVideo();
  }
};

const addNeedKeyEventToVideo = () => {
  let video = ref.current;
  video.addEventListener('webkitneedkey', onNeedKey, false);
};

@avelad
Copy link
Member

avelad commented Feb 6, 2025

Try to install shaka.polyfill.PatchedMediaKeysApple.install(); after shaka.polyfill.installAll();

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Feb 6, 2025
@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Feb 6, 2025
@sertacars
Copy link
Author

Try to install shaka.polyfill.PatchedMediaKeysApple.install(); after shaka.polyfill.installAll();

When i do this, error code changes to 4041, whis is explained like this in error desc:

HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED | 4041 | number | We do not support playing encrypted content (different than mp2t) with MSE and legacy Apple MediaKeys API.

Image

This is where i use apple media key:

  if (!video.webkitKeys) {
    video.webkitSetMediaKeys(new WebKitMediaKeys('com.apple.fps'));
  }

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question A question from the community
Projects
None yet
Development

No branches or pull requests

3 participants