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

Add FairPlay hls_key_uri support to encryption config #76

Open
mardu opened this issue Jun 14, 2021 · 0 comments
Open

Add FairPlay hls_key_uri support to encryption config #76

mardu opened this issue Jun 14, 2021 · 0 comments
Labels
priority: P2 Smaller impact or easy workaround type: enhancement New feature or request
Milestone

Comments

@mardu
Copy link

mardu commented Jun 14, 2021

At the moment shaka-packager has a --hls_key_uri option for FairPlay.
If it is not set, it will be generated from key_id like this:

  if (IsFairPlaySystemId(system_id)) {
    std::string key_uri = hls_params().key_uri;
    if (key_uri.empty()) {
      // Use key_id as the key_uri. The player needs to have custom logic to
      // convert it to the actual key uri.
      std::string key_uri_data = VectorToString(key_id);
      key_uri = Base64EncodeData(kUriFairPlayPrefix, key_uri_data);
    }

    // FairPlay defines IV to be carried with the key, not the playlist.
    const std::vector<uint8_t> empty_iv;
    NotifyEncryptionToMediaPlaylist(encryption_method, key_uri, empty_key_id,
                                    empty_iv, "com.apple.streamingkeydelivery",
                                    "1", media_playlist.get());
    return true;
  }

This however need custom player logic as noted in the comment which i am trying to avoid.

It would make sense to add hls_key_uri option to encryption config as a parameter.
If i hardcode hls_key_uri as skd://XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX in packager_node.py then FairPlay with Shaka Player demo starts playing the video correctly.
Maybe there is another way to pass the correct URI to playlist?
The pipeline configuration looks like this:

encryption:
  enable: True
  encryption_mode: raw
  keys:
    - key_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  iv: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  protection_systems:
    - FairPlay
  protection_scheme: cbcs
@joeyparrish joeyparrish added type: enhancement New feature or request and removed needs triage labels Sep 8, 2021
@joeyparrish joeyparrish added this to the Backlog milestone Sep 8, 2021
@joeyparrish joeyparrish added the priority: P2 Smaller impact or easy workaround label Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: P2 Smaller impact or easy workaround type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants