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

CBCS content does not work on WebOS6 since commit ec29f82592fdec9e189fc87a25704fabffb7d404 #7477

Open
jakubvojacek opened this issue Oct 23, 2024 · 4 comments
Labels
component: EME The issue involves the Encrypted Media Extensions web API platform: WebOS Issues affecting WebOS priority: P2 Smaller impact or easy workaround type: bug Something isn't working correctly
Milestone

Comments

@jakubvojacek
Copy link

jakubvojacek commented Oct 23, 2024

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

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

What version of Shaka Player are you using?
latest

Can you reproduce the issue with our latest release version?
yes

Can you reproduce the issue with the latest code from main?
yes

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

If custom app, can you reproduce the issue using our demo app?
its a smarttv, cannot use demo app there

What browser and OS are you using?
unrelated

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
WebOS6 which uses chrome 79

What are the manifest and license server URIs?
Manifest: https://edge1.motv.eu/s1/vods/30/neni-houba-jako-houba-3852/66c72001de232-2635-mp4-cbcs.mpd
License server: https://mw.motv.eu/widevine_proxy

What configuration are you using? What is the output of player.getNonDefaultConfiguration()?

{
  "drm": {
    "servers": {
      "com.widevine.alpha": "https://mw.motv.eu/widevine_proxy",
      "com.apple.fps": "https://mw.motv.eu/ksm",
      "com.apple.fps.1_0": "https://mw.motv.eu/ksm"
    },
    "advanced": {
      "com.widevine.alpha": {
        "distinctiveIdentifierRequired": false,
        "persistentStateRequired": false,
        "videoRobustness": "SW_SECURE_CRYPTO",
        "audioRobustness": "",
        "sessionType": "",
        "serverCertificateUri": "",
        "individualizationServer": ""
      },
      "com.apple.fps": {
        "distinctiveIdentifierRequired": false,
        "persistentStateRequired": false,
        "videoRobustness": "",
        "audioRobustness": "",
        "sessionType": "",
        "serverCertificateUri": "https://mw.motv.eu/static/FairPlay.der",
        "individualizationServer": ""
      }
    }
  },
  "manifest": {
    "availabilityWindowOverride": null
  },
  "streaming": {},
  "mediaSource": {
    "forceTransmux": true
  },
  "offline": {},
  "preferredAudioLanguage": "cs"
}

What did you do?
I attempted to play Widevine-CBCS encrypted content on webos

What did you expect to happen?
For the playback to work

What actually happened?
It didn't work, on some versions it fails with 4032 and later on with 6001 shaka player error code

I was able to find the commit that broke the playback by testing and compiling shaka player commit by commit - it was ec29f82

If I understand what the commit does, it is trying to detect cbcs encryption support and if not supported, it will remove the tracks. But webos6 does support CBCS and therefore it should play normally. Is there something we can change, configuration-wise in the player to make this work? Or is it an issue with webos and its declaration of supported drms? I tried setting up audioRobustness as well but that didn't help

Are you planning send a PR to fix it?
I tried to study the commit in question but I am not sure I fully understand it

@jakubvojacek jakubvojacek added the type: bug Something isn't working correctly label Oct 23, 2024
@shaka-bot shaka-bot added this to the v4.12 milestone Oct 23, 2024
@joeyparrish joeyparrish added component: EME The issue involves the Encrypted Media Extensions web API priority: P2 Smaller impact or easy workaround labels Oct 23, 2024
@jakubvojacek
Copy link
Author

iI was looking again at the commit that broke it and perhaps it was not in shaka code but in the library that was updated, this commit seems like related to cbcs and encryption support shaka-project/eme-encryption-scheme-polyfill#63

@jakubvojacek
Copy link
Author

I think here https://github.com/shaka-project/eme-encryption-scheme-polyfill/pull/63/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R619 there should also be something

|| isRecentWebOs()

and the method should return true if its webos and Chrome version in user agent is higher or equal to 68. Not sure how to test this in my environment tho, not that familiar with npm and javascript.

@joeyparrish
Copy link
Member

You could send a PR to that project to fix it. You can test in Shaka by checking out source to the polyfill, modifying, building, then copying it over node_modules/... in Shaka.

@avelad avelad added the platform: WebOS Issues affecting WebOS label Oct 29, 2024
@jakubvojacek
Copy link
Author

@joeyparrish I tried your approach but for some reason, the build of shaka player is refusing to pick up my changed polyfill, instead it reinstalls it

I checked useragent of the TV I got in the office and it was Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 WebAppManager

Based on the useragent, I believe the following diff is required but didn't manage to test it.

diff --git a/index.js b/index.js
index 6b0bc37..4b280ba 100644
--- a/index.js
+++ b/index.js
@@ -654,6 +654,7 @@ function checkSupportedScheme(scheme, supportedScheme) {
 
   if (scheme == 'cbcs' || scheme == 'cbcs-1-9') {
     if (EncryptionSchemePolyfills.isRecentFirefox ||
+        EncryptionSchemePolyfills.isRecentWebOs() ||
         EncryptionSchemePolyfills.isChromecast) {
       // Firefox >= 100 supports CBCS, but doesn't support queries yet.
       // Older Chromecast devices are assumed to support CBCS as well.
@@ -718,6 +719,24 @@ EncryptionSchemePolyfills.isChromecast =
 EncryptionSchemePolyfills.isRecentFirefox =
     parseInt(navigator.userAgent.split('Firefox/').pop(), 10) >= 100;
 
+/**
+ * @const {boolean}
+ */
+EncryptionSchemePolyfills.isRecentWebOs = (() => {
+    const userAgent = navigator.userAgent.toLowerCase();
+    const isWebOs = userAgent.includes('webos');
+
+    if (!isWebOs) return false;
+
+    const chromeVersionMatch = userAgent.match(/chrome\/(\d+)/);
+
+    if (!chromeVersionMatch) return false;
+
+    const chromeVersion = parseInt(chromeVersionMatch[1], 10);
+
+    return chromeVersion >= 79;
+})();
+
 // Support for CommonJS and AMD module formats.
 /** @suppress {undefinedVars} */
 (() => {

The way I am building shaka is python3.9 ./build/build.py --debug --force

@avelad avelad modified the milestones: v4.12, v4.13 Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: EME The issue involves the Encrypted Media Extensions web API platform: WebOS Issues affecting WebOS priority: P2 Smaller impact or easy workaround type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

4 participants