rx-player icon indicating copy to clipboard operation
rx-player copied to clipboard

eme: add `formatInitializationData` keySystems option

Open peaBerberian opened this issue 3 years ago • 0 comments

This is a very very simple implementation of #1017, which basically adds a formatInitializationData callback to the keySystems loadVideo option.

This callback will allow an application to generate its own encrytion initialization data, for when the right one is not in the content.

I'm still unsure if this is the right way to do it though:

  1. By putting its logic only in the EMEManager (for simplicity reason), the new initialization data will not be known from any other module.

    This may be dangerous for future evolutions if we're not careful. E.g., another module could presume that the wanted keySystem's data is unavailable and thus bypass completely the EMEManager logic.

  2. formatInitializationData takes an Uint8Array as argument and outputs an Uint8Array.

    This makes sense in the current code, yet we may also prefer a more generic ArrayBuffer type here.

  3. It takes as argument every initialization data concatenated and return what should be fed to MediaKeySession.generateRequest. As such, it is kind-of a low-level very specialized callback, without the notion of a "pssh" nor of a "key system".

    This can both be good or bad.

peaBerberian avatar Oct 26 '21 15:10 peaBerberian