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

Handling com.microsoft.playready DRM scheme #389

Open
ivankokan opened this issue Jul 26, 2020 · 10 comments
Open

Handling com.microsoft.playready DRM scheme #389

ivankokan opened this issue Jul 26, 2020 · 10 comments

Comments

@ivankokan
Copy link

I see that inputstream.adaptive supports com.microsoft.playready along with com.widevine.alpha (https://github.com/peak3d/inputstream.adaptive/wiki/Integration#inputstreamadaptivelicense_type).

Will it be handled within Helper, e.g. https://github.com/emilsvennesson/script.module.inputstreamhelper/blob/master/lib/inputstreamhelper/config.py#L14-L17?

@dagwieers
Copy link
Collaborator

What would be needed to add support? What platforms are supported?

We will merge acceptable pull requests that would add this.

@ivankokan
Copy link
Author

ivankokan commented Jul 27, 2020

What would be needed to add support? What platforms are supported?

Not sure at this moment. I bumped into it while I was comparing:

  1. https://github.com/emilsvennesson/script.module.inputstreamhelper#example
  2. https://github.com/emilsvennesson/script.module.inputstreamhelper/wiki/Integration#integrating-in-your-add-on
  3. https://github.com/peak3d/inputstream.adaptive/wiki/Integration#inputstreamadaptivelicense_type

This tells something, though:

https://github.com/peak3d/inputstream.adaptive/wiki#supported-drm
https://github.com/peak3d/inputstream.adaptive/wiki/Integration#inputstreamadaptivelicense_type

NOTE: the wvdecrypter DRM interface part of this addon supports com.microsoft.playready only on Android devices.
com.widevine.alpha requires libwidevine decryption library on all operating systems except Android

Browsing through inputstream.adaptive it seems that playready implementation is in place and not so special, so I guess passing any valid DRM scheme from inputstreamhelper to inputstream.adaptive would do.

https://github.com/peak3d/inputstream.adaptive/search?q=playready&type=Code

On the other hand, passing com.microsoft.playready would break this:

if self.drm:
if self.drm not in config.DRM_SCHEMES:
raise InputStreamException('UnsupportedDRMScheme')
self.drm = config.DRM_SCHEMES[drm]

so (at least) having additional entry could be enough.

@dagwieers
Copy link
Collaborator

I doubt there is anything inputstreamhelper can help with (on Android) and therefore should not be a dependency when playing PlayReady-protected streams. Unless there is any proof to the contrary. What probably could help this effort is demo PlayReady streams that people can test (on Android):

@horstle
Copy link
Collaborator

horstle commented Jul 30, 2020

I think ideally ISH should support the same DRM schemes as IS.A.

AFAIK in some cases streams are protected with PlayReady in higher resolutions, but use Widevine for lower ones. So it might help if ISH could check for PlayReady support. Then an addon could do something like this:

if Helper(drm='com.microsoft.playready').check_inputstream():
    # play with playready
elif Helper(drm='com.widevine.alpha').check_inputstream():
    # play with widevine
else:
    ...    

Any ideas how to check for PlayReady support? Best would be if it wasn't necessary to try and play a test file.

@dagwieers
Copy link
Collaborator

@horstle We can add it, but it would only use PlayReady on Android currently, and it would be up to the add-on to have an option to select which DRM-selection mechanism to use if both are supported. And ISH would not be doing anything with it, except maybe return if not Android.

Personally, I would wait until there is an actual need for this from an add-on, and this could be tested.

@scottydulton
Copy link

i am using an Android fire tv 4k trying to run the NBA plugin and on live games i have no sound but i do in archived games.
i am getting a warning in my logs mentioning microsoft playready, can anyone tell me what the issue is here?
live game Fire TV.log

@ivankokan
Copy link
Author

ivankokan commented Dec 31, 2020

Thanks @scottydulton! The audio issue should not be related to ISH, I wanted to focus on playready here.

@dagwieers @horstle As you can see here https://github.com/ivankokan/xbmc.plugin.video.nba/blob/master/src/common.py, we are explicitly using com.widevine.alpha DRM scheme, but com.microsoft.playready appears in the log (we noticed this only when running the add-on on Fire TV - No! Running it in Kodi on Windows as well.):

2020-12-30 16:18:00.062 T:9500   DEBUG: CurlFile::Open(0x7d0ee480) https://lion-nba-msl.akamaized.net/cmaf/live/2023073/nlds/nba/akmsl/drm/cmaf/wvpr/sac/as/live/nlncp/0022000055-b/br_6000_video/br_6000_long_fmp4Video.m3u8
2020-12-30 16:18:00.075 T:9500   DEBUG: AddOnLog: InputStream Adaptive: Download https://lion-nba-msl.akamaized.net/cmaf/live/2023073/nlds/nba/akmsl/drm/cmaf/wvpr/sac/as/live/nlncp/0022000055-b/br_6000_video/br_6000_long_fmp4Video.m3u8 finished
2020-12-30 16:18:00.076 T:9500 WARNING: AddOnLog: InputStream Adaptive: Unknown encryption method: SAMPLE-AES-CTR with keyformat com.microsoft.playready
2020-12-30 16:18:00.083 T:9500   DEBUG: AddOnLog: InputStream Adaptive: Entering encryption section
2020-12-30 16:18:00.126 T:9500   DEBUG: AddOnLog: InputStream Adaptive: Use stored Service Certificate
2020-12-30 16:18:00.126 T:9500   DEBUG: AddOnLog: InputStream Adaptive: Successful instanciated deviceUniqueIdSize: 32,systemId: 8415 security-level: L1
2020-12-30 16:18:00.126 T:9500   DEBUG: AddOnLog: InputStream Adaptive: Initializing stream with KID: 17C525D4E4138F9BFF3ECAC67B20CEE3
2020-12-30 16:18:00.142 T:9500   DEBUG: AddOnLog: InputStream Adaptive: SessionId: sid2, MaxSecurityLevel: -1
2020-12-30 16:18:00.167 T:9500   DEBUG: AddOnLog: InputStream Adaptive: Key request successful size: 1947
2020-12-30 16:18:00.173 T:9500   DEBUG: CurlFile::ParseAndCorrectUrl() adding custom header option 'authorization: ***********'
2020-12-30 16:18:00.174 T:9500   DEBUG: CurlFile::Open(0x7d0ee480) https://shield-twoproxy.imggaming.com/proxy

We would like to test com.microsoft.playready DRM scheme as well (I do not know what would be different), but ISH would apparently throw an exception.

if self.drm:
if self.drm not in config.DRM_SCHEMES:
raise InputStreamException('UnsupportedDRMScheme')
self.drm = config.DRM_SCHEMES[drm]

If you need more information, please let us know.

@horstle
Copy link
Collaborator

horstle commented Jan 8, 2021

I think if you just add com.microsoft.playready to DRM_SCHEMES you should be good to go. Maybe just give it a try and if there is any advantage in using playready we can think about how to add it properly.

@27hectormanuel
Copy link

was this added in Kodi Nexus?

@horstle
Copy link
Collaborator

horstle commented May 26, 2023

There were no changes so far in inputstremhelper concerning playready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants