script.module.inputstreamhelper icon indicating copy to clipboard operation
script.module.inputstreamhelper copied to clipboard

Handling com.microsoft.playready DRM scheme

Open ivankokan opened this issue 5 years ago • 10 comments

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?

ivankokan avatar Jul 26 '20 11:07 ivankokan

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

We will merge acceptable pull requests that would add this.

dagwieers avatar Jul 26 '20 23:07 dagwieers

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: https://github.com/emilsvennesson/script.module.inputstreamhelper/blob/b0120b4bb0546de43279ffff957578768379bdb3/lib/inputstreamhelper/init.py#L57-L61 so (at least) having additional entry could be enough.

ivankokan avatar Jul 27 '20 00:07 ivankokan

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):

  • http://testweb.playready.microsoft.com/
  • http://playready.directtaps.net/smoothstreaming/

dagwieers avatar Jul 27 '20 00:07 dagwieers

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.

horstle avatar Jul 30 '20 09:07 horstle

@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.

dagwieers avatar Jul 30 '20 16:07 dagwieers

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

scottydulton avatar Dec 31 '20 13:12 scottydulton

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. https://github.com/emilsvennesson/script.module.inputstreamhelper/blob/b0120b4bb0546de43279ffff957578768379bdb3/lib/inputstreamhelper/init.py#L57-L61

If you need more information, please let us know.

ivankokan avatar Dec 31 '20 16:12 ivankokan

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.

horstle avatar Jan 08 '21 16:01 horstle

was this added in Kodi Nexus?

27hectormanuel avatar May 25 '23 17:05 27hectormanuel

There were no changes so far in inputstremhelper concerning playready.

horstle avatar May 26 '23 08:05 horstle