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

feat: Add support for Modern EME and legacy Apple Media Keys for FairPlay #4309

Merged
merged 2 commits into from
Jun 29, 2022

Conversation

avelad
Copy link
Member

@avelad avelad commented Jun 22, 2022

Add support for Modern EME and legacy Apple Media Keys for FairPlay
Add more FairPlay documentation

@avelad avelad added type: enhancement New feature or request component: FairPlay The issue involves the FairPlay DRM labels Jun 22, 2022
@avelad avelad added this to the v4.2 milestone Jun 22, 2022
@@ -133,13 +133,83 @@ shaka.util.FairPlayUtils = class {
}

/**
* SPC FairPlay request.
* Verimatrix initDataTransform configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if everyone thinks adding vendor specific code is a good long term approach. Would we add individual utils for every vendor? What about apps that only use Shaka for DASH playback? Can these utils be excluded?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good question, I have done it this way to simplify the life of integrators and because there is almost no duplication, but it can be changed. I would like to hear more opinions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've heard from developers both inside and outside Google that Shaka's modularity is a concern.

Today, you can compile the player in a way that only includes the modules you care about. But the result is still a monolithic JS binary. Instead, I think many people would like to be able to include a list of composable modules in their application (either to be bundled into the app or to be loaded as separate scripts for development).

So in today's world, you can compile your own custom build of Shaka Player that drops any module you want. No other part of Shaka Player depends on FairPlayUtils, so I think it should be moved from build/types/core to build/types/hls, so that anyone who excludes HLS will exclude FairPlayUtils, as well.

In the future, it would be nice to have runtime modularity instead of build-time modularity, as well as easier granularity for those modules.

An alternative to moving FairPlayUtils out of core would be to move the vendor-specific snippets into documentation. Or perhaps into a "contrib" folder that gets checked by the compiler for type-compatibility, but doesn't get included in any build by default.

I think the easiest thing would be to keep the vendor-specific snippets, but move the module from core to build/types/hls. But I'm open to the other ideas I mentioned, or any other ideas y'all might have.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@littlespex, if the three of us can agree on this issue, I think I'm happy with the rest of the PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree with moving it into HLS, since Fairplay can work with DASH (I'm working on it with some provider) and with src=.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could always put it into its own group. Individual files can be excluded at build-time, but it's hard to discover the fact that FairPlayUtils is independent enough to be excluded. If it were in its own group, (build/types/fairplay), then people who use the build customization (if there are any other than me) could python build/build.py +@complete -@fairplay.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree to create a fairplay (type) folder... but... it would be moving fairplay_utils.js in its entirety, and that means a breaking change, so a 5.0 version would have to be made and I think that's not the best thing right now since It would delay this change too long.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A solution would be to create the group, include it by default, but leave the file in util, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with leaving the vender specific functions as is and moving the whole feature from core to types.

As for the build time vs run time modularity, embracing ES modules should provide a solution that covers both cases. If the core and all of the modules are compiled separately, the app developer can include the desired modules via static or dynamic imports, and modern bundlers will package the code accordingly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joeyparrish @littlespex, I have added a new type, I hope that now the solution will convince you more.

@joeyparrish
Copy link
Member

Looks good to me, but waiting to approve until we all agree on the inclusion and placement of the utils.

@avelad avelad requested a review from littlespex June 28, 2022 20:32
@avelad avelad merged commit 5441f93 into shaka-project:main Jun 29, 2022
@avelad avelad deleted the legacy-fairplay branch June 29, 2022 05:14
theodab pushed a commit to theodab/shaka-player that referenced this pull request Jul 11, 2022
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: FairPlay The issue involves the FairPlay DRM status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants