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 playback broken in 3.2 #3530

Closed
avelad opened this issue Jul 15, 2021 · 15 comments · Fixed by #3668
Closed

FairPlay playback broken in 3.2 #3530

avelad opened this issue Jul 15, 2021 · 15 comments · Fixed by #3668
Labels
priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@avelad
Copy link
Member

avelad commented Jul 15, 2021

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

What version of Shaka Player are you using? 3.2

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? Both

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

What browser and OS are you using?
Safari 14.1.1 macOS 11.4

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

U'll send by email

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

What did you do?

Load a FairPlay stream

What did you expect to happen?
The stream load without problem

What actually happened?

Error 6010 is always thrown

I see some problems:

  1. https://github.com/google/shaka-player/blob/master/lib/player.js#L2006 should wants instead of has (I'll a send a PR for it)
  2. Now due to the use of mediacapabilities, the information is always consulted through mediacapabilties, but this is thinking for MSE, not for SRC =. So here (https://github.com/google/shaka-player/blob/291c93e5fd8a08f69294e533392fa86da249ff5f/lib/media/drm_engine.js#L353) when consulting the FairPlay information it always returns an error.
@avelad
Copy link
Member Author

avelad commented Jul 15, 2021

@joeyparrish @michellezhuogg @theodab
Note: it is a regression in 3.2

@joeyparrish joeyparrish added type: bug Something isn't working correctly priority: P1 Big impact or workaround impractical; resolve before feature release and removed needs triage labels Jul 16, 2021
@shaka-bot shaka-bot added this to the v3.3 milestone Jul 16, 2021
@avelad
Copy link
Member Author

avelad commented Aug 11, 2021

I have been doing multiple tests and the problem I see is that HLS is theoretically supported in mediacapabilities with file type, but doing multiple tests I have not gotten it to work :(
https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp#L52

@Benny739
Copy link

I'm facing the same error, I made 2 codepens:
Working with 3.1.2:
https://codepen.io/benny739/pen/rNmRqLK

Broken with 3.2.0:
https://codepen.io/benny739/pen/XWRGxzy
Error Code: 6010

Also in safari 15 technology preview neither 3.1.2 nor 3.2.0 are working with Fairplay. I'm not sure if fairplay is simply not supported in the tp, as it is in the iOS simulator or if there is a problem with Safari 15.

michellezhuogg pushed a commit that referenced this issue Aug 16, 2021
)

If it's srcEquals, the 'type' element of the input object when querying mediaCapabilities should be 'file'. Otherwise it should be 'media-source' .
Issue: #3530
michellezhuogg pushed a commit that referenced this issue Aug 16, 2021
In iOS, there is no support for MediaSource, and we should have  'file' as the type of the MediaiDecodingConfig, to check whether the content is supported or not. We should only require MediaSource support in the polyfill when the type of MediaiDecodingConfig is 'media-source'. 
Issue: #3530 .
@avelad
Copy link
Member Author

avelad commented Aug 19, 2021

After doing tests to solve this, it would be best to apply the mediaCapabilities polyfill in Safari (isApple), but if I try to apply it, the following change does not apply:

navigator.mediaCapabilities.decodingInfo =
        shaka.polyfill.MediaCapabilities.decodingInfo_;

@joeyparrish you are more expert in polyfills, can the browser refuse to overwrite a native function?

@theodab
Copy link
Contributor

theodab commented Aug 19, 2021

I tried getting the polyfill to work on Safari, and oddly I found that if you call shaka.polyfill.MediaCapabilities.install() manually in the console, it works. I wonder if something is un-applying our polyfill during the loading process?
The EmeEncryptionSchemePolyfill node module we use does replace navigator.mediaCapabilities.decodingInfo with a shim, but we install that after we install other polyfills, so it shouldn't be able to "see" the original version...

@avelad
Copy link
Member Author

avelad commented Aug 20, 2021

@theodab , I've checked what you say, and with that it works. After the PR #3588, it would only be necessary to solve the installation problem, to close this issue.

@joeyparrish
Copy link
Member

Some properties can't be overwritten. I can't do anything to investigate until Monday, but you can try some of the following:

  • overwrite the field on navigator.mediaCapabilities
  • overwrite navigator.mediaCapabilities itself
  • use Object.defineProperties instead of equals
  • use delete on the property before setting it
  • some combination of these

In my experience, you sometimes just have to try these things and see what the browser lets you get away with.

@avelad
Copy link
Member Author

avelad commented Aug 22, 2021

navigator.mediaCapabilities = /** @type {!MediaCapabilities} */ ({}); produces TypeError: Attempted to assign to readonly property.
delete navigator.mediaCapabilities.decodingInfo does nothing.

@avelad
Copy link
Member Author

avelad commented Sep 9, 2021

I have not found a solution to this. @joeyparrish , can you see if you find it?

@avelad
Copy link
Member Author

avelad commented Sep 23, 2021

@joeyparrish Have you been able to find a solution for this?

@joeyparrish
Copy link
Member

Sorry, we do not have a solution for this.

@avelad
Copy link
Member Author

avelad commented Sep 23, 2021

And what is the best solution then? Revert the MediaCapabilities change in 3.2?

@joeyparrish
Copy link
Member

With the content you sent us via email, I am currently unable to reproduce the issue. (Safari 14.1.1) I see MediaCapabilities negotiating successfully and instantiating a FairPlay CDM. (The license request fails with an HTTP 500 error, but at least MCap is successful.)

Neither navigator.mediaCapabilities itself nor decodingInfo has been overwritten. The polyfill version persists in my tests.

Is the license request failure I see somehow avoiding the hidden trigger for this issue? Or has it been fixed by Apple since? I have Safari 14.1.1 (16611.2.7.1.4) on macOS 11.4.

@maciejrozanski
Copy link

I can reproduce the issue on Safari 14.1.2 and macOS 11.5. After downgrading to shaka-player 3.1.x works fine. I will email you testing materials.

@avelad
Copy link
Member Author

avelad commented Oct 4, 2021

I'm using: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15" (Versión 15.0 (16612.1.29.41.4, 16612)) over macOS 11.6

Captura de pantalla 2021-10-04 a las 21 13 38

I will email you another stream

joeyparrish pushed a commit that referenced this issue Oct 12, 2021
)

If it's srcEquals, the 'type' element of the input object when querying mediaCapabilities should be 'file'. Otherwise it should be 'media-source' .
Issue: #3530
joeyparrish pushed a commit that referenced this issue Oct 12, 2021
In iOS, there is no support for MediaSource, and we should have  'file' as the type of the MediaiDecodingConfig, to check whether the content is supported or not. We should only require MediaSource support in the polyfill when the type of MediaiDecodingConfig is 'media-source'. 
Issue: #3530 .
joeyparrish pushed a commit that referenced this issue Oct 12, 2021
In iOS, there is no support for MediaSource, and we should have  'file' as the type of the MediaiDecodingConfig, to check whether the content is supported or not. We should only require MediaSource support in the polyfill when the type of MediaiDecodingConfig is 'media-source'. 
Issue: #3530 .
joeyparrish pushed a commit that referenced this issue Oct 12, 2021
)

If it's srcEquals, the 'type' element of the input object when querying mediaCapabilities should be 'file'. Otherwise it should be 'media-source' .
Issue: #3530

Change-Id: I8d54f5215f27c663ffdcfef0ec41182139d7f5d7
joeyparrish pushed a commit that referenced this issue Oct 12, 2021
…sers (#3668)

See also #3696

Closes #3530

Change-Id: Ied2e644f8a5d170ef70386dc2a39b51fc95a691f
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Dec 11, 2021
@shaka-project shaka-project locked and limited conversation to collaborators Dec 11, 2021
shaka-bot pushed a commit that referenced this issue Jan 11, 2022
Fixes #3696
Fixes #3530

Change-Id: I2f2e248c9001e10013eb4b03af6b9ef49f28dc6c
joeyparrish added a commit that referenced this issue Jan 11, 2022
Fixes #3696
Fixes #3530

Change-Id: I2f2e248c9001e10013eb4b03af6b9ef49f28dc6c
joeyparrish added a commit that referenced this issue Jan 11, 2022
Fixes #3696
Fixes #3530

Change-Id: I2f2e248c9001e10013eb4b03af6b9ef49f28dc6c
joeyparrish added a commit that referenced this issue Jan 28, 2022
Fixes #3696
Fixes #3530

Change-Id: I2f2e248c9001e10013eb4b03af6b9ef49f28dc6c
tecteun pushed a commit to tecteun/shaka-player that referenced this issue Feb 10, 2022
tecteun pushed a commit to tecteun/shaka-player that referenced this issue Feb 10, 2022
@avelad avelad modified the milestones: v3.3, v4.0 May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
6 participants