hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Long `EMEController. destroy` block the next time setMediaKeys

Open JackPu opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

We recently used a class public static property(CDMCleanupPromise) to track the EME destroy promise.

https://github.com/video-dev/hls.js/blob/master/src/controller/eme-controller.ts#L1261

There is a hidden issue like this:

image

If our destroying promise cannot be resolved or rejected(mediaKeySession.remove cannot resolve), the next time we will fail to setMediaKeys: https://github.com/video-dev/hls.js/blob/master/src/controller/eme-controller.ts#L693-L710

We have found the issue on the Samsung and Comcast platforms. It seems cannot reolsve the method mediaKeySession.remove().

Describe the solution you'd like

I plan to add maxEMEDetroyTimeout config. We will force to clear the CDMCleanupPromise value if we reach the max timeout value.

Additional context

It worked well on most platforms. However, it failed on some low-performance OTT devices from Comcast. I didn't find any error report when destroying the instance. And I remove the CDMCleanupPromise setter when destroying. It could work for me.

JackPu avatar Oct 25 '24 06:10 JackPu

@JackPu has this issue been resolved by #7050 or other recent EME PRs?

  • #7050
  • #7284
  • #7287

Is a timeout on CDMCleanupPromise still missing?

robwalch avatar Jun 09 '25 18:06 robwalch