1

I am trying to detect if a chrome user has disabled media with copyright via his settings(see attached image) chrome privacy and security

After some research I've only found the following logic which only determines if the browser itself supports protected content or not, not if the user has disabled it on his own. Therefore, it will always return true.

'navigator' in window && 'requestMediaKeySystemAccess' in window.navigator;

Is there a way to detect this? I did notice that Netflix for example detects this and displays a user friendly message before playing the content.

Samdalu
  • 36
  • 2
  • This may help: https://stackoverflow.com/questions/35086625/determine-drm-system-supported-by-browser – icecub Oct 27 '22 at 07:49

2 Answers2

0

I was able to detect this eventually via the requestMediaKeySystemAccess method, https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMediaKeySystemAccess

You have to provide it with the media asset specs and the key system.

Samdalu
  • 36
  • 2
0

The following code seems to work well to detect this

var config = [
  {
    initDataTypes: ["cenc"],
    audioCapabilities: [
      {
        contentType: 'audio/mp4;codecs="mp4a.40.2"',
      },
    ],
    videoCapabilities: [
      {
        contentType: 'video/mp4;codecs="avc1.640016"',
        robustness: "SW_SECURE_CRYPTO",
      },
    ],
  },
];
navigator
  .requestMediaKeySystemAccess("com.widevine.alpha", config)
  .then((k) => {
    console.log(k);
    console.log(k.getConfiguration());
  })
  .catch(console.log);

it does not seem to work with detecting the setting on windows where you can disable content identifiers. where windows will allow screen recording of the content. In case you have an idea how to check for this, How to detect if a user has disabled protected content IDs identifiers?

  • I could not find anything related to the identifier option, I don't believe you can detect as it seems to be a unique identifier stored on the user's device, so I imagine Chrome will not expose these settings to the client side. – Samdalu Mar 07 '23 at 18:44