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

fix: try to re-request key if the session expired #120

Merged
merged 2 commits into from
Sep 15, 2020

Conversation

brandonocasey
Copy link
Contributor

Re request the key when the session is expired. This fixes multiple potential issues:

  1. The tab was throttled in the background or completely paused, causing the key to never be re-requested.
  2. The key request timing was a little off in the server that is being used, causing the session to expire.
  3. The request for the key to renew generally takes too long and expires before we renew it.

I don't think we should have any problems doing this because if the user no longer has access to the key or we fail to get the key after expiration then we will still fail to create a new session. If they do still have access though we will get a new session and continue playback as expected.

Copy link
Contributor

@gesinger gesinger left a comment

Choose a reason for hiding this comment

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

Is there a risk here that we can make multiple requests for the same license? For instance, will the encrypted event potentially fire after a key expires?

@brandonocasey
Copy link
Contributor Author

I don't think the encrypted event will fire after a key expires unless the source is reset using player.src. The only potential event that could fire is license-renewal but that will fail after the key is already expired as renewals have to happen before a key expires.

@gkatsev
Copy link
Member

gkatsev commented Sep 1, 2020

And the expired thing only happens for the current stream? It isn't likely that we'll get an expired response after we had already changes sources or something like that, right?

@brandonocasey
Copy link
Contributor Author

It will only happen after the current stream/source. I think we reset all sessions between sources.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me.

@gkatsev gkatsev changed the title fix: re request key fix: try to re-request key if the session expired Sep 1, 2020
@brandonocasey brandonocasey merged commit 20d6adc into main Sep 15, 2020
@brandonocasey brandonocasey deleted the fix/re-request-key branch September 15, 2020 20:30
@vlee-harmonicinc
Copy link

There is a "license-renewal" message.type from MediaKeyMessageEvent, which is fired by keySession.

What is the purpose of closing and removing keySession when receive 'expired'?
Is it possible to keep the keySession after expired and wait for renewal?

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.

None yet

4 participants