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

Feature/restrictions #36

Merged
merged 14 commits into from
Mar 17, 2015

Conversation

sanbornhilland
Copy link
Contributor

Updated pull request for #32 based on the discussion in #33

Several things worth discussing:

  1. Should all restrictions be settable? Since restrictions can be set at any time, there is the potential to override the restrictions set after the license request. Is this problematic?
  2. I had to remove @struct from the Restrictions object documentation in order to access it with '[]' notation. I'm not very familiar with the Closure compiler so you guys can provide guidance here if this is a poor approach.

@joeyparrish joeyparrish mentioned this pull request Mar 12, 2015
* @return {Object} restrictions Contains the current restrictions
* @export
*/
shaka.player.Player.prototype.getRestrictions = function() {
Copy link
Member

Choose a reason for hiding this comment

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

I like that this is a clone of the Restrictions object, but instead of returning a generic Object, let's return an instance of Restrictions instead. To this end, please add a clone() method to Restrictions.prototype.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this idea. But just with respect to the issue below of replacing struct on Restrictions, the way I would like to implement the clone() method would be similar to this because rather than explicitly setting each property because then there is no need to modify this method if new restrictions are added at some point. This will prohibit me from replacing struct, even if the changes below are made. Am I right about this?

@joeyparrish
Copy link
Member

Overall, looks pretty good. If we change getRestrictions/setRestrictions a bit, the flow to update or add restrictions for the caller becomes:

var r = player.getRestrictions();
r.maxBandwidth = 5;
player.setRestrictions(r);

This won't interfere with or replace any resolution constraints imposed by the license server, and the two restrictions can be set in any order.

In fact, you could even have EmeManager request restrictions from the Player in the same way:

var restrictions = player.getRestrictions();
postProcessor(response, restrictions);
player.setRestrictions(restrictions);

Then player.setRestrictions doesn't have to update EmeManager and EmeManager doesn't need to keep a copy of restrictions.

@@ -44,7 +46,7 @@ goog.require('shaka.util.Uint8ArrayUtils');
* @struct
* @extends {shaka.util.FakeEventTarget}
*/
shaka.media.EmeManager = function(parent, video, videoSource) {
shaka.media.EmeManager = function(parent, video, videoSource, restrictions) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's make convert "parent" to "player" (type shaka.player.Player). We're already passing the player as the parent, but let's have EME manager store this.player_ instead of this.restrictions_.

Then, instead of postProcessor(this.restrictions_), this.videoSource_.setRestrictions(this.restrictions_), we can say restrictions = this.player_.getRestrictions(), postProcessor(restrictions), this.player_.setRestrictions(restrictions).

That will make the postProcessor flow and the independent, application-level flow the same.

@@ -470,7 +473,7 @@ shaka.media.EmeManager.prototype.requestLicense_ =
function(response) {
shaka.log.info('onLicenseSuccess_', session);
if (postProcessor) {
var restrictions = new shaka.player.DrmSchemeInfo.Restrictions();
var restrictions = this.player_.getRestrictions();
response = postProcessor(response, restrictions);
this.videoSource_.setRestrictions(restrictions);
Copy link
Member

Choose a reason for hiding this comment

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

Should be this.player_.setRestrictions now.

@joeyparrish
Copy link
Member

Looks great. Thanks for taking the time to work on this!

joeyparrish added a commit that referenced this pull request Mar 17, 2015
@joeyparrish joeyparrish merged commit a4e9bc3 into shaka-project:master Mar 17, 2015
@joeyparrish joeyparrish mentioned this pull request Mar 17, 2015
joeyparrish added a commit that referenced this pull request Mar 18, 2015
This resolves a compile-time conflict between changes to EmeManager
(commit a4e9bc3, merge of pull request #36) and OfflineVideoSource
(commit 18a843e), merged together in f204c8d to create a compiler
error:

offline_video_source.js:81: ERROR - actual parameter 1 of EmeManager
                                    does not match formal parameter
found   : shaka.player.OfflineVideoSource
required: shaka.player.Player
            new shaka.media.EmeManager(this, fakeVideoElement, this);

Change-Id: I6b263ef0e443bb305f96928b0d0c5019056d7014
@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
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants