videojs / videojs-contrib-eme

Supports Encrypted Media Extensions for playback of encrypted content in Video.js
Other
203 stars 72 forks source link

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

Closed brandonocasey closed 4 years ago

brandonocasey commented 4 years ago

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.

brandonocasey commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

vlee-harmonicinc commented 3 years ago

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?