xbmc / inputstream.adaptive

kodi inputstream addon for several manifest types
Other
452 stars 241 forks source link

[Bug] PlayReady DRM dont works on android #1642

Open CastagnaIT opened 3 weeks ago

CastagnaIT commented 3 weeks ago

Describe the problem

With recent changes i was testing Smoothstreaming manifest with playready DRM and i noticed that was not working on my Nvidia shield

i tested ISA on Kodi 18/19/22 on all versions Playready is broken

now Nvidia shield is my only device that should support playready DRM then i cannot make a comparison with another device to say if it is a Shield problem or a ISA problem

here i add the two test streams that come from Microsoft servers (read strm txt for license urls) SMOOTHSTREAM - DRM superspeedway.strm.txt SMOOTHSTREAM - DRM tearsofsteel.strm.txt

these two streams works correctly on Shaka player under Edge browser, i tried to compare ISA saved license files ".init" and "response" and compared with the browser license request/response data, and i havent found particular differences that can explain the problem

on logcat is possible to see many lines of system errors

i have also prepared a DASH with playready test stream DASH_playready - Tearsofsteels.strm.txt

Possible fix

No response

Steps to reproduce

No response

Debug log

kodi.log logcat.txt

Stream manifest file(s)

No response

Additional info

No response

Operating system(s)

Android

Operating system version(s)

No response

InputStream Adaptive version(s)

Tested all last releases

Kodi version(s)

18/19/22

Uukrull commented 3 weeks ago

Tested on a Shield TV and a FireTV 4K and both have the same problem:

2024-08-20 11:22:47.945 T:8218     info <general>: AddOnLog: inputstream.adaptive: Manifest successfully parsed (Periods: 1, Streams in first period: 15, Type: VOD)
2024-08-20 11:22:48.171 T:8218  warning <general>: AddOnLog: inputstream.adaptive: Key request not successful - trying provisioning
2024-08-20 11:22:48.242 T:8218    error <general>: AddOnLog: inputstream.adaptive:
 GetKeyRequest: Key request not successful
2024-08-20 11:22:48.243 T:8218    error <general>: AddOnLog: inputstream.adaptive: Initialize failed (SingleSampleDecrypter)

Here is the debug.log from the FireTV:

kodi.log

CastagnaIT commented 3 weeks ago

@Uukrull can you play SMOOTHSTREAM - DRM tearsofsteel.strm.txt attached above on the FireTv and provide the logcat? maybe the system can show something else useful (remember also to enable Kodi debug setting)

Uukrull commented 3 weeks ago

The spinning wheel is stuck and nothing is played with that strm.

kodi.log logcat.txt

CastagnaIT commented 3 weeks ago

there are two problems 1) if the WRMHEADER dont contains LA_URL inside DATA, then can fails, looks like a implementation bug of android playready https://github.com/google/ExoPlayer/blob/dd430f7053a1a3958deea3ead6a0565150c06bfc/library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java#L491-L496 this can be fixed bu reconstructing the WRMHEADER. But for now we can use sample streams that have LA_URL inside DATA to skip this problem 2) The unknown problem, FIretv logcat is much more detailed than shield, seems there are similar errors

08-20 22:40:20.693   291   291 I PlayReadyDrmPlugin: getKeyRequest, 125:        optionalParameters 0 , index -2, customData size 0 data
08-20 22:40:20.761   291   291 I PlayReadyUtil: extractKeyId,299: kid 4Rplb+TbNES8tGkNFWTEHA==, size 24
08-20 22:40:20.762   291   291 I PlayReadyDrmPlugin: getKeyRequest,190: License server is set to https://profficialsite.keydelivery.mediaservices.windows.net/PlayReady/
...
[... more of these ...]
08-20 22:40:22.522   291   291 E PlayReadySession: getDecryptContext,673: cannot find kid , index(-2), kid size(16)
08-20 22:40:22.522   291   291 I PlayReadySession: [bindLicenseWithKID:439]: The key index:-2.
08-20 22:40:22.522   291   291 E PlayReadySession: [bindLicenseWithKID:443]: The key is invalid  !!
08-20 22:40:22.522   291   291 E PlayReadyCryptPlugin: decrypt,439: session id(sid02) bindLicenseWithKID failed!

both complains of invalid KID

found a old issue on exoplayer with same errors, maybe similar problem https://github.com/google/ExoPlayer/issues/5855#issuecomment-492179782

CastagnaIT commented 1 week ago

@Uukrull can you test on FireTv if at least one of these strm works STRM_PR_ISA.zip

by using test build: https://jenkins.kodi.tv/blue/organizations/jenkins/xbmc%2Finputstream.adaptive/detail/PR-1668/7/artifacts

Uukrull commented 1 week ago

None work.

kodi.log logcat.txt

CastagnaIT commented 1 week ago

thanks no luck im not able to understand the problem but at least first two smoothstreaming strm above now works again with last release