Skip to content

[RFC] Add FairPlay as a DRM scheme - #653

Closed
keithah wants to merge 1 commit into
emilsvennesson:masterfrom
keithah:fairplay
Closed

keithah wants to merge 1 commit into
emilsvennesson:masterfrom
keithah:fairplay

Conversation

@keithah

@keithah keithah commented Nov 30, 2026

Copy link
Copy Markdown

Draft, request for comments. One of three linked drafts about FairPlay Streaming on Apple platforms. It depends on the Kodi one and should not be merged before that is settled.

Repository Draft What it holds
xbmc/xbmc xbmc/xbmc#30942 The player, the license exchange, the routing, System.HasFairPlay
xbmc/inputstream.adaptive xbmc/inputstream.adaptive#2148 FairPlay key system names in the drm property, a sample
script.module.inputstreamhelper this PR FairPlay as a DRM scheme add-ons can ask for

What this does

Adds fairplay, com.apple.fps and com.apple.fairplay as accepted drm arguments.

from inputstreamhelper import Helper

if Helper('hls', drm='com.apple.fps').check_inputstream():
    # ask the service for its HLS/FairPlay stream
elif Helper('mpd', drm='com.widevine.alpha').check_inputstream():
    # ask the service for its DASH/Widevine stream

With a FairPlay argument check_inputstream():

  • returns whether this Kodi can play FairPlay Streaming, which it reads from the boolean condition System.HasFairPlay;
  • returns false for any protocol other than hls;
  • shows no dialog and does not try to install anything.

Background

There is no Widevine CDM for macOS, iOS or tvOS that Kodi can use, so protected streams from add-ons do not play there. The services behind those add-ons also offer FairPlay Streaming, which Safari and the native apps use.

FairPlay cannot be handled the way Widevine is. Only Apple's media pipeline can decrypt it, and the pipeline only accepts an HLS URL plus answers to its key requests; an app cannot hand it samples it demuxed itself without a private entitlement. So the linked Kodi draft adds a player core that plays FairPlay HLS through AVPlayer, and reads the same inputstream.adaptive.drm property add-ons already set for Widevine:

li.setProperty('inputstream', 'inputstream.adaptive')
li.setProperty('inputstream.adaptive.drm', json.dumps({
    'com.apple.fps': {'license': {
        'server_url': license_url,
        'server_certificate_url': certificate_url,
        'req_headers': 'Authorization=Bearer ...',
    }}}))

The one thing an add-on cannot do well on its own is decide which of the two streams to request. Testing System.Platform.OSX is wrong on a Kodi that has no FairPlay support, and wrong again when support changes. This PR gives add-ons the question they already ask for Widevine.

Choices made here

  • Detection through System.HasFairPlay. The Kodi draft adds that condition. A Kodi that does not know it answers false, as it does for any unknown condition, so there is no version or platform table to maintain in this module.
  • No dialogs. For Widevine a failed check explains itself to the user and offers an install. Here the call is how an add-on chooses a scheme, and on every non-Apple device the answer is simply no. A dialog would appear on each of them.
  • No InputStream add-on check. Kodi plays these items itself and routes them before inputstream.adaptive is opened; it works with that add-on absent. Requiring it would only add an install prompt.

Questions

  1. Is "no dialog on false" acceptable, given that it differs from the Widevine path? An alternative is a separate method for the question, leaving check_inputstream() unchanged.
  2. Do you want this module to carry more for FairPlay later, such as building the drm property, or should it stay a capability check?

Tested

  • Three new unit tests: supported, unsupported Kodi, unsupported protocol. They pass, together with the existing macOS arm64 tests.
  • Not yet run inside Kodi, only against the test stubs. System.HasFairPlay itself was checked in a running Kodi built from the linked draft.
  • The whole test suite was not run locally; CI will show it.

🤖 Generated with Claude Code

Kodi plays FairPlay Streaming itself on Apple platforms, for HLS, and
reports that with the System.HasFairPlay condition. With a FairPlay drm
argument check_inputstream() returns that condition without dialogs, so
add-ons can use it to choose between a FairPlay and a Widevine stream.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@keithah

keithah commented Nov 30, 2026

Copy link
Copy Markdown
Author

Withdrawing this for now. It only wraps a one-line call add-ons can make themselves (xbmc.getCondVisibility('System.HasFairPlay')), and that condition is not merged in Kodi yet. Whether this module should learn FairPlay is asked in xbmc/xbmc#30942; I will reopen this if it is wanted.

@keithah keithah closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant